Textbox example.
This commit is contained in:
@@ -12,8 +12,10 @@
|
||||
void cutsceneItemStart(const cutsceneitem_t *item, cutsceneitemdata_t *data) {
|
||||
switch(item->type) {
|
||||
case CUTSCENE_ITEM_TYPE_TEXT: {
|
||||
strncpy(data->text.buffer, item->text, CUTSCENE_TEXT_BUFFER);
|
||||
data->text.length = strlen(data->text.buffer);
|
||||
rpgTextboxShow(
|
||||
item->text.position,
|
||||
item->text.text
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -36,6 +38,11 @@ void cutsceneItemStart(const cutsceneitem_t *item, cutsceneitemdata_t *data) {
|
||||
|
||||
void cutsceneItemUpdate(const cutsceneitem_t *item, cutsceneitemdata_t *data) {
|
||||
switch(item->type) {
|
||||
case CUTSCENE_ITEM_TYPE_TEXT:
|
||||
if(rpgTextboxIsVisible()) return;
|
||||
cutsceneSystemNext();
|
||||
break;
|
||||
|
||||
case CUTSCENE_ITEM_TYPE_WAIT:
|
||||
data->wait -= TIME.fixedDelta;
|
||||
if(data->wait <= 0) cutsceneSystemNext();
|
||||
|
||||
@@ -27,12 +27,11 @@ typedef struct cutsceneitem_s {
|
||||
cutscenetext_t text;
|
||||
cutscenecallback_t callback;
|
||||
cutscenewait_t wait;
|
||||
cutscenecutscene_t cutscene;
|
||||
const cutscenecutscene_t cutscene;
|
||||
};
|
||||
} cutsceneitem_t;
|
||||
|
||||
typedef union {
|
||||
cutscenetextdata_t text;
|
||||
cutscenewaitdata_t wait;
|
||||
} cutsceneitemdata_t;
|
||||
|
||||
|
||||
@@ -6,14 +6,9 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "dusk.h"
|
||||
#include "rpg/rpgtextbox.h"
|
||||
|
||||
#define CUTSCENE_TEXT_BUFFER 256
|
||||
|
||||
typedef const char_t *cutscenetext_t;
|
||||
|
||||
typedef struct cutscenetextdata_s {
|
||||
char_t buffer[CUTSCENE_TEXT_BUFFER];
|
||||
uint8_t length;
|
||||
uint8_t scroll;
|
||||
} cutscenetextdata_t;
|
||||
typedef struct {
|
||||
char_t text[RPG_TEXTBOX_MAX_CHARS];
|
||||
rpgtextboxpos_t position;
|
||||
} cutscenetext_t;
|
||||
Reference in New Issue
Block a user