Having issues with the GetRawTouchCurrentX/Y commands while using a window on a PC. The point reported by the command is relative to the window's outside border and not to the actual canvas screen. If you run the below and touch anywhere within the window, you will see that the box will be offset. The upper left corner should be under your finger. It works fine in full screen mode and on my android.
// Project: test
// Created: 2018-04-07
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "test" )
SetWindowSize( 800, 600, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 800, 600 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
SetVSync(1)
sprite = CreateSprite(0)
SetSpriteSize(sprite,200,200)
SetSpriteColor(sprite,0,0,255,255)
x as float
y as float
worldx as float
worldy as float
do
if GetRawKeyPressed(27) = 1 then exit
event = GetRawFirstTouchEvent(1)
if event <> 0
x = GetRawTouchCurrentX(event)
y = GetRawTouchCurrentY(event)
worldx = ScreenToWorldX(x)
worldy = ScreenToWorldY(y)
setspriteposition(sprite,worldx,worldy)
endif
print(str(x)+", "+str(y))
Sync()
loop
As you can see from the pic attached, the point 0,0 is actually on the outside edge of the title bar and windows border.