Commits

Devlon committed 3475aa0

Adding some tests for current features.

Comments (0)

Files changed (28)

     
 PROJECT(cepheus CXX)
 
-set (CMAKE_CXX_COMPILER                   "/usr/bin/clang++")
+SET (CMAKE_CXX_COMPILER                   "/usr/bin/clang++")
 SET (CMAKE_CXX_FLAGS_INIT                 "-Wall -pedantic -fPIC -shared -g")
 SET (CMAKE_LINK_FLAGS                     "-fPIC -shared")
 
                         src/Graphics/Screen.cpp
                         src/Graphics/GraphicManager.cpp
                         src/Scene/Scene.cpp
+                        src/Scene/SceneManager.cpp
                         src/Scene/Component.cpp
-                        src/Scene/Panel.cpp
                         src/Scene/SceneManager.cpp
 )
 
 )
 
 ADD_LIBRARY (
-        cepheus_shared      SHARED          ${SOURCES}    
+        cepheus_shared          SHARED          ${SOURCES}    
+)
+ADD_LIBRARY (
+        cepheus_static          STATIC          ${SOURCES}
 )
 
-# SET_PROPERTY(TARGET     cepheus_shared PROPERTY SOVERSION 1.0)
-# SET_PROPERTY(TARGET     cepheus_shared PROPERTY VERSION 1.0)
 FIND_LIBRARY( 
             SDL_LIB 
             NAMES                   SDL SDL-1.2
         cepheus_shared          ${SDL_LIB}      ${SDLMAIN_LIB} 
 )
 
-add_library (
-        cepheus_static          STATIC          ${SOURCES}
-)
+
 TARGET_LINK_LIBRARIES( 
-        cepheus_static                          ${SDL_LIB}
+        cepheus_static           ${SDL_LIB}     ${SDLMAIN_LIB}
 )
 
 
-# SET_PROPERTY(TARGET cepheus_static PROPERTY SOVERSION 1.0)
-# SET_PROPERTY(TARGET cepheus_static PROPERTY VERSION 1.0)
-
 SET_TARGET_PROPERTIES(
                      cepheus_shared 
                      cepheus_static 
         test1_shared                  src/tests/main1.cpp
 )
 ADD_EXECUTABLE(
+        test2_shared                  src/tests/test2.cpp
+)
+ADD_EXECUTABLE(
+        test3_shared                  src/tests/test3.cpp
+)
+ADD_EXECUTABLE(
         test1_static                  src/tests/main1.cpp
 )
+ADD_EXECUTABLE(
+        test2_static                  src/tests/test2.cpp
+)
+ADD_EXECUTABLE(
+        test3_static                  src/tests/test3.cpp
+)
+
+### Generate shared linked binaries
 TARGET_LINK_LIBRARIES(
         test1_shared           cepheus_shared
 )
 TARGET_LINK_LIBRARIES(
-        test1_static           cepheus_static
+        test2_shared           cepheus_shared
+)
+TARGET_LINK_LIBRARIES(
+        test3_shared           cepheus_shared
+)
+
+### Generate static linked binaries
+TARGET_LINK_LIBRARIES(
+       test1_static           cepheus_static
+)
+TARGET_LINK_LIBRARIES(
+       test2_static           cepheus_static
+)
+TARGET_LINK_LIBRARIES(
+       test3_static           cepheus_static
 )
 # file(REMOVE ${CONF_FILE})
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   POSSIBILITY OF SUCH DAMAGE.
 *******************************************************************************/
+#include "../headers/Core/Config.h"
+Cepheus :: Config :: Config(){}
+Cepheus :: Config :: Config( std::string filename ){
+    this->loadConfig(filename);
+}
+Cepheus :: Config :: ~Config(){}
+void Cepheus :: Config ::loadConfig(std::string filename){}
+void Cepheus :: Config ::saveConfig(std::string filename){}
 
-
 Cepheus:: Entity :: Entity(int X, int Y, int W, int H):
                                             _X(X),_Y(Y),_W(W),_H(H){}
 
-int Cepheus :: Entity :: getX(){ return this->_X; }
-int Cepheus :: Entity :: getY(){ return this->_Y; }
-int Cepheus :: Entity :: getWidth(){ return this->_W; }
-int Cepheus :: Entity :: getHeight(){ return this->_H; }
-int Cepheus :: Entity :: getId(){ return this->_Id; }
+int Cepheus :: Entity :: getX(){ return _X; }
+int Cepheus :: Entity :: getY(){ return _Y; }
+int Cepheus :: Entity :: getWidth(){ return _W; }
+int Cepheus :: Entity :: getHeight(){ return _H; }
+int Cepheus :: Entity :: getId(){ return _Id; }
 
