add quit command
This commit is contained in:
@@ -16,6 +16,7 @@ target_sources(${DUSK_TARGET_NAME}
|
||||
add_subdirectory(camera)
|
||||
add_subdirectory(framebuffer)
|
||||
add_subdirectory(mesh)
|
||||
add_subdirectory(overworld)
|
||||
add_subdirectory(texture)
|
||||
add_subdirectory(spritebatch)
|
||||
add_subdirectory(scene)
|
10
src/dusksdl2/display/overworld/CMakeLists.txt
Normal file
10
src/dusksdl2/display/overworld/CMakeLists.txt
Normal 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
|
||||
renderoverworld.c
|
||||
)
|
16
src/dusksdl2/display/overworld/renderoverworld.c
Normal file
16
src/dusksdl2/display/overworld/renderoverworld.c
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "renderoverworld.h"
|
||||
|
||||
void renderOverworldInit(void) {
|
||||
// Initialize overworld rendering resources here
|
||||
}
|
||||
|
||||
void renderOverworldDispose(void) {
|
||||
// Clean up overworld rendering resources here
|
||||
}
|
34
src/dusksdl2/display/overworld/renderoverworld.h
Normal file
34
src/dusksdl2/display/overworld/renderoverworld.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "world/chunk.h"
|
||||
#include "display/mesh/mesh.h"
|
||||
|
||||
typedef struct {
|
||||
mesh_t meshBase;
|
||||
meshvertex_t verticesBase[CHUNK_TILE_COUNT];
|
||||
|
||||
mesh_t meshBaseOverlay;
|
||||
meshvertex_t verticesBaseOverlay[CHUNK_TILE_COUNT];
|
||||
} renderchunk_t;
|
||||
|
||||
typedef struct {
|
||||
renderchunk_t chunks[CHUNK_MAP_COUNT];
|
||||
} renderoverworld_t;
|
||||
|
||||
extern renderoverworld_t RENDER_OVERWORLD;
|
||||
|
||||
/**
|
||||
* Initializes the render overworld.
|
||||
*/
|
||||
void renderOverworldInit(void);
|
||||
|
||||
/**
|
||||
* Disposes of the render overworld.
|
||||
*/
|
||||
void renderOverworldDispose(void);
|
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "renderscene.h"
|
||||
#include "display/overworld/renderoverworld.h"
|
||||
|
||||
renderscenecallback_t RENDER_SCENE_CALLBACKS[SCENE_COUNT] = {
|
||||
[SCENE_INITIAL] = {
|
||||
@@ -15,9 +16,9 @@ renderscenecallback_t RENDER_SCENE_CALLBACKS[SCENE_COUNT] = {
|
||||
},
|
||||
|
||||
[SCENE_OVERWORLD] = {
|
||||
.init = NULL,
|
||||
.init = renderOverworldInit,
|
||||
.draw = NULL,
|
||||
.dispose = NULL
|
||||
.dispose = renderOverworldDispose
|
||||
},
|
||||
};
|
||||
|
||||
|
@@ -49,6 +49,7 @@
|
||||
{ SDL_SCANCODE_SPACE, INPUT_BIND_ACTION },
|
||||
{ SDL_SCANCODE_ESCAPE, INPUT_BIND_CANCEL },
|
||||
{ SDL_SCANCODE_GRAVE, INPUT_BIND_CONSOLE },
|
||||
{ SDL_SCANCODE_Q, INPUT_BIND_QUIT },
|
||||
{ 0, 0 }
|
||||
};
|
||||
#endif
|
@@ -26,12 +26,8 @@ int main(int argc, char *argv[]) {
|
||||
gameUpdate();
|
||||
mainError(renderDraw());
|
||||
|
||||
if(inputPressed(INPUT_BIND_UP)) consolePrint("Up pressed");
|
||||
if(inputPressed(INPUT_BIND_DOWN)) consolePrint("Down pressed");
|
||||
if(inputPressed(INPUT_BIND_LEFT)) consolePrint("Left pressed");
|
||||
if(inputPressed(INPUT_BIND_RIGHT)) consolePrint("Right pressed");
|
||||
if(inputPressed(INPUT_BIND_ACTION)) consolePrint("Action pressed");
|
||||
if(inputPressed(INPUT_BIND_CANCEL)) consolePrint("Cancel pressed");
|
||||
if(inputPressed(INPUT_BIND_QUIT)) consoleExec("quit");
|
||||
if(!GAME.running) break;
|
||||
}
|
||||
|
||||
gameDispose();
|
||||
|
Reference in New Issue
Block a user