update yaze public header, remove sprite.h, add z3_dungeon_sprite
This commit is contained in:
@@ -8,6 +8,12 @@ extern "C" {
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef struct dungeon_sprite {
|
||||||
|
const char* name;
|
||||||
|
uint8_t id;
|
||||||
|
uint8_t subtype;
|
||||||
|
} dungeon_sprite;
|
||||||
|
|
||||||
typedef enum background2 {
|
typedef enum background2 {
|
||||||
Off,
|
Off,
|
||||||
Parallax,
|
Parallax,
|
||||||
@@ -56,6 +62,7 @@ typedef struct destination {
|
|||||||
|
|
||||||
typedef struct z3_dungeon_room {
|
typedef struct z3_dungeon_room {
|
||||||
background2 bg2;
|
background2 bg2;
|
||||||
|
dungeon_sprite* sprites;
|
||||||
object_door* doors;
|
object_door* doors;
|
||||||
staircase* staircases;
|
staircase* staircases;
|
||||||
chest* chests;
|
chest* chests;
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ extern "C" {
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "sprite.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Primitive of an overworld map.
|
* @brief Primitive of an overworld map.
|
||||||
*/
|
*/
|
||||||
@@ -32,11 +30,6 @@ typedef struct z3_overworld_map {
|
|||||||
*/
|
*/
|
||||||
typedef struct z3_overworld {
|
typedef struct z3_overworld {
|
||||||
void *impl; // yaze::Overworld*
|
void *impl; // yaze::Overworld*
|
||||||
|
|
||||||
uint8_t *tile32_data; /**< Pointer to the 32x32 tile data. */
|
|
||||||
uint8_t *tile16_data; /**< Pointer to the 16x16 tile data. */
|
|
||||||
|
|
||||||
z3_sprite **sprites; /**< Pointer to the sprites per map. */
|
|
||||||
z3_overworld_map **maps; /**< Pointer to the overworld maps. */
|
z3_overworld_map **maps; /**< Pointer to the overworld maps. */
|
||||||
} z3_overworld;
|
} z3_overworld;
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
#ifndef YAZE_BASE_SPRITE_H_
|
|
||||||
#define YAZE_BASE_SPRITE_H_
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Primitive of a sprite.
|
|
||||||
*/
|
|
||||||
typedef struct z3_sprite {
|
|
||||||
const char* name; /**< Name of the sprite. */
|
|
||||||
uint8_t id; /**< ID of the sprite. */
|
|
||||||
uint8_t subtype; /**< Subtype of the sprite. */
|
|
||||||
} z3_sprite;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // YAZE_BASE_SPRITE_H_
|
|
||||||
63
incl/yaze.h
63
incl/yaze.h
@@ -11,20 +11,13 @@ extern "C" {
|
|||||||
#include "dungeon.h"
|
#include "dungeon.h"
|
||||||
#include "overworld.h"
|
#include "overworld.h"
|
||||||
#include "snes_color.h"
|
#include "snes_color.h"
|
||||||
#include "sprite.h"
|
|
||||||
|
|
||||||
typedef struct z3_rom z3_rom;
|
typedef struct z3_rom z3_rom;
|
||||||
|
|
||||||
typedef struct yaze_project yaze_project;
|
typedef struct yaze_project yaze_project;
|
||||||
typedef struct yaze_command_registry yaze_command_registry;
|
|
||||||
typedef struct yaze_event_dispatcher yaze_event_dispatcher;
|
|
||||||
|
|
||||||
typedef struct yaze_editor_context {
|
typedef struct yaze_editor_context {
|
||||||
z3_rom* rom;
|
z3_rom* rom;
|
||||||
yaze_project* project;
|
yaze_project* project;
|
||||||
|
|
||||||
yaze_command_registry* command_registry;
|
|
||||||
yaze_event_dispatcher* event_dispatcher;
|
|
||||||
} yaze_editor_context;
|
} yaze_editor_context;
|
||||||
|
|
||||||
void yaze_check_version(const char* version);
|
void yaze_check_version(const char* version);
|
||||||
@@ -67,27 +60,8 @@ z3_overworld* yaze_load_overworld(const z3_rom* rom);
|
|||||||
|
|
||||||
z3_dungeon_room* yaze_load_all_rooms(const z3_rom* rom);
|
z3_dungeon_room* yaze_load_all_rooms(const z3_rom* rom);
|
||||||
|
|
||||||
struct yaze_command_registry {
|
|
||||||
void (*register_command)(const char* name, void (*command)(void));
|
|
||||||
};
|
|
||||||
|
|
||||||
struct yaze_event_dispatcher {
|
|
||||||
void (*register_event_hook)(void (*event_hook)(void));
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef void (*yaze_initialize_func)(yaze_editor_context* context);
|
typedef void (*yaze_initialize_func)(yaze_editor_context* context);
|
||||||
typedef void (*yaze_cleanup_func)(void);
|
typedef void (*yaze_cleanup_func)(void);
|
||||||
typedef void (*yaze_extend_ui_func)(yaze_editor_context* context);
|
|
||||||
typedef void (*yaze_manipulate_rom_func)(z3_rom* rom);
|
|
||||||
typedef void (*yaze_command_func)(void);
|
|
||||||
typedef void (*yaze_event_hook_func)(void);
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
YAZE_EVENT_ROM_LOADED,
|
|
||||||
YAZE_EVENT_ROM_SAVED,
|
|
||||||
YAZE_EVENT_SPRITE_MODIFIED,
|
|
||||||
YAZE_EVENT_PALETTE_CHANGED,
|
|
||||||
} yaze_event_type;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Extension interface for Yaze.
|
* @brief Extension interface for Yaze.
|
||||||
@@ -113,43 +87,6 @@ typedef struct yaze_extension {
|
|||||||
* used to clean up any resources or state used by the extension.
|
* used to clean up any resources or state used by the extension.
|
||||||
*/
|
*/
|
||||||
yaze_cleanup_func cleanup;
|
yaze_cleanup_func cleanup;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Function to manipulate the ROM.
|
|
||||||
*
|
|
||||||
* @param rom The ROM to manipulate.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
yaze_manipulate_rom_func manipulate_rom;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Function to extend the UI.
|
|
||||||
*
|
|
||||||
* @param context The editor context.
|
|
||||||
*
|
|
||||||
* @details This function is called when the extension is loaded. It can be
|
|
||||||
* used to add custom UI elements to the editor. The context parameter
|
|
||||||
* provides access to the project, command registry, event dispatcher, and
|
|
||||||
* ImGui context.
|
|
||||||
*/
|
|
||||||
yaze_extend_ui_func extend_ui;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Register commands in the yaze_command_registry.
|
|
||||||
*/
|
|
||||||
yaze_command_func register_commands;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Register custom tools in the yaze_command_registry.
|
|
||||||
*/
|
|
||||||
yaze_command_func register_custom_tools;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Register event hooks in the yaze_event_dispatcher.
|
|
||||||
*/
|
|
||||||
void (*register_event_hooks)(yaze_event_type event,
|
|
||||||
yaze_event_hook_func hook);
|
|
||||||
|
|
||||||
} yaze_extension;
|
} yaze_extension;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ if (YAZE_BUILD_LIB)
|
|||||||
install(
|
install(
|
||||||
FILES
|
FILES
|
||||||
yaze.h
|
yaze.h
|
||||||
incl/sprite.h
|
|
||||||
incl/snes_tile.h
|
incl/snes_tile.h
|
||||||
incl/snes_color.h
|
incl/snes_color.h
|
||||||
incl/overworld.h
|
incl/overworld.h
|
||||||
|
|||||||
@@ -71,13 +71,5 @@ void ExtensionManager::ShutdownExtensions() {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtensionManager::ExecuteExtensionUI(yaze_editor_context* context) {
|
|
||||||
for (auto& extension : extensions_) {
|
|
||||||
if (extension->extend_ui) {
|
|
||||||
extension->extend_ui(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ class ExtensionManager {
|
|||||||
void RegisterExtension(yaze_extension* extension);
|
void RegisterExtension(yaze_extension* extension);
|
||||||
void InitializeExtensions(yaze_editor_context* context);
|
void InitializeExtensions(yaze_editor_context* context);
|
||||||
void ShutdownExtensions();
|
void ShutdownExtensions();
|
||||||
void ExecuteExtensionUI(yaze_editor_context* context);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<yaze_extension*> extensions_;
|
std::vector<yaze_extension*> extensions_;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
#include "incl/extension.h"
|
#include "incl/extension.h"
|
||||||
#include "incl/overworld.h"
|
#include "incl/overworld.h"
|
||||||
#include "incl/snes_color.h"
|
#include "incl/snes_color.h"
|
||||||
#include "incl/sprite.h"
|
|
||||||
#include "yaze.h"
|
#include "yaze.h"
|
||||||
|
|
||||||
BOOST_PYTHON_MODULE(yaze_py) {
|
BOOST_PYTHON_MODULE(yaze_py) {
|
||||||
@@ -25,10 +24,6 @@ BOOST_PYTHON_MODULE(yaze_py) {
|
|||||||
.def_readonly("size", &snes_palette::size)
|
.def_readonly("size", &snes_palette::size)
|
||||||
.def_readonly("colors", &snes_palette::colors);
|
.def_readonly("colors", &snes_palette::colors);
|
||||||
|
|
||||||
class_<z3_sprite>("sprite")
|
|
||||||
.def_readonly("name", &z3_sprite::name)
|
|
||||||
.def_readonly("id", &z3_sprite::id);
|
|
||||||
|
|
||||||
class_<yaze_flags>("yaze_flags")
|
class_<yaze_flags>("yaze_flags")
|
||||||
.def_readwrite("debug", &yaze_flags::debug)
|
.def_readwrite("debug", &yaze_flags::debug)
|
||||||
.def_readwrite("rom_filename", &yaze_flags::rom_filename)
|
.def_readwrite("rom_filename", &yaze_flags::rom_filename)
|
||||||
@@ -40,12 +35,6 @@ BOOST_PYTHON_MODULE(yaze_py) {
|
|||||||
class_<yaze_editor_context>("yaze_editor_context")
|
class_<yaze_editor_context>("yaze_editor_context")
|
||||||
.def_readonly("project", &yaze_editor_context::project);
|
.def_readonly("project", &yaze_editor_context::project);
|
||||||
|
|
||||||
enum_<yaze_event_type>("yaze_event_type")
|
|
||||||
.value("YAZE_EVENT_ROM_LOADED", YAZE_EVENT_ROM_LOADED)
|
|
||||||
.value("YAZE_EVENT_ROM_SAVED", YAZE_EVENT_ROM_SAVED)
|
|
||||||
.value("YAZE_EVENT_SPRITE_MODIFIED", YAZE_EVENT_SPRITE_MODIFIED)
|
|
||||||
.value("YAZE_EVENT_PALETTE_CHANGED", YAZE_EVENT_PALETTE_CHANGED);
|
|
||||||
|
|
||||||
class_<yaze_extension>("yaze_extension")
|
class_<yaze_extension>("yaze_extension")
|
||||||
.def_readonly("name", &yaze_extension::name)
|
.def_readonly("name", &yaze_extension::name)
|
||||||
.def_readonly("version", &yaze_extension::version);
|
.def_readonly("version", &yaze_extension::version);
|
||||||
|
|||||||
Reference in New Issue
Block a user