Gel2D - The free/open source game creation suite

gelKeyFrame.h
Go to the documentation of this file.
00001 /*
00002 Gel2D Game Engine - Cross-platform 2D gaming middleware
00003 Copyright (C) 2011 Mark D. Procarione
00004 
00005 Gel2D is free software: you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation, either version 3 of the License, or
00008 (at your option) any later version.
00009 
00010 Gel2D is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013 GNU General Public License for more details.
00014 */
00015 
00016 #ifndef __GELKEYFRAME_H__
00017 #define __GELKEYFRAME_H__
00018 
00019 #include "gelNamespace.h"
00020 #include "gelObject.h"
00021 #include "gelLinkedList.h"
00022 #include "gelTimer.h"
00023 
00024 namespace gel
00025 {
00028 
00029         class GelKeyFrame
00030         {
00031                 public:
00032             int frame; // frame number location of key - should this be a time location instead?
00033 
00034             Gel2dVec data;
00035 
00036     };
00037 
00038         class GelAnimation
00039         {
00040                 public:
00041             GelAnimation();
00042 
00044             void addKeyFrame( int frame );
00045 
00046             //void setKeyFrame( int index, Gel2dVec dat ) { pos[index].data = dat; }
00047             //void setKeyFrame( GelKeyFrame key ) { pos[index] = key; }
00048             void addKeyFrame( GelKeyFrame key );
00049 
00051             void apply( GelObject *obj );
00052 
00054             void update();
00055 
00056                 private:
00057             GelLinkedList<GelKeyFrame> pos;
00058             GelTimer timer;
00059             int framePos; // current frame number - should this be a time location instead?
00060             Gel2dVec curPos;
00061             // maybe add a linked list of object pointers to update
00062     };
00064 }
00065 
00066 #endif // __GELKEYFRAME_H__