I created a dialog class that will be called in what I call a player class which has all the inputs but I'm having an issue having the dialog draw to the screen when I hit spacebar.
currently, as is , if I hit spacebar a couple of times i see the box flash then disappear then agian until I hit spacebar a couple more times.
EDIT:
It doesnt draw the dialog box from inside the player class but if i call it in the main function it draws the box. The main issue is why it doesnt draw from the player class.
Could you post the code that draws to the screen (where you flip display/tell the dialog box to draw)?
case ALLEGRO_KEY_SPACE: keys[SPACE] = true; SetAwake(true); dialog.CreateDialogBox(10,"something something something"); al_flip_display(); break;
You immediately draw your dialog box and flip the display. You shouldn't be doing any drawing in your logic code.
<quote name="J-Gamer"//">You immediately draw your dialog box and flip the display. You shouldn't be doing any drawing in your logic code.</quote>
How would I create a dialog box triggered by pressing a button then ?
Let the button press toggle or set some variable somewhere. Then on drawing, check that variable and draw the dialog if the variable is set, and don't when it's not set. You can wrap this all in your dialog class though separate on_button and on_draw methods. Hope that helps...
Let the button press toggle or set some variable somewhere. Then on drawing, check that variable and draw the dialog if the variable is set, and don't when it's not set. You can wrap this all in your dialog class though separate on_button and on_draw methods. Hope that helps...
I think my post is a bit misleading. I only put that there to see if it will draw, I dont plan on leaving it there like that. Its not drawing the dialog box at all but when I use the function in the main function it draws the dialog box but not inside that class for some reason
but!
I think that may be the issue, that i need to toggle the function