The problem seems to be with the "AddVirtualButton" command, or so it would seem. This code is from "HandsOnAGK" by Alistair Stewart. No matter what I try I can't seem to get the buttons to line up correctly at the top right of the screen. I could do this previously by editing the "setup.agc" file, but it no longer exists.
function SetUpButtons()
rem *** Load atlas image ***
LoadImage(99,"Buttons.png")
rem *** Load subimages used ***
for id = 1 to 24 step 2
LoadSubImage(id,99,Str(id/2+1)+"Up.png")
LoadSubImage(id+1,99,Str(id/2+1)+"Down.png")
next id
rem *** Set up virtual buttons ***
for id = 1 to 12
AddVirtualButton(id,95,4+(id-1)*7,4)
SetVirtualButtonImageUp(id,(id-1)*2+1)
SetVirtualButtonImageDown(id,id*2)
next id
endfunction
Here is the code I am using where I call the function:
SetScreenResolution(768,1024,0)
#include "Buttons.agc"
SetUpButtons()
sync()
do
valueEntered = GetButtonEntry()
PrintC("You entered ")
Print(valueEntered)
// PrintC("FPS : ")
// Print( ScreenFPS() )
Sync()
sleep(2000)
loop
Windows 7 Home Premium 64-bit SP1
AMD FX-4100 Quad Core 3.6Ghz 8.0GB
NVidia GeForce GT 520 2GB