diff --git a/include/dawn/dawn.h b/include/dawn/dawn.h index e1007896..a073f72e 100644 --- a/include/dawn/dawn.h +++ b/include/dawn/dawn.h @@ -38,12 +38,13 @@ #include "game/dawn/dawngame.h" +#include "game/poker/ui/pokerplayerui.h" +#include "game/poker/ui/pokerui.h" #include "game/poker/pokerdiscussion.h" #include "game/poker/pokergame.h" #include "game/poker/pokergameaction.h" #include "game/poker/pokergameassets.h" #include "game/poker/pokerworld.h" -#include "game/poker/pokerui.h" // Player Input #include "input/input.h" diff --git a/include/dawn/game/poker/pokergame.h b/include/dawn/game/poker/pokergame.h index 98c0e0bb..e210eec0 100644 --- a/include/dawn/game/poker/pokergame.h +++ b/include/dawn/game/poker/pokergame.h @@ -10,8 +10,8 @@ #include "../../display/animation/queue.h" #include "pokergameassets.h" #include "pokerworld.h" -#include "pokerui.h" #include "pokergameaction.h" +#include "ui/pokerui.h" #include "../../poker/poker.h" #include "../../poker/player.h" #include "../../poker/dealer.h" diff --git a/include/dawn/game/poker/pokerui.h b/include/dawn/game/poker/pokerui.h deleted file mode 100644 index ae29779c..00000000 --- a/include/dawn/game/poker/pokerui.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) 2021 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#pragma once -#include "../../libs.h" -#include "../../ui/label.h" -#include "../../poker/player.h" - -typedef struct { - label_t labelInfo; -} pokerplayerui_t; - -typedef struct { - pokerplayerui_t players[POKER_PLAYER_COUNT]; - label_t labelGameInfo; -} pokerui_t; \ No newline at end of file diff --git a/include/dawn/game/poker/ui/pokerplayerui.h b/include/dawn/game/poker/ui/pokerplayerui.h new file mode 100644 index 00000000..1cdcb2c3 --- /dev/null +++ b/include/dawn/game/poker/ui/pokerplayerui.h @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2021 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "../../../libs.h" +#include "../../../ui/label.h" + +typedef struct { + label_t label; +} pokerplayerui_t; \ No newline at end of file diff --git a/include/dawn/game/poker/ui/pokerui.h b/include/dawn/game/poker/ui/pokerui.h new file mode 100644 index 00000000..42086664 --- /dev/null +++ b/include/dawn/game/poker/ui/pokerui.h @@ -0,0 +1,15 @@ +/** + * Copyright (c) 2021 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "../../../libs.h" +#include "../../../poker/player.h" +#include "pokerplayerui.h" + +typedef struct { + pokerplayerui_t player[POKER_PLAYER_COUNT]; +} pokerui_t; \ No newline at end of file diff --git a/include/dawn/ui/frame.h b/include/dawn/ui/frame.h index ba1c4003..6d5be46b 100644 --- a/include/dawn/ui/frame.h +++ b/include/dawn/ui/frame.h @@ -18,7 +18,6 @@ #define FRAME_PRIMITIVE_COUNT 9 typedef struct { - float x, y; texture_t *texture; primitive_t primitive; } frame_t; \ No newline at end of file diff --git a/include/dawn/ui/image.h b/include/dawn/ui/image.h index 79ad7f7b..1d85a04f 100644 --- a/include/dawn/ui/image.h +++ b/include/dawn/ui/image.h @@ -10,7 +10,6 @@ #include "../display/primitive.h" typedef struct { - float x, y; texture_t *texture; primitive_t quad; float u0, v0; diff --git a/include/dawn/ui/label.h b/include/dawn/ui/label.h index 428a41c7..198053d1 100644 --- a/include/dawn/ui/label.h +++ b/include/dawn/ui/label.h @@ -13,7 +13,6 @@ /** Representation of a Label UI Element */ typedef struct { font_t *font; - float x, y; float fontSize; fonttextinfo_t info; primitive_t primitive; diff --git a/include/dawn/ui/menulist.h b/include/dawn/ui/menulist.h index f06da48c..4c92e8ed 100644 --- a/include/dawn/ui/menulist.h +++ b/include/dawn/ui/menulist.h @@ -25,7 +25,6 @@ typedef void menulistcallback_t(menulist_t *list, uint8_t i, void *user); /** Representation of a menu list, a menu with multiple menu items. */ typedef struct _menulist_t { - float x, y; char *items[MENULIST_ITEMS_MAX]; label_t labels[MENULIST_ITEMS_MAX]; frame_t frame; diff --git a/include/dawn/ui/rectangle.h b/include/dawn/ui/rectangle.h index d30ad61e..9d39a75f 100644 --- a/include/dawn/ui/rectangle.h +++ b/include/dawn/ui/rectangle.h @@ -10,7 +10,6 @@ #include "../display/primitive.h" typedef struct { - float x, y; float width, height; texture_t texture; primitive_t quad; diff --git a/include/dawn/vn/vntextbox.h b/include/dawn/vn/vntextbox.h index 292b66d7..051540e5 100644 --- a/include/dawn/vn/vntextbox.h +++ b/include/dawn/vn/vntextbox.h @@ -33,9 +33,6 @@ typedef struct { int32_t linesMax; int32_t lineCurrent; - /** X, Y Position of the textbox */ - float x, y; - /** Readonly values for the dimensions of the textbox */ float width, height; diff --git a/src/game/poker/pokergame.h b/src/game/poker/pokergame.h index d7ceb7af..7c15a474 100644 --- a/src/game/poker/pokergame.h +++ b/src/game/poker/pokergame.h @@ -13,12 +13,10 @@ #include "../../vn/vnscene.h" #include "../../util/array.h" #include "actions/start.h" -#include "pokerui.h" +#include "ui/pokerui.h" #include "pokerworld.h" #include "actions/start.h" -#include "../../ui/menulist.h" - /** * Initializes the game state for the poker game. * diff --git a/src/game/poker/pokerui.c b/src/game/poker/pokerui.c deleted file mode 100644 index 275d4407..00000000 --- a/src/game/poker/pokerui.c +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) 2021 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#include "pokerui.h" - -void pokerUiInit(pokergame_t *pokerGame) { - pokerplayerui_t *playerUi; - pokerplayer_t *playerPoker; - vncharacter_t *character; - uint8_t i; - - for(i = 0; i < POKER_PLAYER_COUNT; i++) { - playerUi = pokerGame->ui.players + i; - playerPoker = pokerGame->poker.players + i; - character = pokerGame->scene.characters + i; - - labelInit(&playerUi->labelInfo); - playerUi->labelInfo.fontSize = 12.0; - } - - labelInit(&pokerGame->ui.labelGameInfo); - pokerGame->ui.labelGameInfo.fontSize = 12.0f; -} - -void pokerUiRender(pokergame_t *pokerGame) { - pokerplayerui_t *playerUi; - pokerplayer_t *playerPoker; - uint8_t i; - char buffer[256]; - - sprintf(buffer, "Pot %i\n", pokerGame->poker.bet.pot); - labelSetText(&pokerGame->ui.labelGameInfo, &pokerGame->assets.font, buffer); - pokerGame->ui.labelGameInfo.x = 350; - labelRender(&pokerGame->ui.labelGameInfo, &pokerGame->assets.shader); - - for(i = 0; i < POKER_PLAYER_COUNT; i++) { - playerUi = pokerGame->ui.players + i; - playerPoker = pokerGame->poker.players + i; - - // Player Chips - sprintf(buffer, "Player %u - %u chips - %s%s", - i, - playerPoker->chips, - i == POKER_PLAYER_HUMAN_INDEX ? "Human" : "AI", - i == pokerGame->poker.bet.better ? " Betting" : - playerPoker->state & POKER_PLAYER_STATE_FOLDED ? " Folded" : - playerPoker->state & POKER_PLAYER_STATE_OUT ? " Out" : - "" - ); - playerUi->labelInfo.y = (float)i * 32.0f; - labelSetText(&playerUi->labelInfo, &pokerGame->assets.font, buffer); - labelRender(&playerUi->labelInfo, &pokerGame->assets.shader); - } -} - -void pokerUiDispose(pokergame_t *pokerGame) { - pokerplayerui_t *player; - uint8_t i; - - for(i = 0; i < POKER_PLAYER_COUNT; i++) { - player = pokerGame->ui.players + i; - labelDispose(&player->labelInfo); - } -} \ No newline at end of file diff --git a/src/game/poker/ui/pokerplayerui.c b/src/game/poker/ui/pokerplayerui.c new file mode 100644 index 00000000..251e1a7c --- /dev/null +++ b/src/game/poker/ui/pokerplayerui.c @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2021 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "pokerplayerui.h" + +void pokerPlayerUiInit(pokerplayerui_t *ui) { + labelInit(&ui->label); +} + +void pokerPlayerUiRender( + pokerplayerui_t *ui, pokergame_t *game, shader_t *shader, font_t *font, + int32_t playerIndex, float x, float y +) { + pokerplayer_t *player; + char buffer[32]; + float scale; + + scale = fontGetScale(FONT_SIZE_DEFAULT); + player = game->poker.players + playerIndex; + + // Render chips + sprintf(buffer, "$%i", player->chips); + labelSetText(&ui->label, font, buffer); + labelRender(&ui->label, shader, x, y); + + // Render state + if(player->state & POKER_PLAYER_STATE_OUT) { + sprintf(buffer, "Out"); + } else if(player->state & POKER_PLAYER_STATE_FOLDED) { + sprintf(buffer, "Folded"); + } else if(player->state & POKER_PLAYER_STATE_SHOWING) { + sprintf(buffer, "Showing"); + } else if(game->poker.bet.better == playerIndex) { + sprintf(buffer, "Thinking"); + } else { + sprintf(buffer, "Whatever"); + } + labelSetText(&ui->label, font, buffer); + labelRender(&ui->label, shader, x, y + scale * FONT_LINE_HEIGHT); + + // Render face? + +} + +void pokerPlayerUiDispose(pokerplayerui_t *ui) { + labelDispose(&ui->label); +} \ No newline at end of file diff --git a/src/game/poker/ui/pokerplayerui.h b/src/game/poker/ui/pokerplayerui.h new file mode 100644 index 00000000..d098de3f --- /dev/null +++ b/src/game/poker/ui/pokerplayerui.h @@ -0,0 +1,20 @@ +/** + * Copyright (c) 2021 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include +#include "../../../ui/label.h" + + +void pokerPlayerUiInit(pokerplayerui_t *ui); + +void pokerPlayerUiRender( + pokerplayerui_t *ui, pokergame_t *game, shader_t *shader, font_t *font, + int32_t playerIndex, float x, float y +); + +void pokerPlayerUiDispose(pokerplayerui_t *ui); \ No newline at end of file diff --git a/src/game/poker/ui/pokerui.c b/src/game/poker/ui/pokerui.c new file mode 100644 index 00000000..a951b17a --- /dev/null +++ b/src/game/poker/ui/pokerui.c @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "pokerui.h" + +void pokerUiInit(pokergame_t *pokerGame) { + uint8_t i; + + for(i = 0; i < POKER_PLAYER_COUNT; i++) { + pokerPlayerUiInit(pokerGame->ui.player + i); + } +} + +void pokerUiRender(pokergame_t *pokerGame) { + uint8_t i; + pokerplayerui_t *ui; + + for(i = 0; i < POKER_PLAYER_COUNT; i++) { + ui = pokerGame->ui.player + i; + + pokerPlayerUiRender(ui, pokerGame, + &pokerGame->assets.shader, &pokerGame->assets.font, + i, + i * 150.0f, 0 + ); + } +} + +void pokerUiDispose(pokergame_t *pokerGame) { + uint8_t i; + + for(i = 0; i < POKER_PLAYER_COUNT; i++) { + pokerPlayerUiDispose(pokerGame->ui.player + i); + } +} \ No newline at end of file diff --git a/src/game/poker/pokerui.h b/src/game/poker/ui/pokerui.h similarity index 91% rename from src/game/poker/pokerui.h rename to src/game/poker/ui/pokerui.h index 5b7926e7..9b68ea1c 100644 --- a/src/game/poker/pokerui.h +++ b/src/game/poker/ui/pokerui.h @@ -7,7 +7,8 @@ #pragma once #include -#include "../../ui/label.h" +#include "../../../ui/label.h" +#include "pokerplayerui.h" /** * Initializes the UI Module. diff --git a/src/ui/frame.c b/src/ui/frame.c index c19efdf2..4942ef2c 100644 --- a/src/ui/frame.c +++ b/src/ui/frame.c @@ -8,9 +8,6 @@ #include "frame.h" void frameInit(frame_t *frame) { - frame->x = 0; - frame->y = 0; - primitiveInit( &frame->primitive, QUAD_VERTICE_COUNT * FRAME_PRIMITIVE_COUNT, @@ -103,8 +100,8 @@ void frameSetInnerSize(frame_t *frame, float width, float height) { ); } -void frameRender(frame_t *frame, shader_t *shader) { - shaderUsePosition(shader, frame->x, frame->y, 0, 0, 0, 0); +void frameRender(frame_t *frame, shader_t *shader, float x, float y) { + shaderUsePosition(shader, x, y, 0, 0, 0, 0); shaderUseTexture(shader, frame->texture); primitiveDraw(&frame->primitive, 0, -1); } diff --git a/src/ui/frame.h b/src/ui/frame.h index 0e11d2c4..9090797d 100644 --- a/src/ui/frame.h +++ b/src/ui/frame.h @@ -41,8 +41,10 @@ void frameSetInnerSize(frame_t *frame, float width, float height); * * @param frame Frame to render. * @param shader Shader to use while rendering. + * @param x X position. + * @param y Y position. */ -void frameRender(frame_t *frame, shader_t *shader); +void frameRender(frame_t *frame, shader_t *shader, float x, float y); /** * Cleanup a previously initialized frame. diff --git a/src/ui/image.c b/src/ui/image.c index 19cd1fe2..78f3d42e 100644 --- a/src/ui/image.c +++ b/src/ui/image.c @@ -8,8 +8,6 @@ #include "image.h" void imageInit(image_t *image, texture_t *texture) { - image->x = 0; - image->y = 0; image->quad.verticeCount = -1; imageSetTexture(image, texture); } @@ -24,8 +22,8 @@ void imageSetTexture(image_t *image, texture_t *texture) { quadInit(&image->quad, 0, 0,0,0,0, texture->width,texture->height,1,1); } -void imageRender(image_t *image, shader_t *shader) { - shaderUsePosition(shader, image->x, image->y, 0, 0, 0, 0); +void imageRender(image_t *image, shader_t *shader, float x, float y) { + shaderUsePosition(shader, x, y, 0, 0, 0, 0); primitiveDraw(&image->quad, 0, -1); } diff --git a/src/ui/image.h b/src/ui/image.h index 5d1673e6..ebe68a8c 100644 --- a/src/ui/image.h +++ b/src/ui/image.h @@ -32,8 +32,10 @@ void imageSetTexture(image_t *image, texture_t *texture); * * @param image Image to render. * @param shader Shader to use while rendering. + * @param x X position. + * @param y Y position. */ -void imageRender(image_t *image, shader_t *shader); +void imageRender(image_t *image, shader_t *shader, float x, float y); /** * Cleanup a previously initialized image. diff --git a/src/ui/label.c b/src/ui/label.c index 0587422f..faf6922d 100644 --- a/src/ui/label.c +++ b/src/ui/label.c @@ -8,8 +8,6 @@ #include "label.h" void labelInit(label_t *label) { - label->x = 0; - label->y = 0; label->fontSize = FONT_SIZE_DEFAULT; label->font = NULL; label->primitive.verticeCount = 0; @@ -26,9 +24,9 @@ void labelSetText(label_t *label, font_t *font, char *text) { fontTextInit(font, &label->primitive, &label->info); } -void labelRender(label_t *label, shader_t *shader) { +void labelRender(label_t *label, shader_t *shader, float x, float y) { if(label->primitive.verticeCount == 0) return; - shaderUsePosition(shader, label->x,label->y,0, 0,0,0); + shaderUsePosition(shader, x,y,0, 0,0,0); shaderUseTexture(shader, &label->font->texture); primitiveDraw(&label->primitive, 0, -1); } diff --git a/src/ui/label.h b/src/ui/label.h index 24583915..fe405a8a 100644 --- a/src/ui/label.h +++ b/src/ui/label.h @@ -29,8 +29,10 @@ void labelSetText(label_t *label, font_t *font, char *text); * * @param label Label to render. * @param shader Shader to use while rendering. + * @param x X position. + * @param y Y position. */ -void labelRender(label_t *label, shader_t *shader); +void labelRender(label_t *label, shader_t *shader, float x, float y); /** * Dispose a previously created label. diff --git a/src/ui/menulist.c b/src/ui/menulist.c index 20d720cb..c68df01b 100644 --- a/src/ui/menulist.c +++ b/src/ui/menulist.c @@ -14,8 +14,6 @@ void _menuListMenuOnSelect(menu_t *menu, menuitem_t *item, uint8_t i, void *u) { } void menuListInit(menulist_t *ml, texture_t *texture) { - ml->x = 0; - ml->y = 0; ml->onSelect = NULL; // Initialize menu @@ -67,33 +65,29 @@ void menuListUpdate(menulist_t *ml, engine_t *engine) { menuUpdate(&ml->menu, engine); } -void menuListRender(menulist_t *ml, shader_t *shader) { +void menuListRender(menulist_t *ml, shader_t *shader, float x, float y) { uint8_t i; - label_t *label; float fontScale; fontScale = fontGetScale(ml->labels->fontSize); // Render the frame - ml->frame.x = ml->x; - ml->frame.y = ml->y; - frameRender(&ml->frame, shader); + frameRender(&ml->frame, shader, x, y); // Render selection box. - ml->selection.x = ml->x + FRAME_BORDER_SIZE; - ml->selection.y = ml->y + FRAME_BORDER_SIZE +( - ml->menu.selected * FONT_LINE_HEIGHT * fontScale - ); ml->selection.width = 100; ml->selection.height = FONT_LINE_HEIGHT * fontScale; - rectangleRender(&ml->selection, shader); + rectangleRender(&ml->selection, shader, + x + FRAME_BORDER_SIZE, + y + FRAME_BORDER_SIZE +ml->menu.selected * FONT_LINE_HEIGHT * fontScale + ); // Render each label. for(i = 0; i < ml->menu.itemCount; i++) { - label = ml->labels + i; - label->x = FRAME_BORDER_SIZE; - label->y = FRAME_BORDER_SIZE + i * FONT_LINE_HEIGHT * fontScale; - labelRender(label, shader); + labelRender(ml->labels + i, shader, + FRAME_BORDER_SIZE, + FRAME_BORDER_SIZE + i * FONT_LINE_HEIGHT * fontScale + ); } } diff --git a/src/ui/menulist.h b/src/ui/menulist.h index 1898d06a..b38bee22 100644 --- a/src/ui/menulist.h +++ b/src/ui/menulist.h @@ -46,8 +46,10 @@ void menuListUpdate(menulist_t *ml, engine_t *engine); * * @param ml Menu list to render. * @param shader Shader to use. + * @param x X position. + * @param y Y position. */ -void menuListRender(menulist_t *ml, shader_t *shader); +void menuListRender(menulist_t *ml, shader_t *shader, float x, float y); /** * Cleanup a previously created menu list. diff --git a/src/ui/rectangle.c b/src/ui/rectangle.c index 1ddedd4a..fff11d1d 100644 --- a/src/ui/rectangle.c +++ b/src/ui/rectangle.c @@ -8,8 +8,6 @@ #include "rectangle.h" void rectangleInit(rectangle_t *rectangle) { - rectangle->x = 0; - rectangle->y = 0; rectangle->width = 32; rectangle->height = 32; textureInit(&rectangle->texture, 1, 1, NULL); @@ -22,14 +20,14 @@ void rectangleSetColor(rectangle_t *rectangle, pixel_t color) { ); } -void rectangleRender(rectangle_t *rectangle, shader_t *shader) { +void rectangleRender(rectangle_t *rect, shader_t *shader, float x, float y) { shaderUsePositionAndScale(shader, - rectangle->x, rectangle->y, 0, + x, y, 0, 0, 0, 0, - rectangle->width, rectangle->height, 1 + rect->width, rect->height, 1 ); - shaderUseTexture(shader, &rectangle->texture); - primitiveDraw(&rectangle->quad, 0, -1); + shaderUseTexture(shader, &rect->texture); + primitiveDraw(&rect->quad, 0, -1); } void rectangleDispose(rectangle_t *rectangle) { diff --git a/src/ui/rectangle.h b/src/ui/rectangle.h index 9a5c3213..b53c0a1e 100644 --- a/src/ui/rectangle.h +++ b/src/ui/rectangle.h @@ -16,6 +16,6 @@ void rectangleInit(rectangle_t *rectangle); void rectangleSetColor(rectangle_t *rectangle, pixel_t color); -void rectangleRender(rectangle_t *rectangle, shader_t *shader); +void rectangleRender(rectangle_t *rect, shader_t *shader, float x, float y); void rectangleDispose(rectangle_t *rectangle); \ No newline at end of file diff --git a/src/vn/conversation/vnconversation.c b/src/vn/conversation/vnconversation.c index ee06a78a..65973247 100644 --- a/src/vn/conversation/vnconversation.c +++ b/src/vn/conversation/vnconversation.c @@ -28,13 +28,16 @@ queueaction_t * vnConversationAdd(vnconversation_t *conversation) { } void vnConversationUpdate(vnconversation_t *convo, engine_t *engine) { - convo->textbox.y = engine->render.height - convo->textbox.height; vnTextBoxUpdate(&convo->textbox, engine); queueUpdate(&convo->actionQueue, engine); } -void vnConversationRender(vnconversation_t *convo, shader_t *shader) { - vnTextBoxRender(&convo->textbox, shader); +void vnConversationRender( + vnconversation_t *convo, engine_t *engine, shader_t *shader +) { + vnTextBoxRender(&convo->textbox, shader, + 0, engine->render.height - convo->textbox.height + ); } void vnConversationDispose(vnconversation_t *convo) { diff --git a/src/vn/conversation/vnconversation.h b/src/vn/conversation/vnconversation.h index 415cb733..e4d85e26 100644 --- a/src/vn/conversation/vnconversation.h +++ b/src/vn/conversation/vnconversation.h @@ -38,9 +38,12 @@ void vnConversationUpdate(vnconversation_t *convo, engine_t *engine); /** * Renders the conversation, mostly just a wrapper for the textbox. * @param convo Conversation to render. + * @param engine Engine to use for rendering. * @param shader Shader to use while rendering. */ -void vnConversationRender(vnconversation_t *convo, shader_t *shader); +void vnConversationRender( + vnconversation_t *convo, engine_t *engine, shader_t *shader +); /** * Dispose the conversation when finished. diff --git a/src/vn/ui/vntextbox.c b/src/vn/ui/vntextbox.c index d2fa2abd..2c6be9cc 100644 --- a/src/vn/ui/vntextbox.c +++ b/src/vn/ui/vntextbox.c @@ -11,7 +11,6 @@ void vnTextBoxInit(vntextbox_t *box, font_t *font, texture_t *texture) { box->font = font; box->widthMax = 400; box->text = NULL; - box->x = 0, box->y = 0; box->linesMax = 3; box->lineCurrent = 0; box->state = 0; @@ -78,15 +77,13 @@ void vnTextBoxUpdate(vntextbox_t *box, engine_t *engine) { box->lineCurrent += box->linesMax; } -void vnTextBoxRender(vntextbox_t *box, shader_t *shader) { +void vnTextBoxRender(vntextbox_t *box, shader_t *shader, float x, float y) { int32_t charStart, charCount; float yOffset; if(box->text == NULL || box->state & VN_TEXTBOX_STATE_CLOSED) return; // Render the debug box. - box->frame.x = box->x; - box->frame.y = box->y; - frameRender(&box->frame, shader); + frameRender(&box->frame, shader, x, y); // Determine where we're rendering the indices up to. charCount = (int32_t)box->textScroll; @@ -116,7 +113,7 @@ void vnTextBoxRender(vntextbox_t *box, shader_t *shader) { // Render the Text Box shaderUsePosition(shader, - box->x + FRAME_BORDER_SIZE, box->y - yOffset + FRAME_BORDER_SIZE, 0, + x + FRAME_BORDER_SIZE, y - yOffset + FRAME_BORDER_SIZE, 0, 0,0,0 ); shaderUseTexture(shader, &box->font->texture); diff --git a/src/vn/ui/vntextbox.h b/src/vn/ui/vntextbox.h index 9ef38317..53299c66 100644 --- a/src/vn/ui/vntextbox.h +++ b/src/vn/ui/vntextbox.h @@ -52,8 +52,10 @@ void vnTextBoxUpdate(vntextbox_t *box, engine_t *engine); * will not be ticked, use update to do this. * @param box Box to render. * @param shader Shader to render to. + * @param x X position. + * @param y Y position. */ -void vnTextBoxRender(vntextbox_t *box, shader_t *shader); +void vnTextBoxRender(vntextbox_t *box, shader_t *shader, float x, float y); /** * Disposes a previously created Visual Novel Text Box. diff --git a/src/vn/vnscene.c b/src/vn/vnscene.c index 4637346b..4d71e41b 100644 --- a/src/vn/vnscene.c +++ b/src/vn/vnscene.c @@ -97,5 +97,5 @@ void vnSceneRenderGui(vnscene_t *scene, engine_t *engine, shader_t *shader) { shaderUseCamera(shader, &scene->camera); // Render Conversation Element - vnConversationRender(&scene->conversation, shader); + vnConversationRender(&scene->conversation, engine, shader); } \ No newline at end of file