-
Notifications
You must be signed in to change notification settings - Fork 0
/
OsWin32.cpp
83 lines (66 loc) · 1.63 KB
/
OsWin32.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
* This file is part of NumptyPhysics
* Copyright (C) 2008 Tim Edmonds
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
*/
#ifdef WIN32
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <SDL/SDL_syswm.h>
#include <windows.h>
class OsWin32 : public Os
{
HICON icon;
HWND hwnd;
public:
OsWin32()
{
HINSTANCE handle = GetModuleHandle(NULL);
icon = LoadIcon(handle, MAKEINTRESOURCE(1));
SDL_SysWMinfo wminfo;
SDL_VERSION(&wminfo.version);
if(SDL_GetWMInfo(&wminfo) != 1) {
//error wrong SDL version
}
hwnd = wminfo.window;
SetClassLong(hwnd, GCL_HICON, (LONG)icon);
}
~OsWin32()
{
DestroyIcon(icon);
}
virtual bool openBrowser( const char* url )
{
//??
return false;
}
};
Os* Os::get()
{
static OsWin32 os;
return &os;
}
const char Os::pathSep = '\\';
/**
* For Windows, we have to define "WinMain" instead of the
* usual "main" in order to get a graphical application without
* the console window that normally pops up otherwise
**/
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
//TODO - pass level args here...
npmain(0,0);
}
#endif