Added a dynamic array.
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
#include "display/matrix.h"
|
||||
#include "display/primitive.h"
|
||||
#include "display/render.h"
|
||||
#include "display/scene.h"
|
||||
#include "display/shader.h"
|
||||
#include "display/spritebatch.h"
|
||||
#include "display/texture.h"
|
||||
@ -75,6 +76,7 @@
|
||||
|
||||
// Utility Objects
|
||||
#include "util/array.h"
|
||||
#include "util/dynarray.h"
|
||||
#include "util/flags.h"
|
||||
#include "util/list.h"
|
||||
#include "util/math.h"
|
||||
|
46
include/dawn/display/scene.h
Normal file
46
include/dawn/display/scene.h
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
#include "../engine/engine.h"
|
||||
|
||||
/** Maximum number of items a scene can support */
|
||||
#define SCENE_ITEMS_MAX 32
|
||||
|
||||
|
||||
typedef struct _scene_t scene_t;
|
||||
typedef struct _sceneitem_t sceneitem_t;
|
||||
|
||||
/**
|
||||
* Callback for when scene events occur.
|
||||
*
|
||||
* @param scene The scene that is being evented.
|
||||
* @param i The index of the current scene item.
|
||||
* @param engine The game's engine.
|
||||
*/
|
||||
typedef void sceneitemcallback_t(
|
||||
scene_t *scene, int32_t i, engine_t *engine
|
||||
);
|
||||
|
||||
typedef struct _sceneitem_t {
|
||||
sceneitemcallback_t *onUpdate;
|
||||
sceneitemcallback_t *onRender;
|
||||
sceneitemcallback_t *onDispose;
|
||||
} sceneitem_t;
|
||||
|
||||
typedef struct _scene_t {
|
||||
/** Camera that is used to render the scene */
|
||||
camera_t camera;
|
||||
|
||||
/** Any custom user data pointer */
|
||||
void *user;
|
||||
|
||||
/** Items within the scene */
|
||||
sceneitem_t items[SCENE_ITEMS_MAX];
|
||||
int32_t itemCount;
|
||||
} scene_t;
|
@ -22,6 +22,17 @@
|
||||
#define POKER_GAME_SEAT_FOR_PLAYER(p) (p - (POKER_PLAYER_COUNT/2))
|
||||
#define POKER_GAME_SEAT_DEALER POKER_GAME_SEAT_FOR_PLAYER(POKER_DEALER_INDEX)
|
||||
|
||||
/**
|
||||
* Return the seat for a given player index, also works for the dealer index.
|
||||
* @param i The players index.
|
||||
* @return The players seat number.
|
||||
*/
|
||||
#define pokerGameSeatFromIndex(i) (\
|
||||
i == POKER_DEALER_INDEX ? \
|
||||
POKER_GAME_SEAT_DEALER : \
|
||||
POKER_GAME_SEAT_FOR_PLAYER(i) \
|
||||
)
|
||||
|
||||
#define POKER_GAME_PENNY_BASE_WIDTH 1000
|
||||
#define POKER_GAME_PENNY_BASE_HEIGHT 1920
|
||||
#define POKER_GAME_PENNY_FACE_X 367
|
||||
|
@ -8,6 +8,9 @@
|
||||
#pragma once
|
||||
#include "../../../libs.h"
|
||||
#include "../../../ui/label.h"
|
||||
#include "../../../ui/image.h"
|
||||
#include "../../../display/framebuffer.h"
|
||||
#include "../../../display/camera.h"
|
||||
|
||||
typedef struct {
|
||||
label_t label;
|
||||
|
@ -14,4 +14,5 @@ typedef struct {
|
||||
primitive_t quad;
|
||||
float u0, v0;
|
||||
float u1, v1;
|
||||
float width, height;
|
||||
} image_t;
|
24
include/dawn/util/dynarray.h
Normal file
24
include/dawn/util/dynarray.h
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
|
||||
/** Custom Array Definition */
|
||||
typedef struct {
|
||||
/** The data storage */
|
||||
void *data;
|
||||
|
||||
/** Size of each element within the array */
|
||||
size_t size;
|
||||
|
||||
/** The count of elements currently in the array */
|
||||
int32_t length;
|
||||
|
||||
/** Total count of elements the array can hold */
|
||||
int32_t total;
|
||||
} dynarray_t;
|
Reference in New Issue
Block a user