Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / [SOLVED] DeleteVirtualButton() is broken

Author
Message
Wilf
Valued Member
17
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 30th May 2019 13:18
AGK 2019.05.22
AGKS Scene Editor v0.95

The autogenerated code in _cleanup() fails to delete Virtual buttons, resulting in an error message if you use SetErrorMode(2) and a failure to draw any Virtual Buttons after attempting to delete/recreate them if you use SetErrorMode(0)

See the attached project (It's an amended version of Imagination Engineers Scene Template project)
1. Run the exe
2. Press the Start virtual button
3. On the second screen, press the Orange back button or press Escape

Quote: "
Error Message:
---------------------------
Message
---------------------------
Error: Cannot add virtual button 1, a virtual button already exists at that index in title.scene at line 42
---------------------------
OK
---------------------------
"


This button should have been deleted when moving from title.scene to game.scene via title_cleanup(), ready to be created again in title_setup()

I think this is a bug in AppGameKit Core, not Studio; if I replace the virtual buttons with sprites and do a GetSprite() hit to simulate them as buttons, it works.

Can anyone confirm?

Attachments

Login to view attachments

The author of this post has marked a post as an answer.

Go to answer

Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 30th May 2019 14:30 Edited at: 30th May 2019 14:31
This post has been marked by the post author as the answer.
Hi Wilf

The problem is actually in your main code.... if you move where you are calling game_sync() to above where you clean it up then the program works fine.

Its because you clean up the game screen then call game_sync() after which creates it again....lol

There is no need to do alot of the setup code that your doing as the title_sync() and game_sync() functions setup those scenes for you.

Infact you dont need to call the setup functions at all if your calling the sync() functions. Take a look at the code inside the scene files and it handles setup for you with very similarly named variables.
Wilf
Valued Member
17
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 30th May 2019 14:41
Ach, you're right Bengismo Thanks !

Login to post a reply

Server time is: 2024-03-29 06:21:25
Your offset time is: 2024-03-29 06:21:25