Mercurial > sdl-ios-xcode
comparison EXCLUDE/GLTSF/src/Window.cpp @ 4734:0c7c67d4e6ee
Added On_Char method to Window_Listener for WM_CHAR messages.
Removed a lot of TSF code because part of it was wrong and part was too complicated.
Added Clear method to clear the window.
IME input should work in both windowed mode and fullscreen mode with these changes.
I have tested on Windows XP SP3 and Windows 7 Ultimate in VirtualBox.
When you type a character (with an IME or not), the console will show the code point as U+XXXX.
You use Left Alt+Shift (or whatever you have it set to) to switch input languages as usual.
Hit ESC to exit (or close the window in windowed mode).
The program will pause before exiting so you can review the console output (press a key to exit).
author | dewyatt |
---|---|
date | Wed, 09 Jun 2010 00:03:54 -0400 |
parents | 6032ada8b9e5 |
children | 0e18c79c4111 |
comparison
equal
deleted
inserted
replaced
4733:983eb9d5ed31 | 4734:0c7c67d4e6ee |
---|---|
1 #include "Window.hpp" | 1 #include "Window.hpp" |
2 #include <gl/GL.h> | |
2 | 3 |
3 #pragma comment(lib, "opengl32.lib") | 4 #pragma comment(lib, "opengl32.lib") |
4 | 5 |
5 const wchar_t *Window::Window_Class_Name = L"GLTSF"; | 6 const wchar_t *Window::Window_Class_Name = L"GLTSF"; |
6 | 7 |
81 int Top = (GetDeviceCaps(Screen_DC, VERTRES) - my_Video_Mode.Height) / 2; | 82 int Top = (GetDeviceCaps(Screen_DC, VERTRES) - my_Video_Mode.Height) / 2; |
82 int Width = my_Video_Mode.Width; | 83 int Width = my_Video_Mode.Width; |
83 int Height = my_Video_Mode.Height; | 84 int Height = my_Video_Mode.Height; |
84 ReleaseDC(NULL, Screen_DC); | 85 ReleaseDC(NULL, Screen_DC); |
85 | 86 |
86 DWORD Style = WS_OVERLAPPEDWINDOW; | 87 DWORD Style = WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU; |
87 if (!my_Fullscreen) | 88 if (!my_Fullscreen) |
88 { | 89 { |
89 RECT Rect = {0, 0, Width, Height}; | 90 RECT Rect = {0, 0, Width, Height}; |
90 AdjustWindowRect(&Rect, Style, false); | 91 AdjustWindowRect(&Rect, Style, false); |
91 Width = Rect.right - Rect.left; | 92 Width = Rect.right - Rect.left; |
225 Call_Listener(On_Key_Down(wParam)); | 226 Call_Listener(On_Key_Down(wParam)); |
226 break; | 227 break; |
227 case WM_KEYUP: | 228 case WM_KEYUP: |
228 Call_Listener(On_Key_Up(wParam)); | 229 Call_Listener(On_Key_Up(wParam)); |
229 break; | 230 break; |
231 case WM_CHAR: | |
232 Call_Listener(On_Char(wParam)); | |
233 break; | |
230 default: | 234 default: |
231 return DefWindowProcW(Handle, Message, wParam, lParam); | 235 return DefWindowProcW(Handle, Message, wParam, lParam); |
232 break; | 236 break; |
233 } | 237 } |
234 return 0; | 238 return 0; |
259 void Window::Display() | 263 void Window::Display() |
260 { | 264 { |
261 if (my_Device_Context && my_GL_Context) | 265 if (my_Device_Context && my_GL_Context) |
262 SwapBuffers(my_Device_Context); | 266 SwapBuffers(my_Device_Context); |
263 } | 267 } |
268 | |
269 void Window::Clear() | |
270 { | |
271 glClear(GL_COLOR_BUFFER_BIT); | |
272 } |