-void Cepheus :: Entity :: setX(int X){ this->_X = X; }
-void Cepheus :: Entity :: setY(int Y){ this->_Y = Y; }
-void Cepheus :: Entity :: setWidth(int W){ this->_W = W; }
-void Cepheus :: Entity :: setHeight(int H){ this->_H = H; }
-void Cepheus :: Entity :: setId(int Id){ this->_Id = Id; }
+void Cepheus :: Entity :: setX(int X){ _X = X; }
+void Cepheus :: Entity :: setY(int Y){ _Y = Y; }
+void Cepheus :: Entity :: setWidth(int W){ _W = W; }
+void Cepheus :: Entity :: setHeight(int H){ _H = H; }
+void Cepheus :: Entity :: setId(int Id){ _Id = Id; }
 
 
 #include "../headers/Core/Game.h"
 
 Cepheus :: Game :: Game(){
-    this->init();
+    init();
 }
 Cepheus :: Game :: ~Game(){
-    this->init();
+    init();
 }
 void Cepheus :: Game :: render(Cepheus::GraphicManager *gm){}
 void Cepheus :: Game :: update(){}
 
-Cepheus :: Game :: Game( int fps ):_fps(fps){ this->init(); }
+Cepheus :: Game :: Game( int fps ):_fps(fps){ init(); }
 
 void Cepheus :: Game :: init(){
     
-    this->_quit = false;
-    this->_cicle = 0;
-    this->_lastcicle = 0;
+    _quit = false;
+    _cicle = 0;
+    _lastcicle = 0;
     
     atexit(SDL_Quit);
     SDL_Init(SDL_INIT_VIDEO);
     
-    this->_gm = new Cepheus::GraphicManager();
-    this->_sm = new Cepheus::SceneManager();
-    this->_input = new Cepheus::Input();
+    _gm = new Cepheus::GraphicManager();
+    _sm = new Cepheus::SceneManager();
+    _input = new Cepheus::Input();
 
 
 }
 void Cepheus :: Game :: destroy(){
-    delete this->_input;
-    delete this->_gm;
-    delete this->_sm;
+    delete _input;
+    delete _gm;
+    delete _sm;
 }
 void Cepheus :: Game :: run(){    
     // Enter main loop.
-    this->loop();
+    loop();
     
     // Clear Screen.
-    (this->getGraphicManager()->getScreen())->clear();
+    getGraphicManager()->getScreen()->clear();
 }
 void Cepheus :: Game :: tick(){
-    this->_lastcicle += 1000 / this->_fps;
+    _lastcicle += 1000 / _fps;
 }
 void Cepheus :: Game :: exit(){
-    this->_quit = true;
+    _quit = true;
 }
 Cepheus::GraphicManager* Cepheus :: Game :: getGraphicManager(){
-    return this->_gm;
+    return _gm;
 }
 Cepheus::SceneManager* Cepheus :: Game :: getSceneManager(){
-    return this->_sm;
+    return _sm;
 }
 Cepheus::Input* Cepheus :: Game :: getInput(){
-    return this->_input;
+    return _input;
 }
 
 void Cepheus :: Game :: loop(){
     // Main Loop with Framerate limit.
     while(!_quit){
-        this->_cicle = SDL_GetTicks();
-        if ( this->_cicle <= _lastcicle)
+        _cicle = SDL_GetTicks();
+        if ( _cicle <= _lastcicle)
         {
             SDL_Delay(1);
             continue;
         }
-        this->_cicle = SDL_GetTicks();
-        while (this->_lastcicle < _cicle) {
-            this->_input->update();
-            this->update();
-            this->render( this->getGraphicManager() );
-            this->tick(); 
+        _cicle = SDL_GetTicks();
+        while (_lastcicle < _cicle) {
+            _input->update();
+            update();
+            render( getGraphicManager() );
+            tick(); 
         }
     }
 }
     SDL_PumpEvents();
     
     // Get Keyboard state
-    this->_keystate = SDL_GetKeyState(NULL);
+    _keystate = SDL_GetKeyState(NULL);
     
     // Get Mouse state
-    this->_mousestate._xrel = _mousestate._x;
-    this->_mousestate._yrel = _mousestate._y;
-    SDL_GetMouseState(&this->_mousestate._x, &this->_mousestate._y);
+    _mousestate._xrel = _mousestate._x;
+    _mousestate._yrel = _mousestate._y;
+    SDL_GetMouseState( &_mousestate._x, &_mousestate._y );
     for(count = 1; count <=3;count++){
-        if(SDL_GetMouseState(NULL,NULL) & SDL_BUTTON(count)){
-            this->_mousestate.buttons[count-1] = 1;
+        if( SDL_GetMouseState(NULL,NULL) & SDL_BUTTON(count) ){
+            _mousestate.buttons[count-1] = 1;
         }else{
-            this->_mousestate.buttons[count-1] = 0;
+            _mousestate.buttons[count-1] = 0;
         }
     }
 }
 bool Cepheus :: Input :: isPressed(Key k){
-    if ( this->_keystate[k] ){
+    if ( _keystate[k] ){
         return true;
     }
     return false;
 }
 bool Cepheus :: Input :: isClicked(Button b){
-    if( this->_mousestate.buttons[b] ){
+    if( _mousestate.buttons[b] ){
         return true;
     }
     return true;
 }
 Cepheus::Mouse  Cepheus :: Input :: getMouseState(){
-    return this->_mousestate;
+    return _mousestate;
 }
 

src/Graphics/GraphicManager.cpp

 
 Cepheus :: GraphicManager :: GraphicManager(){}
 Cepheus :: GraphicManager :: ~GraphicManager(){
-    this->unloadContents();
-    delete this->screen;
+    unloadContents();
+    delete _screen;
 }
 
 Cepheus::Screen* Cepheus :: GraphicManager :: getScreen(){
-    return this->screen;
+    return _screen;
 }
 void Cepheus :: GraphicManager :: setScreen( Cepheus::Screen *screen ){
-    this->screen = screen;
+    _screen = screen;
 }
 // Image Factory/Manipulation
 Cepheus::Image* Cepheus :: GraphicManager :: getNewSurface( int height, 
                                                                 int width ){
-    return this->getNewSurface( width, height, 32 );
+    return getNewSurface( width, height, 32 );
 }
 
 Cepheus::Image* Cepheus :: 
                 GraphicManager :: getNewSurface( int height, 
                                                     int width, int depth ){
     return new Cepheus::Image(
-                    SDL_CreateRGBSurface(
-                                0, width, height, 
-                                depth, 0, 0, 0, 0
-                    )
+              SDL_CreateRGBSurface(
+                          0, width, height, 
+                          depth, 0, 0, 0, 0
+              )
     );
 }
-
-void Cepheus :: GraphicManager 
-                    :: setChroma(int red, int green, int blue)
-{
-    int count =0;
-    while( count < this->resources.size() )
-    {
-        ( resources.at(count) ).setChroma(red,green,blue);
-        count++;
-    }
-}
-
 // Get image from repository
 Cepheus::Image* Cepheus :: 
             GraphicManager :: getImage( int image_id ){
     if( 
-        image_id < this->resources.size() 
+        image_id < _resources.size() 
         && image_id >= 0 
     ){
-        return &(this->resources.at(image_id));
+        return &( _resources[image_id] );
     }
     return NULL;
 }
 Cepheus::Image* Cepheus :: 
             GraphicManager :: getImage( int image_id, int x, int y,
                                             int heigth, int width ){
-                                                return new Image();
-                                            }
+    return new Image();
+}
 
 // Contents Management
 bool Cepheus :: GraphicManager :: loadContents( std::string filename ){
 }
 
 void Cepheus :: GraphicManager :: unloadContents(){
-    int count = this->resources.size();
+    int count = _resources.size();
     while(count > 0){
-        this->resources.erase(
-            this->resources.begin() + count
+        _resources.erase(
+            _resources.begin() + count
         );
         count--;
     } 
 }
 // Paint routines
-void Cepheus :: GraphicManager :: draw(Cepheus::Image *img){
-    (this->getScreen())->draw(img);
+void Cepheus :: GraphicManager :: render(Cepheus::Image *img){
+    getScreen()->blit(img);
+}
+void Cepheus :: GraphicManager 
+            :: setChroma(Cepheus::Image *img,int red, int green, int blue)
+{
+    img->setChroma(red,green,blue);
 }
 

src/Graphics/Image.cpp

 *******************************************************************************/
 
 #include "../headers/Graphics/Image.h"
+#include <iostream>
 
 Cepheus :: Image :: Image(){}
-Cepheus :: Image :: Image(SDL_Surface *img){ this->_src = img; }
+Cepheus :: Image :: Image(SDL_Surface *img){
+    _src = img;
+}
+Cepheus :: Image :: Image(const char *path){
+    _src = SDL_LoadBMP(path);
+}
 Cepheus :: Image :: Image(int width, int height, int depth){}
 // Depth: {4,8,16,32}
 Cepheus :: Image :: ~Image(){
-    SDL_FreeSurface(this->_src);
+    SDL_FreeSurface(_src);
 }
 
 // void Cepheus :: Image :: rotateImage(int degrees);
 SDL_Surface* Cepheus :: Image :: getSurface(){
-    return this->_src;
+    return _src;
 }
 SDL_Surface* Cepheus :: Image :: getSurface(
                                 int X, int Y, int H, int W){
     src.h = H;
     src.w = W;
     
-    SDL_BlitSurface(this->_src,&src,img,NULL);
+    SDL_BlitSurface(_src,&src,img,NULL);
     
     return img;
 }
 {
 
     SDL_SetColorKey( 
-                   this->_src, 
+                   _src, 
                    SDL_SRCCOLORKEY|SDL_RLEACCEL,
-                   SDL_MapRGB(this->_src->format, red, green, blue)
+                   SDL_MapRGB( _src->format, red, green, blue )
     );
 }
 

src/Graphics/Screen.cpp

 
 Cepheus :: Screen :: Screen(){}
 Cepheus :: Screen :: ~Screen(){
-    SDL_FreeSurface(this->src);
+    SDL_FreeSurface( _src );
 }
 
 // Overloaded Constructors
 Cepheus :: Screen :: Screen( int width, int height, int depth):
-                                width( width ),height(height),depth(depth){}
+                              _width( width ), _height(height), _depth(depth){}
                                 
 Cepheus :: Screen :: Screen( 
                     int width, int height, 
-                    int depth,int flags ):
-                                   width( width ), height( height ),
-                                   depth( depth ), flags( flags ){}
+                    int depth, int flags ):
+                                   _width( width ), _height( height ),
+                                   _depth( depth ), _flags( flags ){}
                                    
 void Cepheus :: Screen :: init(){
-    this->src = SDL_SetVideoMode( 
-                        this->width, this->height,
-                        this->depth,this->flags
+    _src = SDL_SetVideoMode( 
+                        _width, _height,
+                        _depth, _flags
     );
 }
 void Cepheus :: Screen :: clear(){
     SDL_FillRect(
-             this->src, 0,
-             SDL_MapRGB(this->src->format, 0, 0, 0)
+             _src, 0,
+             SDL_MapRGB( _src->format, 0, 0, 0 )
     ); 
 }
 void Cepheus :: Screen :: setTitle(const char * title){
             title, NULL
     );
 }
-void Cepheus :: Screen :: draw(Cepheus::Image *img){}
+void Cepheus :: Screen :: blit(Cepheus::Image *img){
+    blit( img->getSurface() , img->getX(), img->getY() );
+}
+void Cepheus :: Screen :: blit(SDL_Surface *img, int X, int Y){
+    SDL_Rect src, dst;
+    src.x = 0;
+    src.y = 0;
+    src.h = img->h;
+    src.w = img->w;
+    dst.x = X;
+    dst.y = Y;
+    dst.h = src.h;
+    dst.w = src.w;
+    
+    SDL_BlitSurface( 
+                  img, &src, _src, &dst 
+    );
+}
+void Cepheus :: Screen :: render(){
+    SDL_Flip( _src );
+}
 
-

src/Periferals/Keyboard.cpp

-/*******************************************************************************
-  Copyright (c) <2012> <Jose Alvaro Dominguez> <devlon_delander@gmx.es>              
-   
-  All rights reserved.
-
-  Redistribution and use in source and binary forms, with or without
-  modification, are permitted provided that the following conditions
-  are met:
-      
-     1. Redistributions of source code must retain the above copyright
-        notice, this list of conditions and the following disclaimer.
-     2. Redistributions in binary form must reproduce the above copyright
-        notice, this list of conditions and the following disclaimer in the
-        documentation and/or other materials provided with the distribution.
-     3. Neither the name of copyright holders nor the names of its
-        contributors may be used to endorse or promote products derived
-        from this software without specific prior written permission.
-
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
-  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-  POSSIBILITY OF SUCH DAMAGE.
-*******************************************************************************/
-
-

src/Periferals/Mouse.cpp

-/*******************************************************************************
-  Copyright (c) <2012> <Jose Alvaro Dominguez> <devlon_delander@gmx.es>              
-   
-  All rights reserved.
-
-  Redistribution and use in source and binary forms, with or without
-  modification, are permitted provided that the following conditions
-  are met:
-      
-     1. Redistributions of source code must retain the above copyright
-        notice, this list of conditions and the following disclaimer.
-     2. Redistributions in binary form must reproduce the above copyright
-        notice, this list of conditions and the following disclaimer in the
-        documentation and/or other materials provided with the distribution.
-     3. Neither the name of copyright holders nor the names of its
-        contributors may be used to endorse or promote products derived
-        from this software without specific prior written permission.
-
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
-  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-  POSSIBILITY OF SUCH DAMAGE.
-*******************************************************************************/
-

src/Scene/Component.cpp

  POSSIBILITY OF SUCH DAMAGE.
  *******************************************************************************/
 #include "../headers/Scene/Component.h"
-// #include "../Core/Input.h"
 Cepheus:: Component :: ~Component(){
-    int count = this->_components.size();
+    int count = _components.size();
     while(count>0){
-        delete this->_components.at(count);
+        delete _components[count];
         count--;
     }
-    this->_components.clear();
+    _components.clear();
 }
 void Cepheus:: Component :: addComponent(Cepheus::Component * component){
-    this->_components.push_back(component);
+    _components.push_back(component);
 }
-// Override this methods.
-void Cepheus:: Component :: leftClick(Mouse mouse){}
-void Cepheus:: Component :: rightClick(Mouse mouse){}
-void Cepheus:: Component :: keyPress(Cepheus::Key k){}
-void Cepheus:: Component :: update(Cepheus::Input *input){}
-

src/Scene/Panel.cpp

-/*******************************************************************************
- C opyright (c) <2012> <Jose Alvaro Dominguez> <devlon_delander@gm*x.es>              
- 
- All rights reserved.
- 
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of copyright holders nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
- 
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- *******************************************************************************/
-
-#include "../headers/Scene/Scene.h"
-// #include "../Core/Input.h"
-
-// Events delegates in Panels, and Panels in Components
-// >>Game -> Scene ->
-//                Panel -> Component: Run stuff coded
-void Cepheus::Panel :: leftClick(Mouse mouse){}
-void Cepheus::Panel :: rightClick(Mouse mouse){}
-void Cepheus::Panel :: keyPress(Cepheus::Key k){}
-void Cepheus::Panel :: update(Cepheus::Input *input){}
-
 #include "../headers/Core/Input.h"
 
 Cepheus::Panel * Cepheus :: Scene :: _searchPanel(Mouse mouse){
-    int count = this->_panels.size();
-    while( count > 0){
-        if( (this->_panels.at(count))->checkPanel(mouse) ){
-            return (this->_panels.at(count));
+    for(int i = _panels.size(); i>0;i--){
+        if( _panels[i]->checkPanel(mouse) ){
+            return ( _panels[i] );
         }
-        count--;
     }
     return NULL;
 }
-// Cepheus :: Panel * Cepheus :: Scene :: getPanel(){ return new Panel(); }
-// void Cepheus :: Scene :: leftClick(Mouse mouse){
-//     Panel *p = this->_searchPanel(mouse);
-//     p->leftClick(mouse);
-// }
-// void Cepheus :: Scene :: rightClick(Mouse mouse){
-//     Panel *p = this->_searchPanel(mouse);
-//     p->rightClick(mouse);
-// }
-// void Cepheus :: Scene :: keyPress(SDL_keysym key){}
-void Cepheus :: Scene :: update(Cepheus::Input *input){}
+Cepheus :: Panel * Cepheus :: Scene :: getPanel(int id){ return NULL; }
+void Cepheus :: Scene :: leftClick(Mouse mouse){
+    _searchPanel(mouse)->leftClick(mouse);
+}
+void Cepheus :: Scene :: rightClick(Mouse mouse){
+    _searchPanel(mouse)->rightClick(mouse);
+}
 

src/Scene/SceneManager.cpp

 *******************************************************************************/
 
 #include "../headers/Scene/SceneManager.h"
-void Cepheus :: SceneManager :: delScene(int id){}
+void Cepheus :: SceneManager :: delScene(int id){
+  delete _scenes[id];
+}
 void Cepheus :: SceneManager :: setCurrentScene(int id){
-    this->_currentId = id;
+    _currentId = id;
 }
 
 // Getters for some types of Scenes.
 Cepheus::Scene * Cepheus :: SceneManager :: getScene(int id){
-    return this->_scenes.at(id);
+    return _scenes[ id ];
+}
+std::vector<Cepheus::Scene *>* Cepheus :: SceneManager :: getScenes(){
+    return &_scenes;
 }
 Cepheus::Scene * Cepheus :: SceneManager :: getCurrentScene(){
-    return this->_scenes.at( this->_currentId );
+    return _scenes[ _currentId ];
+}
+void Cepheus :: SceneManager ::  addScene(Cepheus::Scene* scene){
+    _scenes.push_back(scene);
 }
 

src/headers/Controllers/Keyboard.h

-/*******************************************************************************
-  Copyright (c) <2012> <Jose Alvaro Dominguez> <devlon_delander@gmx.es>              
-   
-  All rights reserved.
-
-  Redistribution and use in source and binary forms, with or without
-  modification, are permitted provided that the following conditions
-  are met:
-      
-     1. Redistributions of source code must retain the above copyright
-        notice, this list of conditions and the following disclaimer.
-     2. Redistributions in binary form must reproduce the above copyright
-        notice, this list of conditions and the following disclaimer in the
-        documentation and/or other materials provided with the distribution.
-     3. Neither the name of copyright holders nor the names of its
-        contributors may be used to endorse or promote products derived
-        from this software without specific prior written permission.
-
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
-  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-  POSSIBILITY OF SUCH DAMAGE.
-*******************************************************************************/
-
-#ifndef  _KEYBOARD_H_
-#define  _KEYBOARD_H_
-    #include "../commons.h"
-    #include "Periferal.h"
-    class Keyboard : Periferal {
-        public:
-            Keyboard();
-            ~Keyboard();
-            void pool(SDL_Event *e);
-    };
-#endif
-

src/headers/Controllers/Mouse.h

-/*******************************************************************************
-  Copyright (c) <2012> <Jose Alvaro Dominguez> <devlon_delander@gmx.es>              
-   
-  All rights reserved.
-
-  Redistribution and use in source and binary forms, with or without
-  modification, are permitted provided that the following conditions
-  are met:
-      
-     1. Redistributions of source code must retain the above copyright
-        notice, this list of conditions and the following disclaimer.
-     2. Redistributions in binary form must reproduce the above copyright
-        notice, this list of conditions and the following disclaimer in the
-        documentation and/or other materials provided with the distribution.
-     3. Neither the name of copyright holders nor the names of its
-        contributors may be used to endorse or promote products derived
-        from this software without specific prior written permission.
-
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
-  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-  POSSIBILITY OF SUCH DAMAGE.
-*******************************************************************************/

src/headers/Controllers/Periferal.h

-/*******************************************************************************
-  Copyright (c) <2012> <Jose Alvaro Dominguez> <devlon_delander@gmx.es>              
-   
-  All rights reserved.
-
-  Redistribution and use in source and binary forms, with or without
-  modification, are permitted provided that the following conditions
-  are met:
-      
-     1. Redistributions of source code must retain the above copyright
-        notice, this list of conditions and the following disclaimer.
-     2. Redistributions in binary form must reproduce the above copyright
-        notice, this list of conditions and the following disclaimer in the
-        documentation and/or other materials provided with the distribution.
-     3. Neither the name of copyright holders nor the names of its
-        contributors may be used to endorse or promote products derived
-        from this software without specific prior written permission.
-
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
-  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-  POSSIBILITY OF SUCH DAMAGE.
-*******************************************************************************/
-
-#ifndef _PERIFERAL_H_
-#define _PERIFERAL_H_
-    #include "../commons.h"
-    class Periferal{
-         public:
-            void pool(SDL_Event *e); 
-    };
-#endif
-

src/headers/Core/Control.h

-/*******************************************************************************
-  Copyright (c) <2012> <Jose Alvaro Dominguez> <devlon_delander@gmx.es>              
-   
-  All rights reserved.
-
-  Redistribution and use in source and binary forms, with or without
-  modification, are permitted provided that the following conditions
-  are met:
-      
-     1. Redistributions of source code must retain the above copyright
-        notice, this list of conditions and the following disclaimer.
-     2. Redistributions in binary form must reproduce the above copyright
-        notice, this list of conditions and the following disclaimer in the
-        documentation and/or other materials provided with the distribution.
-     3. Neither the name of copyright holders nor the names of its
-        contributors may be used to endorse or promote products derived
-        from this software without specific prior written permission.
-
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
-  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-  POSSIBILITY OF SUCH DAMAGE.
-*******************************************************************************/
-#ifndef _CONTROL_H_
-    #define _CONTROL_H
-    #include "Periferal/Keyboard.h"
-    #include "Periferal/Mouse.h"
-    class Control 
-    {
-        private:
-            std::vector<Periferal> *devices;
-            
-        public:
-            void add_control(Periferal *device);
-            std::vector<Event> fetch();
-    };
-#endif
-

src/headers/Graphics/GraphicManager.h

     {
         class GraphicManager{
             private:
-                Screen *screen;
-                std::vector<Cepheus::Image> resources;
+                Screen *_screen;
+                std::vector<Cepheus::Image> _resources;
 
             public:
                 GraphicManager();
+                GraphicManager(Cepheus::GraphicManager &gm);
                 ~GraphicManager();
 
                 // Image Factory/Manipulation
                                         int width, int depth );
 
 
-                void setChroma(int red, int green, int blue);
+                void setChroma(Cepheus::Image *img,int red, int green, int blue);
 
                 // Get image from repository
                 Cepheus::Image* getImage( int image_id );
                 void unloadContents();
 
                 // Paint routines
-                void draw(Cepheus::Image *img);
+                void render(Cepheus::Image *img);
         };
     }
 #endif

src/headers/Graphics/Image.h

 #ifndef _CEPHEUS_IMAGE_H_
     #define _CEPHEUS_IMAGE_H_
     #include "../commons.h"
+    #include "../Core/Entity.h"
     namespace Cepheus
     {
-        class Image{
+        class Image : public Cepheus::Entity{
             private:
                 SDL_Surface *_src;
 
             public:
                 Image();
+                Image(const char *path);
                 Image(SDL_Surface *img);
                 // Depth: {4,8,16,32}
                 Image(int width, int height, int depth);
 
                 ~Image();
+
+                // Chroma configuration.
                 void setChroma(int red, int green, int blue);
+
+                // surface getters.
                 SDL_Surface* getSurface();
                 SDL_Surface* getSurface(int X, int Y, int H, int W);
                 
+                // Properties Manipulation.
 //                void rotateImage(int degrees);
 //                void zoomImage(int zoom);
         };

src/headers/Graphics/Screen.h

     {
         class Screen{
             private:
-                unsigned int        flags;
-                SDL_Surface         *src;
-                int                 height;
-                int                 width;
-                int                 depth;
+                unsigned int        _flags;
+                SDL_Surface         * _src;
+                int                 _height;
+                int                 _width;
+                int                 _depth;
+                
             public:
                 // Flags:       
                 //  SDL_SWSURFACE | SDL_SRCALPHA | SDL_RESIZABLE | SDL_DOUBLEBUF
                 void init();
                 void clear();
                 void render();
-                void draw(Cepheus::Image *img);
+                void blit(Cepheus::Image *img);
+                void blit(SDL_Surface *img, int X, int Y);
                 void setTitle(const char *title);
                 void setBounds(int width, int height);
         };

src/headers/Scene/Component.h

 #define _CEPHEUS_COMPONENT_H_
     #include "../Graphics/GraphicManager.h"
     #include "../Core/Input.h"
+    #include "../Core/Entity.h"
 
     namespace Cepheus
     {
-        class Component{
+        class Component : public Cepheus::Entity {
             protected:
                 std::vector<Cepheus::Component *> _components;
                 Cepheus::Component *currentComponent;
                 
             public:
                 Component(){}
+                Component(int X, int Y, int W, int H):
+                                            Entity(X, Y, W, H){}
+
                 Component(std::vector<Component *> items){}
-                ~Component();
-            
+                virtual ~Component();
+
+                Cepheus::Component* getComponent(int id);
+                void addComponent(Cepheus::Component * component);
             
                 // Override this methods.
-                virtual void leftClick(Mouse mouse);
-                virtual void rightClick(Mouse mouse);
-                virtual void keyPress(Cepheus::Key k);
-                virtual void update(Cepheus::Input *input);
-                Cepheus::Component* getComponent(int id);
-                                    
-                virtual void addComponent(Cepheus::Component * component);
-                virtual void render(Cepheus::GraphicManager * gm){}
+                virtual void leftClick(Mouse mouse) = 0;
+                virtual void rightClick(Mouse mouse) = 0;
+                virtual void keyPress(Cepheus::Key k) = 0;
+                virtual void update(Cepheus::Input *input) = 0;                    
+                virtual void render(Cepheus::GraphicManager * gm) = 0;
             };
     }
 #endif

src/headers/Scene/Panel.h

     {
         class Panel: public Cepheus::Component{                
 
-
             public:
                 Panel(){}
-                ~Panel(){}
+                Panel( int X, int Y, int W, int H): Component(X,Y,W,H){}
+                virtual ~Panel(){}
 
                 // Events delegates in Panels, and Panels in Components
-                // >>Game -> Scene ->
-                //                Panel -> Component: Run stuff coded
+
                 // Override this methods.
-                virtual void leftClick(Mouse mouse);
-                virtual void rightClick(Mouse mouse);
-                virtual void keyPress(Cepheus::Key k);
+                virtual void leftClick(Mouse mouse) = 0;
+                virtual void rightClick(Mouse mouse) = 0;
+                virtual void keyPress(Cepheus::Key k) = 0;
                 virtual bool checkPanel(Mouse mouse){ return false; }
-                virtual void update(Cepheus::Input *input);
+                virtual void update(Cepheus::Input *input) = 0;
                 
                 // Override this.
-                virtual void render(GraphicManager * gm){}
+                virtual void render(GraphicManager * gm) = 0;
         };
     }
 #endif

src/headers/Scene/Scene.h

         class Scene{
             protected:
                 std::vector<Cepheus::Panel *> _panels;
+                
+                // Protected methods
+                Cepheus::Panel * _searchPanel(Mouse mouse);
+
             public:
-                Scene();
-                virtual ~Scene();
+                Scene(){}
+                virtual ~Scene(){}
                 
                 void addPanel(Cepheus::Panel * panel);
                 void delPanel(int id);
-                Cepheus::Panel * _searchPanel(Mouse mouse);
-                Cepheus::Panel* getPanel(int id);
 
-                // Events delegates in Panels, and Panels in Components
-                // >>      Game -> Scene -> 
-                //                Panel -> Component: Run stuff coded
-//                 virtual void leftClick(Mouse mouse);
-//                 virtual void rightClick(Mouse mouse);
-//                 virtual void keyPress(SDL_keysym key);
-                virtual void update(Cepheus::Input *input);
-                // Override this.
-                virtual void render(Cepheus::GraphicManager * gm){
-                    int count;
-                    for(count = 0; count < this->_panels.size(); count++ ){
-                        (this->_panels.at(count))->render(gm);
-                    }
-                }
+                Cepheus::Panel * getPanel(int id);
+
+                // Events delegated in Panels, and Panels in Components
+
+                // Override this methods.
+                virtual void leftClick(Mouse mouse);
+                virtual void rightClick(Mouse mouse);
+                virtual void keyPress(SDL_keysym key) = 0;
+                virtual void update(Cepheus::Input *input) = 0;
+                virtual void render(Cepheus::GraphicManager * gm) = 0;
         };
     }
 #endif

src/headers/Scene/SceneManager.h

                 virtual ~SceneManager(){}
 
                 // Scenes Management
-                void addScene(Scene* scene);
+                void addScene(Cepheus::Scene* scene);
                 void delScene(int id);
                 void setCurrentScene(int id);
                 
                 // Getters for some types of Scenes.
                 Cepheus::Scene * getScene(int id);
                 Cepheus::Scene * getCurrentScene();
+                std::vector<Cepheus::Scene *> * getScenes();
                 
                 virtual void render(Cepheus::GraphicManager * gm){}
         };
+#include <iostream>
+#include "../headers/Core/Game.h"
+#include "../headers/Scene/Panel.h"
+#include "../headers/Graphics/GraphicManager.h"
+
+class Test2 : public Cepheus::Game{
+    private:
+        Cepheus::Image *_img;
+
+    public:
+        Test2(){
+            init();
+
+        }
+        
+        Test2(int fps):Game(fps){ 
+            init(); 
+            _img = new Cepheus::Image("assets/1.bmp");
+
+            if ( _img->getSurface() != NULL){
+                _img->setX(20);
+                _img->setY(20);
+            }
+        }
+        
+        ~Test2(){
+            delete _img;
+            destroy();
+        }
+        // Override update method.
+        void update(){
+            // Get ESC key and SDL_QUIT Event state.
+            if( 
+                getInput()->isPressed(SDLK_ESCAPE) || closed() 
+            ){
+               this->exit();
+            }
+            // Do all logic stuff here.
+        }
+        // Override render method.
+        void render(Cepheus::GraphicManager *gm){
+            // Clear screen for new rendering.
+            gm->getScreen()->clear();
+
+            // Do all rendering stuff here.
+            gm->getScreen()->blit( _img );
+            gm->getScreen()->render();
+        }
+};
+
+int main(int argc, char** argv){
+    // Create new game
+    Test2 *game = new Test2(50);
+
+    // Get graphic manager for interface tasks
+    Cepheus::GraphicManager *gmanager;
+    gmanager = game->getGraphicManager();
+    
+    // Create a Window Screen.    
+    gmanager->setScreen(
+        new Cepheus::Screen(
+                800, 600, 32,  
+                SDL_HWSURFACE | SDL_SRCALPHA | SDL_RESIZABLE | SDL_DOUBLEBUF
+        )        
+    );
+    
+    // Initialize Screen.
+    gmanager->getScreen()->init();
+    gmanager->getScreen()->setTitle("Test 2");
+    
+    // Let's Go
+    game->run();
+
+    delete game;
+    return 0;
+}
+
+#include <iostream>
+#include "../headers/Core/Game.h"
+
+class Scene1 : public Cepheus::Scene{
+    public:
+        Scene1(){}
+        
+        ~Scene1(){}
+        void keyPress(SDL_keysym key){}
+
+        void update(Cepheus::Input *input){
+            std::cout << ">> Updating Scene" << std::endl;
+        }
+
+        void render(Cepheus::GraphicManager *gm){
+            std::cout << "\t:: Rendering Scene" << std::endl;
+        }    
+};
+class Scene2 : public Cepheus::Scene{
+    public:
+        Scene2(){}
+        
+        ~Scene2(){}
+        void keyPress(SDL_keysym key){}
+
+        void update(Cepheus::Input *input){
+            std::cout << ">> Updating Scene 2" << std::endl;
+        }
+
+        void render(Cepheus::GraphicManager *gm){
+            std::cout << "\t:: Rendering Scene 2" << std::endl;
+        }    
+};
+class Test3 : public Cepheus::Game{
+    private:
+        Cepheus::Image *_img;
+
+    public:
+        Test3(){
+            init();
+        }
+        
+        Test3(int fps):Game(fps){ 
+            init(); 
+        }
+        
+        ~Test3(){
+            destroy();
+        }
+
+        // Override update method.
+        void update(){
+
+            // Get ESC key and SDL_QUIT Event state.
+            if( 
+                getInput()->isPressed(SDLK_ESCAPE) || closed() 
+            ){
+               this->exit();
+            }
+
+            // Do all logic stuff here.
+            // getSceneManager()->getCurrentScene()->update( getInput() );
+            for(int i = 0 ; i < getSceneManager()->getScenes()->size(); i++ ){
+                getSceneManager()->getScene(i)->update( getInput() );
+            }
+        }
+
+        // Override render method.
+        void render(Cepheus::GraphicManager *gm){
+
+            // Clear screen for new rendering.
+            gm->getScreen()->clear();
+
+            // Do all rendering stuff here.
+            // getSceneManager()->getScenes->render(gm);
+            for(int i = 0 ; i < getSceneManager()->getScenes()->size(); i++ ){
+                getSceneManager()->getScene(i)->render(gm);
+            }
+
+            // Render back graphic buffer.
+            gm->getScreen()->render();
+        }
+};
+
+int main(int argc, char** argv){
+
+    // Create new game
+    Test3 *game = new Test3(50);
+
+    // Get graphic manager for interface tasks
+    
+    // Create a Window Screen.    
+    game->getGraphicManager()->setScreen(
+                    new Cepheus::Screen(
+                            800, 600, 32,  
+                            SDL_HWSURFACE | SDL_SRCALPHA | SDL_RESIZABLE | SDL_DOUBLEBUF
+                    )        
+    );
+    
+    // Initialize Screen.
+    game->getGraphicManager()->getScreen()->init();
+    game->getGraphicManager()->getScreen()->setTitle("Test 3");
+
+    // Initialize starting Scene
+    game->getSceneManager()->addScene( new Scene1() );
+    game->getSceneManager()->addScene( new Scene2() );
+    game->getSceneManager()->setCurrentScene(0);
+    
+    // Let's Go
+    game->run();
+
+    delete game;
+    return 0;
+}
+