Commit bc3ab2a2 by beoran

Divide source and include files into diretories for better oversight.

parent e5b98070
......@@ -49,6 +49,8 @@ include_directories(${ALLEGRO_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${JPEG_INCLUDE_DIR
set(ERUTA_LIBS ${LIBS} ${OBJC_LIBRARIES} ${ALLEGRO_LIBRARIES} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${MRUBY_LIBRARIES})
include_directories("include")
include_directories("include/zori")
include_directories("include/tr")
# add_subdirectory("src")
include(ErutaFiles)
set_source_files_properties(${ERUTA_SRC_FILES} PROPERTIES LANGUAGE C)
......
......@@ -68,15 +68,16 @@ set(ERUTA_SRC_FILES
src/tarray.c
src/tmatrix.c
src/toruby.c
src/tr_audio.c
src/tr_path.c
src/tr_store.c
src/tr_graph.c
src/tr_sprite.c
src/tr_thing.c
src/tr/tr_audio.c
src/tr/tr_path.c
src/tr/tr_store.c
src/tr/tr_graph.c
src/tr/tr_sprite.c
src/tr/tr_thing.c
src/ui.c
src/utf8.c
src/xresor.c
src/zori.c
src/zori_screen.c
src/zori/zori.c
src/zori/zori_screen.c
src/zori/zori_page.c
)
#ifndef zori_page_H_INCLUDED
#define zori_page_H_INCLUDED
#endif
......@@ -20,6 +20,14 @@
#include "callrb.h"
#include "store.h"
#include "zori.h"
#include "zori_screen.h"
/* Sub data struct for the particular GUI state */
struct GuiState {
zori_id screen;
zori_id console;
};
/* The data struct contains all global state and other data of the application.
*/
......@@ -76,7 +84,7 @@ struct State_ {
/* Logical and physical game objects. This one is always active, regardless of the tile map. */
Area * area;
// View camera for the area, tile map and particle engine.
/* View camera for the area, tile map and particle engine. */
Camera * camera;
/* Mode is removed, this will be handled on the scripting side. */
......@@ -90,6 +98,11 @@ struct State_ {
Implemented in C so it's usable even if there are script bugs.
*/
struct zori_console * console;
/* GUI data. */
struct GuiState ui;
/* The current actor, controlled by the player. */
Thing * actor;
......@@ -486,6 +499,26 @@ int state_initjoystick(State * self) {
return num;
}
/* Initialize the GUI for the Eruta engine. */
State * state_init_gui(State * self, BOOL fullscreen) {
/* Set up Zori GUI. */
struct zori_style style;
memset(&style, 0, sizeof(style));
style.text.font = self->font;
style.text.color = color_rgb(255,255,255);
style.back.color = color_rgba(64,0,0, 191);
if ( !ZORI_ID_OK_P(zori_start(&style)) ) {
return state_errmsg_(self, "Out of memory when allocating GUI.");
}
self->ui.screen = zori_new_screen(-1, self->display);
if(!ZORI_ID_OK_P(self->ui.screen)) {
return state_errmsg_(self, "Could not init GUI screen.\n");
}
return self;
}
/** Initializes the state. It opens the screen, keyboards,
......@@ -623,17 +656,9 @@ State * state_init(State * self, BOOL fullscreen) {
if(!self->camera) {
return state_errmsg_(self, "Out of memory when allocating camera.");
}
/* Set up Zori GUI. */
{
struct zori_style style;
memset(&style, 0, sizeof(style));
style.text.font = self->font;
style.text.color = color_rgb(255,255,255);
style.back.color = color_rgba(64,0,0, 191);
if ( !ZORI_ID_OK_P(zori_start(&style)) ) {
return state_errmsg_(self, "Out of memory when allocating GUI.");
}
}
/* Set up GUI. */
if (!state_init_gui(self, fullscreen)) return NULL;
/* Set up console. */
{
......
#include "zori_page.h"
/**
* This is a test for zori_page in $package$
*/
#include "si_test.h"
#include "zori_page.h"
TEST_FUNC(zori_page) {
TEST_DONE();
}
int main(void) {
TEST_INIT();
TEST_RUN(zori_page);
TEST_REPORT();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment