Files
proyectos-en-sdl2/palette/engine.hpp
Daniel Cortes 242e60ff40 Initial commit
2020-05-22 01:54:52 -04:00

43 lines
1.1 KiB
C++
Executable File

#ifndef _ENGINE_H
#define _ENGINE_H
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <iostream>
#include <string>
#include <unistd.h>
#include <limits.h>
class engine {
public:
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Texture *font;
SDL_Event event;
int SCREEN_WIDTH;
int SCREEN_HEIGHT;
int FONT_WIDTH;
int FONT_HEIGHT;
public:
engine();
~engine();
bool Init(std::string name, int width, int height);
void Run();
void Write(std::string text, int x, int y, SDL_Color color = SDL_Color{0xff, 0xff, 0xff, 0xff}, int scale = 1);
void WriteCentered(std::string text, int x, int y, SDL_Color color = SDL_Color{0xff, 0xff, 0xff, 0xff}, int scale = 1);
void WriteAlignRight(std::string text, int x, int y, SDL_Color color = SDL_Color{0xff, 0xff, 0xff, 0xff}, int scale = 1);
protected:
virtual bool OnUserCreate() = 0;
virtual bool OnUserUpdate(Uint32 elapsedTime) = 0;
private:
std::string getExecutablePath();
std::string getPath(std::string path);
bool LoadFontTexture();
};
#endif