Who would have thought that even simple things could be so hard with 3DGS. After two hours of basic trial and error i came up with this:
#include <acknex.h> // Pure-Mode
#include <default.c> // Standard-Keys
#include <windows.h> // Windows-API-Calls
typedef struct _devicemode {
DWORD dmBitsPerPel;
DWORD dmPelsWidth;
DWORD dmPelsHeight;
DWORD dmDisplayFlags;
DWORD dmDisplayFrequency;
} SCRMODE;
var rvalue = 0;
var xvalue = 0;
PANEL* pan_results =
{
pos_x = 0;
pos_y = 0;
layer = 1;
flags = OVERLAY | VISIBLE;
digits(0, 40, 4, *, 1, rvalue);
digits(0, 60, 4, *, 1, xvalue);
}
function getscreenres()
{
SCRMODE* resolution;
rvalue = EnumDisplaySettings(NULL, 1, resolution);
}
void main()
{
video_mode = 8;
video_screen = 2;
level_load("title.wmb");
wait(1);
getscreenres();
}
At this point I had encountered about three to four dozen SED-Crashes while trying to use printf for small debug outputs.
As far as my code goes right now it seems to work. rvalue returns 1 or 0, depending on how high i set the second parameter of EnumDisplaySettings. Now i wanted to use xvalue to fetch the width of the returned resolution inside my resolution pointer.
This is what I tried:
Version 1:
function getscreenres()
{
SCRMODE* resolution;
rvalue = EnumDisplaySettings(NULL, 1, resolution);
xvalue = resolution->dmPelsWidth;
}
Version 2:
function getscreenres()
{
SCRMODE* resolution;
rvalue = EnumDisplaySettings(NULL, 1, resolution);
xvalue = resolution.dmPelsWidth;
}
Both ended up in Error E1513 "Crash in getscreenres". Any ideas how that could be fixed? I think I'm referencing wrong, but according to the manual it should work.
Again, any help is appreciated.
Patrick