Hey,
I want to create a simple desktop game in HD, I'm using 1920x1080 as base resolution.
I'm using the new "scenes" tool by AppGameKit Studio, but the scenes script always overwrite the Display settings.
Here is my main code:
// Created: 20-02-25
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "WTFisthis" )
SetWindowSize( 1920, 1080, 1)
SetWindowAllowResize( 0 )
//TODO FULLSCREEN
// 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 )
// Include all Scenes
#include "menu.agc"
#include "menu.scene"
#include "test2.scene"
#include "test2.agc"
// Include fundamentals
#include "SceneManager.agc"
// Load FirstScene
ChangeScene("menu")
// Main Loop
do
Print( ScreenFPS() )
UpdateScene()
Sync()
loop
I'm changing my scenes with this function:
function ChangeScene(newScene as string)
currentScene = newScene
CleanAllScenes()
if currentScene = "menu"
Menu_setup()
menu_init()
elseif currentScene = "test2"
Test2_setup()
test2_init()
endif
endfunction
Now after changing the scene, the scene script has it's own unchangeable display settings:
function menu_setup()
if menu_loaded = 1 then exitfunction
menu_loaded = 1
if menu_change_window = 1
SetVirtualResolution(menu_base_width,menu_base_height)
SetWindowSize(menu_device_width,menu_device_height,0)
SetClearColor(0,0,0)
endif
SetPhysicsWallTop(1)
SetPhysicsWallBottom(1)
SetPhysicsWallLeft(1)
SetPhysicsWallRight(1)
menu_images[1] = LoadImage("logoanim/frame-0.png")
menu_images[2] = LoadImage("943148.jpg")
menu_sprites[1] = CreateSprite( menu_images[1] )
menu_1 = menu_sprites[1]
SetSpritePosition(menu_sprites[1],0.643232,-158.231171)
SetSpriteSize(menu_sprites[1],525.678345,486.739227)
SetSpriteDepth(menu_sprites[1],5000)
menu_sprites[2] = CreateSprite( menu_images[2] )
SetSpritePosition(menu_sprites[2],-0.000000,-0.000000)
SetSpriteSize(menu_sprites[2],1024.000000,768.000000)
SetSpriteDepth(menu_sprites[2],10000)
endfunction
What is the correct way to setup scenes without changing the initial display setup?
Regards