
// Project: Object load test 
// Created: 2018-03-03

// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "Object load test" )
SetWindowSize( 1920, 1080, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1920, 1080 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 60, 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

loadobjectwithchildren(1,"soldier fixed.x")
PlayObjectAnimation(1,"",1,5500,1,0)
SetObjectAnimationSpeed(1,25)
SetObjectScalePermanent(1,0.1,0.1,0.1)

do

	if ( GetPointerPressed() )
		startx# = GetPointerX()
		starty# = GetPointerY()
		angx# = GetCameraAngleX(1)
		angy# = GetCameraAngleY(1)
	endif

	if ( GetPointerState() = 1 )
		fDiffX# = (GetPointerX() - startx#)/6.0
		fDiffY# = (GetPointerY() - starty#)/6.0

		newX# = angx# + fDiffY#
		if ( newX# > 89 ) then newX# = 89
		if ( newX# < -89 ) then newX# = -89
		SetCameraRotation( 1, newX#, angy# + fDiffX#, 0 )
	endif
    
	rem Move camera
	if ( GetRawKeyState( 87 ) ) then MoveCameraLocalZ( 1,4)
	if ( GetRawKeyState( 83 ) ) then MoveCameraLocalZ( 1, -4 )
	if ( GetRawKeyState( 65 ) ) then MoveCameraLocalX( 1, -4 )
	if ( GetRawKeyState( 68 ) ) then MoveCameraLocalX( 1, 4 )
	setcameraposition(1,getcamerax(1),10.0,getcameraz(1))

    Print( ScreenFPS() )
    Sync()
loop
