- [NEW] Pasada la textura de font a png
- [FIX] debugger inicialitzat al començar - [WIP] Noves classes de UI
This commit is contained in:
1 parent
1dddc11722
commit
6c205fb014
7 files changed
+255
-1
No files matched your search
@@ -0,0 +1,39 @@
|
||||
#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;
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user