1
0
Fork 0

Merge pull request 'Fixed a bug when displaying 3 choices.' (#28) from mibi88/Collab_RPG-affichage-dialogues:master into master

Reviewed-on: https://gitea.planet-casio.com/Slyvtt/Collab_RPG/pulls/28
This commit is contained in:
mibi88 2023-08-11 12:31:16 +02:00
commit bbb415df15
3 changed files with 19 additions and 14 deletions

View File

@ -247,8 +247,8 @@ int _choice_call_before_end(Game *game, unsigned int org_i) {
C_BLACK, ">");
dtext(i*choice_size+arrow_width+PXSIZE,
(BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE, C_BLACK,
_choices+pos+i);
pos += strlen(_choices+pos);
_choices+pos);
pos += strlen(_choices+pos)+1;
}
blit();
key = getkey().key;
@ -257,10 +257,10 @@ int _choice_call_before_end(Game *game, unsigned int org_i) {
if(key == KEY_LEFT && selected > 0){
/* Remove the old arrow. */
drect(selected*choice_size+PXSIZE,
(BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE,
selected*choice_size+PXSIZE+arrow_width,
(BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE+arrow_height,
C_WHITE);
(BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE,
selected*choice_size+PXSIZE+arrow_width,
(BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE+arrow_height,
C_WHITE);
/* Move the selection arrow and update the selected item. */
selected--;
@ -270,10 +270,10 @@ int _choice_call_before_end(Game *game, unsigned int org_i) {
else if(key == KEY_RIGHT && selected < _choices_amount-1){
/* Remove the old arrow. */
drect(selected*choice_size+PXSIZE,
(BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE,
selected*choice_size+PXSIZE+arrow_width,
(BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE+arrow_height,
C_WHITE);
(BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE,
selected*choice_size+PXSIZE+arrow_width,
(BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE+arrow_height,
C_WHITE);
/* Move the selection arrow and update the selected item. */
selected++;

View File

@ -5,6 +5,7 @@
#include "config.h"
#include <gint/keyboard.h>
#include <gint/cpu.h>
void game_logic(Game *game) {
// to be done
@ -40,8 +41,12 @@ void get_inputs(Game *game) {
/* Display Debug Information on screen */
#if DEBUGMODE
if(keydown(KEY_F1)) game->debug_map = !game->debug_map;
if(keydown(KEY_F2)) game->debug_player = !game->debug_player;
if(keydown(KEY_F1)) {
game->debug_map = !game->debug_map;
}
if(keydown(KEY_F2)) {
game->debug_player = !game->debug_player;
}
#endif

View File

@ -108,13 +108,13 @@ int main(void) {
dgray(DGRAY_ON);
#endif
/*
showtext_dialog(&game, &player_face_img, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet.", true, true);
int in = showtext_dialog_ask(&game, &player_face_img, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet.", true, false, "Lorem\0Ipsum\0Dolor", 3, 0);
if(in==2) showtext_dialog(&game, &player_face_img, "You choosed Dolor", false, true);
else if(in==1) showtext_dialog(&game, &player_face_img, "You choosed Ipsum", false, true);
else showtext_dialog(&game, &player_face_img, "You choosed Lorem", false, true);
*/
do{
/* clear screen */