- [FIX] debugger inicialitzat al començar - [WIP] Noves classes de UI
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
#pragma once
|
|
#include <SDL3/SDL.h>
|
|
#include <stack>
|
|
|
|
namespace ui
|
|
{
|
|
class Context {
|
|
public:
|
|
Context(SDL_Window *window);
|
|
~Context();
|
|
|
|
SDL_Texture * CreateTexture(int width, int height);
|
|
SDL_Texture * LoadTexture(const char* filename);
|
|
|
|
void SetOffset(int x, int y);
|
|
void IncOffset(int x, int y);
|
|
int GetOffsetX();
|
|
int GetOffsetY();
|
|
void PushOffset();
|
|
void PopOffset();
|
|
void ClearOffsetStack();
|
|
|
|
bool IsMouseInside(int x, int y, int w, int h);
|
|
|
|
void DrawRect(int x, int y, int w, int h, uint32_t color);
|
|
void FillRect(int x, int y, int w, int h, uint32_t color);
|
|
void DrawLine(int x1, int y1, int x2, int y2, uint32_t color);
|
|
void DrawChar(int x, int y, char chr, uint32_t color=0xffffffff);
|
|
void DrawText(int x, int y, const char *text, uint32_t color);
|
|
|
|
protected:
|
|
SDL_Window *win;
|
|
SDL_Renderer *ren;
|
|
SDL_Texture *fontTex;
|
|
|
|
int offsetX, offsetY;
|
|
std::stack<std::pair<int, int>> offsetStack;
|
|
};
|
|
}
|