Posté le 09/04/2025 16:26
Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2025 | Il y a 105 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements
Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd
Citer : Posté le 09/04/2025 17:40 | #
I suspect this is a combination of two issues.
First I'm suspecting that the screen isn't "blank", the program does work but since the snake starts in the center and moves 8 pixels per frame it only takes 8 frames for it to go out-of-bounds. Depending on the contrast setting on your calculator this might simply be happening too fast for you to see.
The second part is that you can only use keydown() to check for pressed keys after you've processed events. This confuses a lot of people but it's essential to keep the keyboard API running properly. You can process and discard events by calling clearevents() before starting to check keys:
clearevents();
if(keydown(KEY_MENU)) // ...
}
I would advise to use key names instead of raw numbers. You have all the names in <gint/keycodes.h>.
Also, you're using 1 as the fill color for rectangles, which is weird. This is the light gray color that is only available when the gray mode is enabled. If you don't want to fill the rectangle, use C_NONE.
Citer : Posté le 09/04/2025 18:02 | #
ok i used the key names instead of the numbers and now i can quit to menu but then i cant get back to the program after that, it just quits immediately, should i be quitting the program in a different way?
Citer : Posté le 09/04/2025 18:05 | #
Yes, if you want to be able to go back, you should call gint_osmenu() instead.
if(keydown(KEY_MENU)) gint_osmenu();
This will send you back to the main menu (on models where it's supported—the G-III is one of them) and allows coming back to resume execution where you left off. If you leave main(), then you obviously can't continue. You can call gint_setrestart(1) which will allow the add-in to be selected again in this situation, but then you'll start again from the beginning of the program.
Citer : Posté le 09/04/2025 18:07 | #
okay thanks, gint_setrestart(1) is by default 0?
Citer : Posté le 09/04/2025 18:09 | #
Yes, it's disabled by default because it's a bit of a hack.
Citer : Posté le 09/04/2025 18:13 | #
i have another problem, when i quit the program (with gint_osmenu();) once, and come back to it any button i press quits it again
Citer : Posté le 09/04/2025 20:16 | #
ill try changing the clearevent thing to different places