Quote:
#ifndef _BASEGAME_
#define _BASEGAME_
#include "SDL.h"
#include "keyBoard.h"
#include <string>
using std::string;
class BaseGame{
public:
static int key[nKeys];
BaseGame(string title, int screenWidth, int screenHeight);
virtual ~BaseGame();
void start();
protected:
bool quitGame;
const int screenWidth;
const int screenHeight;
string title;
SDL_Surface* screen;
private:
void HandleEvent(const SDL_Event& event);
void init();
virtual void render() = 0;
virtual void logicLoop() = 0;
virtual void eventsTreat() = 0;
BaseGame(const BaseGame&);
BaseGame& operator=(const BaseGame&);
};
#endif
Quote:
#ifndef _GAME_
#define _GAME_
#include "BaseGame.h"
class Level;
class LevelManager;
class Border;
class DrawBall;
class DrawBandeja;
class Points;
class Game: public BaseGame{
public:
Game();
virtual ~Game();
private:
virtual void logicLoop();
virtual void render();
virtual void eventsTreat();
virtual void setReferencesUp();
LevelManager* levelManeger;
Level* currentLevel;
DrawBall* ball;
DrawBandeja* bandeja;
Points* points;
Border* border;
private:
Game(const Game&);
Game& operator=(const Game&);
};
#endif
well, in Game class, if it is exactly 48 bytes then it appears a window and then exits with no error, but without do what i want. Otherwise, if it's not then it works like i want.
Quote:
CC = g++
CFLAGS = -Wall `sdl-config --cflags --libs`
PROG = Game
PRE = rm -f $(PROG)
#-------------------------------------------------------------------------------
#BLOCK
PATH_BLOCK = Block/
IBLOCK = -I./$(PATH_BLOCK)
BLOCK = $(wildcard $(PATH_BLOCK)*.cpp)
#COMMONBLOCK
PATH_COMMON_BLOCK = $(PATH_BLOCK)CommonBlock/
ICOMMON_BLOCK = -I./$(PATH_COMMON_BLOCK)
COMMON_BLOCK = $(wildcard $(PATH_COMMON_BLOCK)*.cpp)
#ITEMBLOCK
PATH_ITEM_BLOCK = $(PATH_BLOCK)ItemBlock/
IITEM_BLOCK = -I./$(PATH_ITEM_BLOCK)
ITEM_BLOCK = $(wildcard $(PATH_ITEM_BLOCK)*.cpp)
#TODOS BLOCKS
BLOCKS = $(BLOCK) $(COMMON_BLOCK) $(ITEM_BLOCK)
IBLOCKS = $(IBLOCK) $(ICOMMON_BLOCK) $(IITEM_BLOCK)
#-------------------------------------------------------------------------------
#BALL
PATH_BALL = Ball/
IBALL = -I./$(PATH_BALL)
BALL = $(wildcard $(PATH_BALL)*.cpp)
#-------------------------------------------------------------------------------
#ITEM
PATH_ITEM = Item/
IITEM = -I./$(PATH_ITEM)
ITEM = $(wildcard $(PATH_ITEM)*.cpp)
#-------------------------------------------------------------------------------
#BANDEJA
PATH_BANDEJA = Bandeja/
IBANDEJA = -I./$(PATH_BANDEJA)
BANDEJA = $(wildcard $(PATH_BANDEJA)*.cpp)
#-------------------------------------------------------------------------------
#LEVELS E MAPAS
PATH_LEVEL = Levels/
ILEVEL = -I./$(PATH_LEVEL)
LEVEL = $(wildcard $(PATH_LEVEL)*.cpp)
PATH_MAPS = $(PATH_LEVEL)Maps/
IMAPS = -I./$(PATH_MAPS)
MAPS = $(wildcard $(PATH_MAPS)*.cpp)
#-------------------------------------------------------------------------------
#Todos sources
SRCS = $(wildcard *.cpp) $(BLOCKS) $(BALL) $(ITEM) $(BANDEJA) $(LEVEL) $(MAPS)
INCLUDE = -I. $(IBLOCKS) $(IBALL) $(IITEM) $(IBANDEJA) $(ILEVEL) $(IMAPS)
#-------------------------------------------------------------------------------
#REGRAS
all: $(PROG)
$(PROG): $(SRCS)
$(PRE) && $(CC) $(INCLUDE) $(CFLAGS) -o $(PROG) $(SRCS)
clean:
rm -f $(PROG)