|
@@ -20,6 +20,14 @@
|
|
#include "callrb.h"
|
|
#include "callrb.h"
|
|
#include "store.h"
|
|
#include "store.h"
|
|
#include "zori.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.
|
|
/* 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. */
|
|
/* Logical and physical game objects. This one is always active, regardless of the tile map. */
|
|
Area * area;
|
|
Area * area;
|
|
- // View camera for the area, tile map and particle engine.
|
|
|
|
|
|
+ /* View camera for the area, tile map and particle engine. */
|
|
Camera * camera;
|
|
Camera * camera;
|
|
|
|
|
|
/* Mode is removed, this will be handled on the scripting side. */
|
|
/* 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.
|
|
Implemented in C so it's usable even if there are script bugs.
|
|
*/
|
|
*/
|
|
struct zori_console * console;
|
|
struct zori_console * console;
|
|
|
|
+
|
|
|
|
+ /* GUI data. */
|
|
|
|
+ struct GuiState ui;
|
|
|
|
+
|
|
|
|
+
|
|
/* The current actor, controlled by the player. */
|
|
/* The current actor, controlled by the player. */
|
|
Thing * actor;
|
|
Thing * actor;
|
|
|
|
|
|
@@ -486,6 +499,26 @@ int state_initjoystick(State * self) {
|
|
return num;
|
|
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,
|
|
/** Initializes the state. It opens the screen, keyboards,
|
|
@@ -623,17 +656,9 @@ State * state_init(State * self, BOOL fullscreen) {
|
|
if(!self->camera) {
|
|
if(!self->camera) {
|
|
return state_errmsg_(self, "Out of memory when allocating 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. */
|
|
/* Set up console. */
|
|
{
|
|
{
|