Just wondering how many Retro Remake forum regulars are here now? I've seen one or two new names here in GLB land that I recognise 
Sign in..
Andy H (Ovine)

Sign in..
Andy H (Ovine)
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuTYPE TEST
t = RGB(255,255,255)
ENDTYPE
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.7.029 SN:4cca05d9 - 3D, NET
"second file.gbas"(7) error : command not inside function or sub
FUNCTION QSIN: x
WHILE x>360.0; DEC x, 360.0; WEND
WHILE x<0; INC x, 360.0; WEND
IF x>180.0 THEN x = 180.0-x
x = x/57.296
x = 1.2732 * x -0.4053 * x * ABS(x)
x = 0.225*(x*ABS(x)-x)+x
RETURN x
ENDFUNCTION
FUNCTION QCOS: x
RETURN QSIN(x+90)
ENDFUNCTION
INLINE
float qInvSqrt(float x){
float xhalf = 0.5f * x;
int i = *(int*)&x; // store floating-point bits in integer
i = 0x5f3759d5 - (i >> 1); // initial guess for Newton's method
x = *(float*)&i; // convert new bits into float
x = x*(1.5f - xhalf*x*x); // One round of Newton's method
return x;
}
ENDINLINE
FUNCTION QSQR: y
INLINE
return 1.0f / qInvSqrt(y);
ENDINLINE
ENDFUNCTION
SETSCREEN 640,480,0
LIMITFPS 60
BLACKSCREEN
LOADSPRITE "achannel.png",0
WHILE TRUE
LOCAL x,y,a,b
IF KEY(2) THEN ALPHAMODE -1
IF KEY(3) THEN ALPHAMODE 1
DRAWRECT 105,105,100,10, RGB(0,0,255)
MOUSESTATE x,y,a,b
DRAWSPRITE 0, x,y
DRAWSPRITE 0,100,100
SHOWSCREEN
WEND
By default, the alpha channel on the red circle is ignored. If shows a solid circle. Hold 1 on the keyboard to apply the alphamode of -1 and the alpha channel works. Is this correct or should alphamode 0 also work?
TYPE tInput
x;y // x and y values
fire // firebutton
lx;ly // last x and y pressed flags (for key+joy) 0 =not pressed, 1=just pressed, 2=held down state
lfire // fire last pressed flag
mx;my // mouse pos
ma;mb // mouse buttons
ENDTYPE
// all these globals are stored in a game type but I've extracted them to separate globals here for simplicity
GLOBAL inp as tInput
GLOBAL devices$
devices$ = PLATFORMINFO$("DEVICE")
GLOBAL numjoy
numjoy = GETNUMJOYSTICKS()
GetAllInputs( inp )
// now can test values in inp.x, inp.y for example, inp.mx and inp.my for mouse
// lx, ly, lfire contain 1 if direction x / y / firebutton just pressed, or 2 if currently held
FUNCTION GetAllInputs: inp AS tInput
LOCAL vx, xx,yy, ff, i, kf
xx=0
yy=0
ff=0
kf=0
IF devices$<>"POCKETPC"
IF numjoy>0
xx=GETJOYX(0)
yy=GETJOYY(0)
FOR i=0 TO 3
IF GETJOYBUTTON(0,i) THEN ff=1
NEXT
ENDIF
IF KEY(29) OR KEY(57) THEN kf=1
ENDIF
IF KEY(28) THEN kf=1
// if XX val returned not moved, check for keys instead
IF xx>=-0.1 AND xx<=0.1
xx=0
IF KEY(203) THEN xx=-0.5
IF KEY(205) THEN xx=0.5
IF kf=1
xx=xx*2
ff=1
ENDIF
ENDIF
// if YY val returned not moved, check for keys instead
IF yy>=-0.1 AND yy<=0.1
yy=0
IF KEY(200) THEN yy=-0.5
IF KEY(208) THEN yy=0.5
IF kf=1
yy=yy*2
ff=1
ENDIF
ENDIF
inp.x=xx
inp.y=yy
inp.fire=ff
IF inp.x <> 0
IF inp.lx < 2 THEN INC inp.lx,1
ELSE
inp.lx=0
ENDIF
IF inp.y <> 0
IF inp.ly < 2 THEN INC inp.ly,1
ELSE
inp.ly=0
ENDIF
IF inp.fire <> 0
IF inp.lfire < 2 THEN INC inp.lfire,1
ELSE
inp.lfire=0
ENDIF
MOUSESTATE inp.mx, inp.my, inp.ma, inp.mb
ENDFUNCTION
RESTORE -label-
READ a|a$[ , ... ]
DATA constant|constant$[ , ... ]
xx=GETJOYX(0)
yy=GETJOYY(0)
FOR i=0 TO 3
IF GETJOYBUTTON(0,i) THEN ff=1
NEXT
I loose a lot. With all the above tests it goes from 28 FPS down to 15 FPS. Seems a steep drop. I get the best improvement if I take the Joystick tests out. I don't think the PocketPC is returning any values back from this anyway as the PPC's joypad+buttons seem to be detectable by keys only. Doing the keyboard tests only (the cursor keys and fire) brings the FPS down to 22.WHILE ENDOFFILE(1) = FALSE
READLINE 1,strLine$
However I'm having problems. I've converted my text file to UTF-8 and this lets me load it in (I think the default was a unicode format and READLINE returned nothing). However a conversion is done - this is what I see in the debugger: