Anyone here familiar with the G4P by Quarks?

Can anyone help me figure out how to remove the stuff placed in the window generated by the G4P GUI Tool? I want to create a main menu for a game using this tool and then when a button is clicked (Whether it be the play button or the options button) I will be able to clear the window of all the stuff already there and draw a new set of stuff from the tool, or maybe just draw things straight from processing? Can't seem to figure out how to do this.

Thanks!

Answers

  • Answer ✓

    If you want to remove a control permanently then use markForRemoval for example if you have a button called btnDoThis then

    btnDoThis.markForRemoval();
    btnDoThis = null; // ensure release of resources used by the button
    

    alternatively simply make the control invisible e.g.

    btnDoThis.setVisible(false);

    which has the advantage of being able to reuse it by making it visible again.

    BTW I have moved this discussion to Question about Libraries

  • edited April 2014

    OMG Thanks! That actually helped ALOT... I was looking for something like that but couldn't find it in the reference page.

    Also, Can you help me out with the Sprites? I am trying to figure out how to switch the Sprites to a different drawing mode? Like CORNER/CORNERS/CENTER... I could not figure out how to do that either.

    Thanks

  • Answer ✓

    OMG Thanks! That actually helped ALOT... I was looking for something like that but couldn't find it in the reference page.

    Check the GAbstractControl class doces since all G4P controls inherit from this class so it holds most of the basic methods for controls. The other class to check out is G4P, some nifty global methods there e.g. G4P.setGlobalAlpha(...) to change the transparency for all controls.

    Sprites library

    For various practical reasons ALL sprites are positioned on their centre. There is no provision in the library to set their position based on their corners.

  • AH Alright, I guess I'll stick to what I'm doing and place them with an offset. Thanks for the help!

  • Hmmm.... I'm attempting to use markForRemoval() but getting a "The Function markForRemoval() does not exist" message.

    Has this been replaced by another function in more recent versions?

    I'm attempting to be more mindful of memory usage, so I'm wanting to create specific GUI assets on the fly.... and then removing them on an as needed basis.

  • Doing a couple like-named searches in the documentation, I found that "markForRemoval" had been renamed "markForDisposal" --- works as expected!

Sign In or Register to comment.