Calling an .exe function in the SDK

Afforess

The White Wizard
Joined
Jul 31, 2007
Messages
12,239
Location
Austin, Texas
I want to scale some things based on screen-size, and I have used getXResolution () and getYResolution () in the python files. Is there any way to call these in the SDK (specifically, in the CvGameTextMgr), and get the return value? I searched all the files, but I couldn't find any reference to these, and the PythonAPI lists these as EXE functions.
 
You could try doing it as a ::getXResolution() call, but I doubt that would work. If just flat out using it doesn't help either, then you can cheat by creating a python function which will return the result of those functions and calling them from the DLL (so DLL calls python, which calls EXE, and then responses go back... convoluted, but works)
 
You could try doing it as a ::getXResolution() call, but I doubt that would work. If just flat out using it doesn't help either, then you can cheat by creating a python function which will return the result of those functions and calling them from the DLL (so DLL calls python, which calls EXE, and then responses go back... convoluted, but works)

Oh goody, that sounds like it will make loading my screens even slower. So ridiculous. Firaxis could have given us a list of EXE functions and ways to call them at least... :mad:
 
You could try doing it as a ::getXResolution() call, but I doubt that would work. If just flat out using it doesn't help either, then you can cheat by creating a python function which will return the result of those functions and calling them from the DLL (so DLL calls python, which calls EXE, and then responses go back... convoluted, but works)

That worked Xienwolf, I added some new functions to CvGame, called them in python and set the values there. Thanks for the help, I just wish there was a cleaner way to do it...
 
Instead of calling it each time you use it in the DLL, make it a variable in CvGame, and during CvGame::init ask Python for the resolution and store it in the variable. Then try to find somewhere in python that is activated whenever the resolution is changed (In CvMainInterface.py I think you'll find something which is executed to redraw the screen on resolution change. If not, then make a global variable to hold the X and Y resolution values, and in the update function for the file check the global values against the EXE query to ensure they are unchanged) and update the DLL from python.
 
Instead of calling it each time you use it in the DLL, make it a variable in CvGame, and during CvGame::init ask Python for the resolution and store it in the variable. Then try to find somewhere in python that is activated whenever the resolution is changed (In CvMainInterface.py I think you'll find something which is executed to redraw the screen on resolution change. If not, then make a global variable to hold the X and Y resolution values, and in the update function for the file check the global values against the EXE query to ensure they are unchanged) and update the DLL from python.

That's similar to what I did. The python is only called when the game initializes or a save is loaded. I figure that the average user won't resize the screen while running the game, and the resolution isn't used for anything real major, regardless.
 
Top Bottom