69 lines
1.8 KiB
Plaintext
69 lines
1.8 KiB
Plaintext
#include <raylib.h>
|
|
#include <slibs/slibs.h>
|
|
|
|
typedef struct {
|
|
Vector2 pos;
|
|
Vector2 size;
|
|
} window_state;
|
|
|
|
sl_vec(const char*) window_titles = { 0 };
|
|
sl_vec(window_state) window_states = { 0 };
|
|
|
|
int current_window = -1;
|
|
|
|
void BeginWindow(const char* title) {
|
|
for(int i = 0; i < window_titles.size; i++) {
|
|
if(window_titles.data[i] == title) {
|
|
current_window = i;
|
|
window_state* w = &window_states.data[current_window];
|
|
|
|
DrawRectangleV(w->pos, w->size, BLUE);
|
|
|
|
w->size = (Vector2) { 0.0f, 0.0f };
|
|
|
|
return;
|
|
}
|
|
}
|
|
|
|
window_state new_state = {
|
|
.pos = { 50.0f, 50.0f },
|
|
.size = { 0.0f, 0.0f }
|
|
};
|
|
|
|
sl_vec_push(window_titles, title);
|
|
sl_vec_push(window_states, new_state);
|
|
current_window = window_titles.size - 1;
|
|
}
|
|
|
|
void Text(const char* text) {
|
|
window_state* w = &window_states.data[current_window];
|
|
DrawText(text, w->pos.x, w->pos.y + w->size.y, 20, WHITE);
|
|
w->size.x += MeasureText(text, 20);
|
|
w->size.y += 20;
|
|
}
|
|
|
|
void EndWindow() {
|
|
window_state w = window_states.data[current_window];
|
|
}
|
|
|
|
int main() {
|
|
InitWindow(800, 600, "gear");
|
|
|
|
while(!WindowShouldClose()) {
|
|
BeginDrawing();
|
|
{
|
|
ClearBackground(BLACK);
|
|
|
|
BeginWindow("hi");
|
|
{
|
|
Text("balls");
|
|
Text("peter what are you doing");
|
|
}
|
|
EndWindow();
|
|
}
|
|
EndDrawing();
|
|
}
|
|
|
|
CloseWindow();
|
|
}
|