Interestingly, I have an issue with QueryKeys as referenced in the other thread.
Here is a quick hacked-as-hell program where Querykeys works on the classic machine, but nothing on my X1000. In all cases, GetKey works.
/* GetKey: gcc -D__USE_INLINE__ -DGK -o main main.c -lauto
QueryKeys: gcc -D__USE_INLINE__ -DQK -o main main.c -lauto */
#if defined __amigaos4__
#define INTUITION_PRE_V36_NAMES
#include <intuition/iobsolete.h>
#endif
#include <proto/graphics.h>
#include <proto/lowlevel.h>
#include <proto/intuition.h>
#include <proto/exec.h>
struct NewWindow nw={
100,100,200,100,NULL,NULL,
CLOSEWINDOW,
ACTIVATE|WINDOWCLOSE|SIMPLE_REFRESH,
NULL, NULL,
"rjd324_W_A_S_D",
NULL, NULL, 0, 0, 0, 0, WBENCHSCREEN
};
struct Window *window;
UBYTE W[2]={ 'W', 0 };
UBYTE A[2]={ 'A', 0 };
UBYTE S[2]={ 'S', 0 };
UBYTE D[2]={ 'D', 0 };
struct IntuiText w={1, NULL, JAM1, 0, 0, NULL, W, NULL};
struct IntuiText a={1, NULL, JAM1, 0, 0, NULL, A, NULL};
struct IntuiText s={1, NULL, JAM1, 0, 0, NULL, S, NULL};
struct IntuiText d={1, NULL, JAM1, 0, 0, NULL, D, NULL};
struct KeyQuery q[4] = { { 0x0011, 0 }, { 0x0020, 0 }, { 0x0021, 0 }, { 0x0022, 0 } };
int main(void) {
window=(struct Window*)OpenWindow(&nw);
if(!window)
{
goto ENDER;
}
{
SetAPen(window->RPort,0);
while(1) {
#if defined (QK)
QueryKeys(q, 4u);
if(q[0].kq_Pressed){
PrintIText(window->RPort,&w,100,40);
} else {
RectFill(window->RPort,95,35,115,55);
}
if(q[1].kq_Pressed){
PrintIText(window->RPort,&a,25,80);
} else {
RectFill(window->RPort,20,75,40,95);
}
if(q[2].kq_Pressed){
PrintIText(window->RPort,&s,100,80);
} else {
RectFill(window->RPort,95,75,115,95);
}
if(q[3].kq_Pressed){
PrintIText(window->RPort,&d,175,80);
} else {
RectFill(window->RPort,170,75,190,95);
}
#elif defined (GK)
ULONG k = GetKey();
if(k==0x0011){
PrintIText(window->RPort,&w,100,40);
} else {
RectFill(window->RPort,95,35,115,55);
}
if(k==0x0020){
PrintIText(window->RPort,&a,25,80);
} else {
RectFill(window->RPort,20,75,40,95);
}
if(k==0x0021){
PrintIText(window->RPort,&s,100,80);
} else {
RectFill(window->RPort,95,75,115,95);
}
if(k==0x0022){
PrintIText(window->RPort,&d,175,80);
} else {
RectFill(window->RPort,170,75,190,95);
}
#else
#error "Please define QK or GW"
#endif
struct IntuiMessage *msg= GetMsg(window->UserPort);
if(msg) {
if( msg->Class==CLOSEWINDOW){ ReplyMsg(msg);
break;
}
ReplyMsg(msg);
}
}
ENDER:
if(window) CloseWindow(window);
return 0;
}
}
Edited by rjd324 on 2022/1/10 21:45:08