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

@@ -1,11 +0,0 @@
# 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
itemtype.c
inventory.c
)

View File

@@ -1,16 +0,0 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "assert/assert.h"
#include "inventory.h"
#include "util/memory.h"
void inventoryInit(inventory_t *inventory) {
assertNotNull(inventory, "Inventory pointer cannot be NULL");
memoryZero(inventory, sizeof(inventory_t));
}

View File

@@ -1,23 +0,0 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "itemstack.h"
#define INVENTORY_ITEM_COUNT 32
typedef struct {
itemstack_t items[INVENTORY_ITEM_COUNT];
uint8_t itemCount;
} inventory_t;
/**
* Initializes the inventory.
*
* @param inventory Pointer to the inventory to initialize.
*/
void inventoryInit(inventory_t *inventory);

View File

@@ -1,14 +0,0 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "itemtype.h"
typedef struct {
itemtype_t type;
uint8_t count;
} itemstack_t;

View File

@@ -1,28 +0,0 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "assert/assert.h"
#include "itemtype.h"
iteminfo_t ITEM_INFO[ITEM_TYPE_COUNT] = {
[ITEM_TYPE_NULL] = { 0 },
// Consumables
[ITEM_TYPE_POTION] = { .stackable = true },
// Ingredients
[ITEM_TYPE_ONION] = { .stackable = true },
[ITEM_TYPE_SWEET_POTATO] = { .stackable = true },
// Cooked Items
[ITEM_TYPE_BAKED_SWEET_POTATO] = { .stackable = true },
};
static inline bool_t itemTypeIsStackable(const itemtype_t type) {
assertTrue(type < ITEM_TYPE_COUNT, "Invalid item type");
return ITEM_INFO[type].stackable;
}

View File

@@ -1,38 +0,0 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "dusk.h"
typedef enum {
ITEM_TYPE_NULL,
// Consumables
ITEM_TYPE_POTION,
// Ingredients
ITEM_TYPE_ONION,
ITEM_TYPE_SWEET_POTATO,
// Cooked Items
ITEM_TYPE_BAKED_SWEET_POTATO,
} itemtype_t;
#define ITEM_TYPE_COUNT (ITEM_TYPE_BAKED_SWEET_POTATO + 1)
typedef struct {
bool_t stackable;
} iteminfo_t;
extern iteminfo_t ITEM_INFO[ITEM_TYPE_COUNT];
/**
* Returns true if the item type is stackable.
*
* @param type The item type to check.
* @return true if the item type is stackable, false otherwise.
*/
static inline bool_t itemTypeIsStackable(const itemtype_t type);