view EXCLUDE/GLTSF/include/Window.hpp @ 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
line wrap: on
line source

#ifndef WINDOW_HPP
#define WINDOW_HPP

#include <string>

#define WIN32_LEAN_AND_MEAN
#include <Windows.h>

#include "Video_Mode.hpp"
#include "Window_Listener.hpp"
#include "TSF.hpp"

class Window
{
public:
	Window();
	~Window();

	void Initialize(const std::wstring &Title, const Video_Mode &Mode, bool Fullscreen);
	void Finalize();

	void Set_Listener(Window_Listener *Listener);

	void Show();
	void Hide();

	void Update();
	void Display();

	void Clear();

private:
	static const wchar_t *Window_Class_Name;

	void Register_Class();
	void Unregister_Class();

	void Create_Window(const std::wstring &Title, const Video_Mode &Mode, bool Fullscreen);
	void Destroy_Window();

	void Create_Context(const Video_Mode &Mode);
	void Destroy_Context();

	void Switch_To_Fullscreen(const Video_Mode &Mode);

	LRESULT Handle_Message(HWND Handle, UINT Message, WPARAM wParam, LPARAM lParam);
	static LRESULT CALLBACK Window_Procedure(HWND Handle, UINT Message, WPARAM wParam, LPARAM lParam);

	HWND my_Handle;
	Video_Mode my_Video_Mode;
	bool my_Fullscreen;
	HDC my_Device_Context;
	HGLRC my_GL_Context;
	bool my_Class_Registered;
	Window_Listener *my_Listener;
};

#endif