Render test

This commit is contained in:
2025-06-10 17:09:33 -05:00
parent a2fd58fda7
commit 1b6db0c643
47 changed files with 219 additions and 370 deletions

View File

@ -0,0 +1,10 @@
# Copyright (c) 2025 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# Sources
target_sources(${DUSK_TARGET_NAME}
PRIVATE
render.c
)

View File

@ -0,0 +1,53 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "assert/assert.h"
#include "display/render.h"
#include "raylib.h"
#include "rpg/entity/entity.h"
const uint16_t RENDER_WIDTH = 800;
const uint16_t RENDER_HEIGHT = 600;
void renderInit() {
InitWindow(RENDER_WIDTH, RENDER_HEIGHT, "Dusk");
SetTargetFPS(60);
}
bool_t renderUpdate() {
// End rendering?
if(WindowShouldClose()) return false;
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Hello, Dusk!", 10, 10, 20, BLACK);
entity_t *ent = ENTITIES;
do {
if(ent->type == ENTITY_TYPE_NULL) {
ent++;
continue;
}
DrawRectangle(
(ent->x * ENTITY_WIDTH) + ent->subX,
(ent->y * ENTITY_HEIGHT) + ent->subY,
ENTITY_WIDTH,
ENTITY_HEIGHT,
RED
);
ent++;
} while(ent < (ENTITIES + ENTITY_COUNT));
EndDrawing();
return true;
}
void renderDispose() {
CloseWindow();
}