Posté le 23/05/2025 20:35
Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2025 | Il y a 106 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 23/05/2025 20:36 | #
Can you please provide a small example that showcases the issue? Do you call Bdisp_PutDisp_DD() every redraw?
Citer : Posté le 23/05/2025 21:29 | #
Hi
#include <fxcg/rtc.h>
#include <fxcg/keyboard.h>
void main(void) {
int flashState = 1;
int lastTick = RTC_GetTicks();
int key;
Bdisp_AllClr_VRAM();
while (1) {
GetKey(&key);
if (key == KEY_CTRL_MENU) break;
int currentTick = RTC_GetTicks();
if (currentTick - lastTick >= 100) {
flashState = !flashState;
lastTick = currentTick;
char color1 = TEXT_COLOR_WHITE;
char color2 = TEXT_COLOR_WHITE;
int flags = SAF_BATTERY;
if (flashState)
flags |= SAF_SETUP_COMPLEX_MODE;
DefineStatusAreaFlags(3, flags, &color1, &color2);
DisplayStatusArea();
}
}
}
This is code for Real flashing in the status bar I was having difficulties reproducing a small bit of code which shows the similar affect of (GAME OVER!) for some reason however this shows the same affect the flashing only takes place when holding any button on the calc but does not flash if you don't hold a button down.
Citer : Posté le 23/05/2025 21:55 | #
Well that would be because of GetKey(). This function pauses the program until you press something. You can't have anything real-time if that function is in your loop, as it will pause your fun effects. Now if you press an arrow key GetKey() will repeat it, which means it will return once when you press it, and when you call GetKey() again at the next iteration of the loop without releasing the key it will return again after a delay. However even in this "favorable" case GetKey() still decides how long it takes for the repeat to count (125 ms I think?) so you're limited in speed (to 8 FPS).
The proper way to deal with this situation is to use a different function for key input, such as IsKeyDown().
Citer : Posté le 23/05/2025 23:00 | #
Do you know where I can find more about IsKeyDown(). as its not on PrizmSDK wiki
Citer : Posté le 23/05/2025 23:48 | #
Ah, it seems libfxcg doesn't have that particular function. Well you can use GetKeyWait_OS with no waiting or PRGM_GetKey_OS which is a bit more convenient but has a different keycode numbering. There is a variant called PRGM_GetKey which does mostly the same thing.
Citer : Posté le 31/05/2025 18:30 | #
I am having issues with this again as GetyKeyWait_OS interferes with text input is there a way to use IsKeyDown() ?
Citer : Posté le 01/06/2025 13:08 | #
Can you be more specific with the interference?
Citer : Posté le 01/06/2025 13:45 | #
#include <fxcg/rtc.h>
#include <fxcg/keyboard.h>
#include <stdlib.h>
#define KEYWAIT_HALTON_TIMERON 2
#define MENU_MATRIX_CODE 0x0409
void main(void) {
int flashState = 1;
int lastTick = RTC_GetTicks();
char *buffer = (char*)malloc(256);
int start = 0;
int cursor = 0;
buffer[0] = '\0';
Bdisp_AllClr_VRAM();
DrawFrame(0);
DisplayMBString((unsigned char*)buffer, start, cursor, 1, 1);
Bdisp_PutDisp_DD();
while (1) {
int col = 0, row = 0;
unsigned short keycode = 0;
int result = GetKeyWait_OS(&col, &row, KEYWAIT_HALTON_TIMERON, 0, 1, &keycode);
if (result == 1) {
unsigned short matrixCode = (col << 8) | row;
if (matrixCode == MENU_MATRIX_CODE) {
break;
}
int key = (int)keycode;
if (key && key < 30000) {
cursor = EditMBStringChar((unsigned char*)buffer, 256, cursor, key);
} else {
EditMBStringCtrl((unsigned char*)buffer, 256, &start, &cursor, &key, 1, 1);
}
DisplayMBString((unsigned char*)buffer, start, cursor, 1, 1);
}
int currentTick = RTC_GetTicks();
if (currentTick - lastTick >= 100) {
flashState = !flashState;
lastTick = currentTick;
char color1 = TEXT_COLOR_WHITE;
char color2 = TEXT_COLOR_WHITE;
int flags = SAF_BATTERY;
if (flashState)
flags |= SAF_SETUP_COMPLEX_MODE;
DefineStatusAreaFlags(3, flags, &color1, &color2);
DisplayStatusArea();
Bdisp_PutDisp_DD();
}
}
free(buffer);
Bdisp_AllClr_VRAM();
Bdisp_PutDisp_DD();
}
Well I was assuming it does I should not have said that it does, Anyway as you can see this code is suppose to allow me to type and uses GetKeyWait_OS to keep Real flashing forever like you suggested to use and then using the Reading Input tutorial on the PrizmSDK I implemented basic key input (https://prizm.cemetech.net/Tutorials/Reading_Input/) however when typing nothing happens neither does the cursor flash.
Citer : Posté le 02/06/2025 12:24 | #
This looks fine to me from the outside... I'd like to run the program to test it. Any chance you can provide a full project folder with Makefile/etc?
Citer : Posté le 02/06/2025 17:02 | #
For this is all the code I used for testing what I did was just use the example project on PrizmSDK modified the default code with that and used the default Makefile that's given I did not touch it has they recommend not to. Then ran .\make by opening terminal for this folder which I am sure you know how to do.