Cleaned some code, drastically reduced memory footprint.

This commit is contained in:
2021-09-05 15:02:02 -07:00
parent cb447a6033
commit 2285568480
19 changed files with 263 additions and 108 deletions

View File

@ -18,6 +18,7 @@
#include "display/matrix.h"
#include "display/primitive.h"
#include "display/render.h"
#include "display/renderlist.h"
#include "display/scene.h"
#include "display/shader.h"
#include "display/spritebatch.h"

View File

@ -0,0 +1,31 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "../libs.h"
#include "../util/dynarray.h"
#include "../game/game.h"
#include "framebuffer.h"
#include "shader.h"
typedef struct _renderpass_t renderpass_t;
typedef struct _renderlist_t renderlist_t;
typedef void renderitem_t(
renderlist_t *list, renderpass_t *pass, game_t *game, int32_t i
);
typedef struct _renderpass_t {
framebuffer_t framebuffer;
shader_t *shader;
} renderpass_t;
typedef struct _renderlist_t {
int32_t width;
int32_t height;
dynarray_t passes;
} renderlist_t;

View File

@ -11,6 +11,8 @@
#include "poker/pokergame.h"
#elif SETTING_GAME == SETTING_GAME_DAWN
#include "dawn/dawngame.h"
#elif SETTING_GAME == SETTING_GAME_SANDBOX
#include "sandbox/sandboxscene.h"
#endif
/** Describes the current game */
@ -22,5 +24,7 @@ typedef struct {
pokergame_t pokerGame;
#elif SETTING_GAME == SETTING_GAME_DAWN
dawngame_t dawnGame;
#elif SETTING_GAME == SETTING_GAME_SANDBOX
sandboxscene_t sandboxScene;
#endif
} game_t;

View File

@ -0,0 +1,17 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "../../libs.h"
#include "../../display/camera.h"
#include "../../display/shader.h"
#include "../../display/font.h"
#include "../../display/primitive.h"
typedef struct {
camera_t camera;
} sandboxscene_t;

View File

@ -9,29 +9,20 @@
/** Debug Inputs */
#define INPUT_NULL (inputbind_t)0x00
#define INPUT_DEBUG_UP (inputbind_t)0x01
#define INPUT_DEBUG_DOWN (inputbind_t)0x02
#define INPUT_DEBUG_LEFT (inputbind_t)0x03
#define INPUT_DEBUG_RIGHT (inputbind_t)0x04
#define INPUT_DEBUG_RAISE (inputbind_t)0x05
#define INPUT_DEBUG_LOWER (inputbind_t)0x06
#define INPUT_DEBUG_FINE (inputbind_t)0x07
#define INPUT_DEBUG_PLUS (inputbind_t)0x08
#define INPUT_DEBUG_MINUS (inputbind_t)0x09
/** Real Inputs (Starts at 64/0x40) */
#define INPUT_UP (inputbind_t)0x40
#define INPUT_DOWN (inputbind_t)0x41
#define INPUT_LEFT (inputbind_t)0x42
#define INPUT_RIGHT (inputbind_t)0x43
#define INPUT_ACCEPT (inputbind_t)0x44
/** Real Inputs (Starts at 32/0x20) */
#define INPUT_UP (inputbind_t)0x20
#define INPUT_DOWN (inputbind_t)0x21
#define INPUT_LEFT (inputbind_t)0x22
#define INPUT_RIGHT (inputbind_t)0x23
#define INPUT_ACCEPT (inputbind_t)0x24
/** Additional sources */
#define INPUT_MOUSE_X (inputsource_t)0x20
#define INPUT_MOUSE_Y (inputsource_t)0x21
#define INPUT_MOUSE_X (inputsource_t)0x10
#define INPUT_MOUSE_Y (inputsource_t)0x11
#define INPUT_BIND_COUNT 0xFF
#define INPUT_SOURCE_COUNT 0xFFFF
#define INPUT_BIND_COUNT 0x40
#define INPUT_SOURCE_COUNT 0xFF
/**
* Input Bind, a specific action bind reference for the game engine to use.
@ -44,7 +35,7 @@ typedef uint8_t inputbind_t;
* hell this number refers to. For most platforms it will be an input, such as a
* keyboard scancode or a (pad number * button count) + button.
*/
typedef uint16_t inputsource_t;
typedef uint8_t inputsource_t;
/**
* Value that represents the state of an input. Defined as 0-1 where 0 is set