win32 ansi functions

This commit is contained in:
Henrique Santiago 2011-03-20 15:15:14 -03:00
parent 466e8bd4cf
commit dab9faab91
1 changed files with 17 additions and 21 deletions

View File

@ -44,7 +44,7 @@ void Platform::init()
{ {
win32.instance = GetModuleHandle(NULL); win32.instance = GetModuleHandle(NULL);
WNDCLASS wc; WNDCLASSA wc;
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Redraw On Size, And Own DC For Window. wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Redraw On Size, And Own DC For Window.
wc.lpfnWndProc = (WNDPROC)WndProc; // WndProc Handles Messages wc.lpfnWndProc = (WNDPROC)WndProc; // WndProc Handles Messages
wc.cbClsExtra = 0; // No Extra Window Data wc.cbClsExtra = 0; // No Extra Window Data
@ -54,9 +54,9 @@ void Platform::init()
wc.hCursor = LoadCursor(NULL, IDC_ARROW); // Load The Arrow Pointer wc.hCursor = LoadCursor(NULL, IDC_ARROW); // Load The Arrow Pointer
wc.hbrBackground = NULL; // No Background Required For GL wc.hbrBackground = NULL; // No Background Required For GL
wc.lpszMenuName = NULL; // We Don't Want A Menu wc.lpszMenuName = NULL; // We Don't Want A Menu
wc.lpszClassName = L"OTClient"; // Set The Class Name wc.lpszClassName = "OTClient"; // Set The Class Name
if(!RegisterClass(&wc)) if(!RegisterClassA(&wc))
fatal("Failed to register the window class."); fatal("Failed to register the window class.");
} }
@ -68,7 +68,7 @@ void Platform::terminate()
} }
if(win32.instance) { if(win32.instance) {
if(!UnregisterClass(L"OTClient", win32.instance)) if(!UnregisterClassA("OTClient", win32.instance))
error("Unregister class failed."); error("Unregister class failed.");
win32.instance = NULL; win32.instance = NULL;
@ -109,18 +109,18 @@ bool Platform::createWindow(int x, int y, int width, int height, int minWidth, i
//AdjustWindowRectEx(&windowRect, dwStyle, FALSE, dwExStyle); //AdjustWindowRectEx(&windowRect, dwStyle, FALSE, dwExStyle);
win32.window = CreateWindowEx(dwExStyle, // Extended Style For The Window win32.window = CreateWindowExA(dwExStyle, // Extended Style For The Window
L"OTClient", // Class Name "OTClient", // Class Name
L"OTClient", // Window Title "OTClient", // Window Title
dwStyle, // Required Window Style dwStyle, // Required Window Style
x, // Window X Position x, // Window X Position
y, // Window Y Position y, // Window Y Position
width, // Calculate Window Width width, // Calculate Window Width
height, // Calculate Window Height height, // Calculate Window Height
NULL, // No Parent Window NULL, // No Parent Window
NULL, // No Menu NULL, // No Menu
win32.instance, // Instance win32.instance, // Instance
NULL); NULL);
if(!win32.window) { if(!win32.window) {
terminate(); terminate();
@ -221,8 +221,7 @@ void Platform::showWindow()
void Platform::setWindowTitle(const char *title) void Platform::setWindowTitle(const char *title)
{ {
// TODO SetWindowTextA(win32.window, title);
SetWindowText(win32.window, (LPCWSTR)title);
} }
void *Platform::getExtensionProcAddress(const char *ext) void *Platform::getExtensionProcAddress(const char *ext)
@ -232,7 +231,6 @@ void *Platform::getExtensionProcAddress(const char *ext)
bool Platform::isExtensionSupported(const char *ext) bool Platform::isExtensionSupported(const char *ext)
{ {
// TODO
const char *exts = NULL;//glXQueryExtensionsString(x11.display, DefaultScreen(x11.display)); const char *exts = NULL;//glXQueryExtensionsString(x11.display, DefaultScreen(x11.display));
if(strstr(exts, ext)) if(strstr(exts, ext))
return true; return true;
@ -241,7 +239,6 @@ bool Platform::isExtensionSupported(const char *ext)
void Platform::showMouseCursor() void Platform::showMouseCursor()
{ {
// TODO
ShowCursor(false); ShowCursor(false);
/*XUndefineCursor(x11.display, x11.window); /*XUndefineCursor(x11.display, x11.window);
if(x11.cursor != None) { if(x11.cursor != None) {
@ -281,7 +278,6 @@ int Platform::getWindowHeight()
const char *Platform::getAppUserDir() const char *Platform::getAppUserDir()
{ {
// TODO
/*std::stringstream sdir; /*std::stringstream sdir;
sdir << PHYSFS_getUserDir() << "/." << APP_NAME << "/"; sdir << PHYSFS_getUserDir() << "/." << APP_NAME << "/";
if((mkdir(sdir.str().c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) && (errno != EEXIST)) if((mkdir(sdir.str().c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) && (errno != EEXIST))