Add inventory.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#include "util/memory.h"
|
||||
#include "display/tileset/tileset_minogram.h"
|
||||
#include "display/screen.h"
|
||||
#include "ui/uitextbox.h"
|
||||
// #include "ui/uitextbox.h"
|
||||
|
||||
ui_t UI;
|
||||
|
||||
@@ -33,7 +33,7 @@ void uiUpdate(void) {
|
||||
UI.camera.orthographic.top = 0;
|
||||
UI.camera.orthographic.bottom = SCREEN.height;
|
||||
|
||||
uiTextboxUpdate();
|
||||
// uiTextboxUpdate();
|
||||
}
|
||||
|
||||
void uiRender(void) {
|
||||
@@ -42,7 +42,7 @@ void uiRender(void) {
|
||||
// Render UI elements here
|
||||
if(UI.fontTexture.width > 0) {
|
||||
uiDebugRender(UI.fontTileset, &UI.fontTexture);
|
||||
uiTextboxRender();
|
||||
// uiTextboxRender();
|
||||
}
|
||||
cameraPopMatrix();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "ui/uitext.h"
|
||||
#include "display/screen.h"
|
||||
#include "display/spritebatch.h"
|
||||
#include "rpg/entity/entity.h"
|
||||
// #include "rpg/entity/entity.h"
|
||||
|
||||
bool_t UI_DEBUG_DRAW = true;
|
||||
|
||||
@@ -67,32 +67,32 @@ void uiDebugRender(const tileset_t *tileset, texture_t *texture) {
|
||||
|
||||
|
||||
// Player position
|
||||
entity_t *player = NULL;
|
||||
for(uint8_t i = 0; i < ENTITY_COUNT; i++) {
|
||||
if(ENTITIES[i].type != ENTITY_TYPE_PLAYER) continue;
|
||||
player = &ENTITIES[i];
|
||||
break;
|
||||
}
|
||||
if(player == NULL) {
|
||||
snprintf(buffer, sizeof(buffer), "Player: N/A");
|
||||
} else {
|
||||
snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"%d,%d,%d/%d/%d",
|
||||
player->position.x,
|
||||
player->position.y,
|
||||
player->position.z,
|
||||
(int32_t)player->direction,
|
||||
(int32_t)player->animation
|
||||
);
|
||||
}
|
||||
uiTextMeasure(buffer, tileset, &w, &h);
|
||||
uiTextDraw(
|
||||
SCREEN.width - w, hOffset,
|
||||
buffer, COLOR_GREEN, tileset, texture
|
||||
);
|
||||
hOffset += h;
|
||||
// entity_t *player = NULL;
|
||||
// for(uint8_t i = 0; i < ENTITY_COUNT; i++) {
|
||||
// if(ENTITIES[i].type != ENTITY_TYPE_PLAYER) continue;
|
||||
// player = &ENTITIES[i];
|
||||
// break;
|
||||
// }
|
||||
// if(player == NULL) {
|
||||
// snprintf(buffer, sizeof(buffer), "Player: N/A");
|
||||
// } else {
|
||||
// snprintf(
|
||||
// buffer,
|
||||
// sizeof(buffer),
|
||||
// "%d,%d,%d/%d/%d",
|
||||
// player->position.x,
|
||||
// player->position.y,
|
||||
// player->position.z,
|
||||
// (int32_t)player->direction,
|
||||
// (int32_t)player->animation
|
||||
// );
|
||||
// }
|
||||
// uiTextMeasure(buffer, tileset, &w, &h);
|
||||
// uiTextDraw(
|
||||
// SCREEN.width - w, hOffset,
|
||||
// buffer, COLOR_GREEN, tileset, texture
|
||||
// );
|
||||
// hOffset += h;
|
||||
|
||||
spriteBatchFlush();
|
||||
}
|
||||
@@ -8,38 +8,38 @@
|
||||
#include "uitextbox.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/uitext.h"
|
||||
#include "rpg/rpgtextbox.h"
|
||||
// #include "rpg/rpgtextbox.h"
|
||||
#include "display/screen.h"
|
||||
#include "display/spritebatch.h"
|
||||
#include "input/input.h"
|
||||
|
||||
void uiTextboxUpdate() {
|
||||
if(!rpgTextboxIsVisible()) return;
|
||||
// void uiTextboxUpdate() {
|
||||
// if(!rpgTextboxIsVisible()) return;
|
||||
|
||||
if(inputPressed(INPUT_ACTION_ACCEPT)) {
|
||||
rpgTextboxHide();
|
||||
}
|
||||
}
|
||||
// if(inputPressed(INPUT_ACTION_ACCEPT)) {
|
||||
// rpgTextboxHide();
|
||||
// }
|
||||
// }
|
||||
|
||||
void uiTextboxRender() {
|
||||
if(!rpgTextboxIsVisible()) return;
|
||||
// void uiTextboxRender() {
|
||||
// if(!rpgTextboxIsVisible()) return;
|
||||
|
||||
const char_t *text = RPG_TEXTBOX.text;
|
||||
int32_t textWidth, textHeight;
|
||||
// const char_t *text = RPG_TEXTBOX.text;
|
||||
// int32_t textWidth, textHeight;
|
||||
|
||||
uiTextMeasure(text, UI.fontTileset, &textWidth, &textHeight);
|
||||
// uiTextMeasure(text, UI.fontTileset, &textWidth, &textHeight);
|
||||
|
||||
float_t y = 0;
|
||||
if(RPG_TEXTBOX.position == RPG_TEXTBOX_POS_BOTTOM) {
|
||||
y = SCREEN.height - (float_t)textHeight;
|
||||
}
|
||||
// float_t y = 0;
|
||||
// if(RPG_TEXTBOX.position == RPG_TEXTBOX_POS_BOTTOM) {
|
||||
// y = SCREEN.height - (float_t)textHeight;
|
||||
// }
|
||||
|
||||
spriteBatchPush(
|
||||
NULL,
|
||||
0.0f, y,
|
||||
(float_t)SCREEN.width, (float_t)(y + textHeight),
|
||||
COLOR_BLACK,
|
||||
0.0f, 0.0f, 1.0f, 1.0f
|
||||
);
|
||||
uiTextDraw(0, y, text, COLOR_RED, UI.fontTileset, &UI.fontTexture);
|
||||
}
|
||||
// spriteBatchPush(
|
||||
// NULL,
|
||||
// 0.0f, y,
|
||||
// (float_t)SCREEN.width, (float_t)(y + textHeight),
|
||||
// COLOR_BLACK,
|
||||
// 0.0f, 0.0f, 1.0f, 1.0f
|
||||
// );
|
||||
// uiTextDraw(0, y, text, COLOR_RED, UI.fontTileset, &UI.fontTexture);
|
||||
// }
|
||||
Reference in New Issue
Block a user