yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze_py.cc
Go to the documentation of this file.
1#include <boost/python.hpp>
2
3#include "incl/extension.h"
4#include "incl/overworld.h"
5#include "incl/snes_color.h"
6#include "incl/sprite.h"
7#include "yaze.h"
8
10 using namespace boost::python;
11
12 class_<z3_rom>("z3_rom")
13 .def_readonly("filename", &z3_rom::filename)
14 .def_readonly("data", &z3_rom::data)
15 .def_readonly("size", &z3_rom::size)
16 .def_readonly("impl", &z3_rom::impl);
17
18 class_<snes_color>("snes_color")
19 .def_readonly("red", &snes_color::red)
20 .def_readonly("green", &snes_color::green)
21 .def_readonly("blue", &snes_color::blue);
22
23 class_<snes_palette>("snes_palette")
24 .def_readonly("id", &snes_palette::id)
25 .def_readonly("size", &snes_palette::size)
26 .def_readonly("colors", &snes_palette::colors);
27
28 class_<z3_sprite>("sprite")
29 .def_readonly("name", &z3_sprite::name)
30 .def_readonly("id", &z3_sprite::id);
31
32 class_<yaze_flags>("yaze_flags")
33 .def_readwrite("debug", &yaze_flags::debug)
34 .def_readwrite("rom_filename", &yaze_flags::rom_filename)
35 .def_readwrite("rom", &yaze_flags::rom);
36
37 class_<yaze_project>("yaze_project")
38 .def_readonly("filename", &yaze_project::filepath);
39
40 class_<yaze_editor_context>("yaze_editor_context")
41 .def_readonly("project", &yaze_editor_context::project);
42
43 enum_<yaze_event_type>("yaze_event_type")
44 .value("YAZE_EVENT_ROM_LOADED", YAZE_EVENT_ROM_LOADED)
45 .value("YAZE_EVENT_ROM_SAVED", YAZE_EVENT_ROM_SAVED)
46 .value("YAZE_EVENT_SPRITE_MODIFIED", YAZE_EVENT_SPRITE_MODIFIED)
47 .value("YAZE_EVENT_PALETTE_CHANGED", YAZE_EVENT_PALETTE_CHANGED);
48
49 class_<yaze_extension>("yaze_extension")
50 .def_readonly("name", &yaze_extension::name)
51 .def_readonly("version", &yaze_extension::version);
52
53 // Functions that return raw pointers need to be managed by Python's garbage
54 // collector
55 def("yaze_load_rom", &yaze_load_rom,
56 return_value_policy<manage_new_object>());
57 def("yaze_unload_rom", &yaze_unload_rom); // No need to manage memory here
58 def("yaze_get_color_from_paletteset", &yaze_get_color_from_paletteset);
59 def("yaze_check_version", &yaze_check_version);
60}
@ YAZE_EVENT_ROM_SAVED
Definition extension.h:19
@ YAZE_EVENT_PALETTE_CHANGED
Definition extension.h:21
@ YAZE_EVENT_SPRITE_MODIFIED
Definition extension.h:20
@ YAZE_EVENT_ROM_LOADED
Definition extension.h:18
uint16_t green
Definition snes_color.h:16
uint16_t red
Definition snes_color.h:14
uint16_t blue
Definition snes_color.h:15
unsigned int id
Definition snes_color.h:23
snes_color * colors
Definition snes_color.h:25
unsigned int size
Definition snes_color.h:24
yaze_project * project
Definition yaze.h:27
const char * version
Definition extension.h:31
const char * name
Definition extension.h:30
const char * filepath
Definition yaze.h:48
const char * filename
Definition yaze.h:60
void * impl
Definition yaze.h:63
size_t size
Definition yaze.h:62
const uint8_t * data
Definition yaze.h:61
const char * name
Definition sprite.h:14
uint8_t id
Definition sprite.h:15
void yaze_unload_rom(z3_rom *rom)
Unload a Zelda3 ROM.
Definition yaze.cc:59
void yaze_check_version(const char *version)
Check the version of the Yaze library.
Definition yaze.cc:8
z3_rom * yaze_load_rom(const char *filename)
Load a Zelda3 ROM from a file.
Definition yaze.cc:43
snes_color yaze_get_color_from_paletteset(const z3_rom *rom, int palette_set, int palette, int color)
Get a color from a palette set.
Definition yaze.cc:78
BOOST_PYTHON_MODULE(yaze_py)
Definition yaze_py.cc:9