45 lines
1023 B
C++
Executable File
45 lines
1023 B
C++
Executable File
#include <cstdlib>
|
|
#include <time.h>
|
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
#include "engine.h"
|
|
|
|
class Game : public engine {
|
|
protected:
|
|
|
|
virtual bool OnUserCreate() {
|
|
srand(time(0));
|
|
return true;
|
|
}
|
|
|
|
virtual bool OnUserUpdate(Uint32 elapsedTime) {
|
|
while (SDL_PollEvent(&event)) {
|
|
if (event.type == SDL_QUIT) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
SDL_RenderClear(renderer);
|
|
SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE);
|
|
|
|
SDL_Color color = {0, 64, 88};
|
|
Write("HOLA", SCREEN_WIDTH/2, FONT_HEIGHT * 0, color, 2);
|
|
WriteCentered("HOLA", SCREEN_WIDTH/2, FONT_HEIGHT * 1, color, 2);
|
|
WriteAlignRight("HOLA", SCREEN_WIDTH/2, FONT_HEIGHT * 2, color, 2);
|
|
|
|
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
|
SDL_RenderPresent(renderer);
|
|
|
|
return true;
|
|
}
|
|
|
|
};
|
|
|
|
int main(int argc, char* args[]){
|
|
Game game;
|
|
game.Init("Game", 640, 480);
|
|
game.Run();
|
|
return 0;
|
|
}
|