#ifndef ENGINE_H
#define ENGINE_H
#include <SDL/SDL.h> //SDL library
#include <SDL/SDL_image.h> //+SDL_image library (I use it for loading .png files)
class Engine
{
public:
SDL_Surface* screen; //The screen
SDL_Surface* tileset; //A simple tileset for testing purposes only
int ScreenX;//Width of the screen
int ScreenY;//Height of the screen
int bpp;//Bit Per Pixel (colour depth)
int MouseX; //Mouse x position
int MouseY; //Mouse y position
Uint8 MouseButtons; //Mouse button pressed
int Frames; //Actual frame
int FPS; //Frames per second
int StartTick;
int LastTick;
Uint8 TileSize; //size of the default tile
Engine(); //creator
virtual ~Engine(); //destructor
void SetVga(); //Set the video mode
void FillColour(Uint8 r,Uint8 g,Uint8 b); //fill screen with a colour
void Flip(); //Flips the backbuffer to the primary buffer
void LoadTileset(); //loads a test tileset
void UpdateMouse(); //refresh mouse position and buttons pressed
void BlitTileset(int x,int y, int tile); // Blit a tile from our tileset to the screen
void Wait(Uint32 ms); //waits ms miliseconds
int TimeElapsed(); //Get the time passed since last time control
void UpdateTimer(); //Update the start time control
protected:
private:
};
#endif // ENGINE_HWednesday, December 29, 2010
Code::Blocks(3) C++ SDL and Life "engine.h"
Here is the code for the engine class header, just copy and paste into file engine.h in the project, then save the project:
Labels:
Code::Blocks,
Life Game
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment