Hi
Do you know how I can fix the bug when I move the viewoffset and the sprite should not be visible (at left), because the spritescissor bug and the sprite is shown, I don't know why
// Project: scissor_zoom
// Created: 2023-08-04
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "scissor_zoom" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // 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
n=CreateSprite(0)
x = 200
y = 200
w = 300
h = 300
SetSpritePosition(n,x,y)
SetSpriteSize(n,w,h)
SetSpriteScissor(n,x,y,x+150,y+150 )
do
Print("move the square on the left and see the scissor change when square is over the left bound of the screen")
mx = WorldToScreenX(getpointerx())
my = WorldToScreeny(getpointery())
if GetPointerPressed()
sx = getpointerx() +viewx
sy = getpointery() +viewy
endif
if GetPointerState()
viewx = sx - GetPointerX()
viewy = sy - GetPointerY()
SetViewOffset(viewx, viewy)
endif
print("viewx/y : "+str(viewx)+"/"+str(viewy))
sync()
loop
AGK2 tier1 - http://www.dracaena-studio.com