Announcement

Collapse
No announcement yet.

How to Refresh the GUI?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to Refresh the GUI?

    Hello everyone,

    I'd like to be able to refresh the entire GUI (as if you had Alt+Tabbed out of and back into the game). I've found the Refresh() and InvalidateMap() members of the TiledMap class, but as far as I can tell, these only cause the map itself to be redrawn.

    Does anyone know where I can look in the code to figure out how to redraw the entire GUI?

    Thanks.

  • #2
    hmmm. Never thought about doing it. But I think its broken down throughout the interface (thats the folder name) files because the different GUI's have methods called update (or updateXXX, etc) they refreshed the maps.

    But if your looking to do this don't forget to have the slic reloaded as well.

    I'd say scenarioeditor.cpp might be the best start and if you figure that one out let me know. it confused me.
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

    Comment


    • #3
      Originally posted by E
      But if your looking to do this don't forget to have the slic reloaded as well.

      I'd say scenarioeditor.cpp might be the best start and if you figure that one out let me know. it confused me.
      What has this to do with redrawing the GUI? That is game related stuff or GUI-design related and not about the graphic engine.

      By the way erasmus why do you want to refresh the GUI?
      Civ2 military advisor: "No complaints, Sir!"

      Comment


      • #4
        Originally posted by Martin Gühmann
        By the way erasmus why do you want to refresh the GUI?
        Well, to make a long story short:
        I'm trying to write an external agent to control the actions of a player. For a time I was doing this by Alt+Tabbing out of CTP2 into another program, manually entering the actions into my external agent, and then Alt+Tabbing back into CTP2. Everything worked fine when playing the game like that.

        Recently however, I've been making the agent send actions automatically without any human intervention, so you could just watch the agent play the game on its own. However, after a few turns I start seeing assertion errors in GUI related files (like aui_imagelist.cpp and aui_bitmapfont.cpp). As a test I modified my agent to require user input before ending the turn (forcing me to Alt+Tab out of and back into the program, and hence make the game redraw the entire GUI each turn), and the assertion errors stopped.

        This leads me to believe that if I can manually refresh the entire GUI at the start of every turn, I can run my agent without human intervention, and thus not get any GUI-related assertion errors.

        Granted, there may be a more efficient way to solve this problem, but this seemed like an easy to implement, brute force solution.

        That's probably a bit more information than you cared for , but any way you can think of to help me is appreciated.

        Thanks.

        Comment


        • #5
          I don't have the code in front of me right now but what you can do is to search in the code for something like RefreshUI (RefreshGUI) or UpdateUI or something like that. And by searching I mean that you use the windows search function.

          If this doesn't help you could insert an Asser(false); somewhere in the code that handels some part of the GUI drawing. This way the debug version can write into the logfile the call stack trace of the function where you put the code in. Some function in that stack hould be the one you are looking for.

          -Martin
          Civ2 military advisor: "No complaints, Sir!"

          Comment

          Working...
          X