141
/* maximum size possible (if there) */
142
int dr_query_screen_width()
144
#if SDL_VERSIONNUM(SDL_MAJOR_VERSION,SDL_MINOR_VERSION,SDL_PATCHLEVEL)>=1210
145
const SDL_VideoInfo *vi=SDL_GetVideoInfo();
146
return vi->current_w;
149
return GetSystemMetrics( SM_CXSCREEN );
152
modi = SDL_ListModes (NULL, SDL_FULLSCREEN );
153
if (modi == NULL || modi == (SDL_Rect**)-1 ) {
166
int dr_query_screen_height()
168
#if SDL_VERSIONNUM(SDL_MAJOR_VERSION,SDL_MINOR_VERSION,SDL_PATCHLEVEL)>=1210
169
const SDL_VideoInfo *vi=SDL_GetVideoInfo();
170
return vi->current_h;
173
return GetSystemMetrics( SM_CYSCREEN );
176
modi = SDL_ListModes (NULL, SDL_FULLSCREEN );
177
if (modi == NULL || modi == (SDL_Rect**)-1 ) {
138
resolution dr_query_screen_resolution()
141
#if SDL_VERSION_ATLEAST(1, 2, 10)
142
SDL_VideoInfo const& vi = *SDL_GetVideoInfo();
143
res.w = vi.current_w;
144
res.h = vi.current_h;
146
res.w = GetSystemMetrics(SM_CXSCREEN);
147
res.h = GetSystemMetrics(SM_CYSCREEN);
149
SDL_Rect** const modi = SDL_ListModes(0, SDL_FULLSCREEN);
150
if (modi && modi != (SDL_Rect**)-1) {
192
166
// open the window
193
int dr_os_open(int w, int h, int bpp, int fullscreen)
167
int dr_os_open(int w, int const h, int const fullscreen)
195
169
Uint32 flags = sync_blit ? 0 : SDL_ASYNCBLIT;
217
191
// open the window now
218
screen = SDL_SetVideoMode(w, h, bpp, flags);
192
screen = SDL_SetVideoMode(w, h, COLOUR_DEPTH, flags);
219
193
if (screen == NULL) {
220
194
fprintf(stderr, "Couldn't open the window: %s\n", SDL_GetError());
253
227
// resizes screen
254
int dr_textur_resize(unsigned short** textur, int w, int h, int bpp)
228
int dr_textur_resize(unsigned short** const textur, int w, int const h)
257
231
SDL_UnlockSurface(screen);
275
screen = SDL_SetVideoMode(w, h, bpp, flags);
249
screen = SDL_SetVideoMode(w, h, COLOUR_DEPTH, flags);
276
250
printf("textur_resize()::screen=%p\n", screen);
278
252
DBG_MESSAGE("dr_textur_resize(SDL)", "SDL realized screen size width=%d, height=%d (requested w=%d, h=%d)", screen->w, screen->h, w, h);
293
// query home directory
294
char *dr_query_homedir(void)
296
static char buffer[PATH_MAX];
299
DWORD len=PATH_MAX-24;
301
if(RegOpenKeyExA(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", 0, KEY_READ, &hHomeDir)==ERROR_SUCCESS) {
302
RegQueryValueExA(hHomeDir,"Personal",NULL,NULL,(BYTE *)buffer,&len);
303
strcat(buffer,"\\Simutrans");
304
CreateDirectoryA( buffer, NULL );
305
strcat(buffer, "\\");
307
// create other subdirectories
308
sprintf(b2, "%ssave", buffer );
309
CreateDirectoryA( b2, NULL );
310
sprintf(b2, "%sscreenshot", buffer );
311
CreateDirectoryA( b2, NULL );
312
sprintf(b2, "%smaps", buffer );
313
CreateDirectoryA( b2, NULL );
320
sprintf( buffer, "%s/.simutrans", getenv("HOME") );
322
sprintf( buffer, "%s/Library/Simutrans", getenv("HOME") );
324
int err = mkdir( buffer, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH );
325
if(err && err!=EEXIST) {
326
// could not create directory
327
// we assume success anyway
329
strcat( buffer, "/" );
330
sprintf( b2, "%smaps", buffer );
332
sprintf( b2, "%sscreenshot", buffer );
334
sprintf( b2, "%ssave", buffer );
342
266
unsigned short *dr_textur_init()
432
// try saving png using gdiplus.dll
433
extern "C" int dr_screenshot_png(const char *filename, int w, int h, int max_width, unsigned short *data, int bitdepth );
436
355
* Some wrappers can save screenshots.
437
356
* @return 1 on success, 0 if not implemented for a particular wrapper and -1
592
511
case SDLK_PAGEUP: code = '>'; break;
593
512
case SDLK_RIGHT: code = SIM_KEY_RIGHT; break;
594
513
case SDLK_UP: code = SIM_KEY_UP; break;
514
case SDLK_PAUSE: code = 16; break;
597
517
if (event.key.keysym.unicode != 0) {
724
BOOL APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR lpCmdLine, int /*nShowCmd*/)
644
int CALLBACK WinMain(HINSTANCE const hInstance, HINSTANCE, LPSTR, int)
726
646
int main(int argc, char **argv)
732
char pathname[PATH_MAX];
734
// prepare commandline
736
GetModuleFileNameA( hInstance, pathname, 1024 );
737
argv[argc++] = pathname;
738
p = strtok(lpCmdLine, " ");
741
p = strtok(NULL, " ");
650
int const argc = __argc;
651
char** const argv = __argv;
653
GetModuleFileNameA(hInstance, pathname, lengthof(pathname));
744
655
#elif !defined __BEOS__
745
656
# if defined(__GLIBC__) && !defined(__AMIGA__)
746
657
/* glibc has a non-standard extension */