Restore console, server/client stuff.
This commit is contained in:
12
src/display/CMakeLists.txt
Normal file
12
src/display/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
# 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
|
||||
)
|
||||
|
||||
# Subdirs
|
36
src/display/render.c
Normal file
36
src/display/render.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "render.h"
|
||||
#include "game/game.h"
|
||||
#include "assert/assert.h"
|
||||
#include "console/console.h"
|
||||
|
||||
void renderInit() {
|
||||
// Initialize the rendering system
|
||||
InitWindow(800, 600, "Dusk");
|
||||
}
|
||||
|
||||
renderresult_t renderDraw() {
|
||||
BeginDrawing();
|
||||
ClearBackground(BLACK);
|
||||
|
||||
for(uint32_t i = 0; i < GAME.entityCount; i++) {
|
||||
entityRender(&GAME.entities[i]);
|
||||
}
|
||||
|
||||
consoleDraw();
|
||||
|
||||
EndDrawing();
|
||||
if(WindowShouldClose()) return RENDER_EXIT;
|
||||
return RENDER_OK;
|
||||
}
|
||||
|
||||
|
||||
void renderDispose() {
|
||||
CloseWindow();
|
||||
}
|
38
src/display/render.h
Normal file
38
src/display/render.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "dusk.h"
|
||||
|
||||
#define RENDER_FONT_SIZE 20
|
||||
|
||||
typedef enum {
|
||||
RENDER_OK,
|
||||
RENDER_EXIT,
|
||||
RENDER_ERROR
|
||||
} renderresult_t;
|
||||
|
||||
/**
|
||||
* Initializes the rendering system.
|
||||
*
|
||||
* @return The result of the initialization.
|
||||
*/
|
||||
void renderInit();
|
||||
|
||||
/**
|
||||
* Initializes the rendering system.
|
||||
*
|
||||
* @return The result of the initialization.
|
||||
*/
|
||||
renderresult_t renderDraw();
|
||||
|
||||
/**
|
||||
* Renders the game.
|
||||
*
|
||||
* @return The result of the render operation.
|
||||
*/
|
||||
void renderDispose();
|
Reference in New Issue
Block a user