WindowImplXXX.cpp
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
26// Headers
28#include <SFML/Window/XXX/WindowImplXXX.hpp>
29#include <SFML/Window/WindowStyle.hpp>
30#include <GL/gl.h>
31
32
33namespace sf
34{
35namespace priv
36{
41WindowImplXXX::WindowImplXXX()
42{
43 // Create a dummy window (with the fewest attributes -- it's just to have a valid support for an OpenGL context)
44
45 // Initialize myWidth and myHeight members from base class with the window size
46
47 // Create an OpenGL context in this window and DO NOT make it active
48}
49
50
54WindowImplXXX::WindowImplXXX(WindowHandle Handle, WindowSettings& Params)
55{
56 // Make sure we'll be able to catch all the events of the given window
57
58 // Initialize myWidth and myHeight members from base class with the window size
59
60 // Create an OpenGL context in this window and make it active
61}
62
63
67WindowImplXXX::WindowImplXXX(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& Params) :
68{
69 // Create a new window with given size, title and style
70
71 // Initialize myWidth and myHeight members from base class with the window size
72
73 // Create an OpenGL context in this window and make it active
74}
75
76
80WindowImplXXX::~WindowImplXXX()
81{
82 // Destroy the OpenGL context, the window and every resource allocated by this class
83}
84
85
89bool WindowImplXXX::IsContextActive()
90{
91 // Should return whether xxxGetCurrentContext() is NULL or not;
92}
93
94
98void WindowImplXXX::Display()
99{
100 // Swap OpenGL buffers (should be a call to xxxSwapBuffers)
101}
102
103
107void WindowImplXXX::ProcessEvents()
108{
109 // Process every event for this window
110
111 // Generate a sf::Event and call SendEvent(Evt) for each event
112}
113
114
118void WindowImplXXX::SetActive(bool Active) const
119{
120 // Bind / unbind OpenGL context (should be a call to xxxMakeCurrent)
121}
122
123
127void WindowImplXXX::UseVerticalSync(bool Enabled)
128{
129 // Activate / deactivate vertical synchronization
130 // usually using an OpenGL extension (should be a call to xxxSwapInterval)
131}
132
133
137void WindowImplXXX::ShowMouseCursor(bool Show)
138{
139 // Show or hide the system cursor in this window
140}
141
142
146void WindowImplXXX::SetCursorPosition(unsigned int Left, unsigned int Top)
147{
148 // Change the cursor position (Left and Top are relative to this window)
149}
150
151
155void WindowImplXXX::SetPosition(int Left, int Top)
156{
157 // Change the window position
158}
159
160
164void WindowImplWin32::SetSize(unsigned int Width, unsigned int Height)
165{
166 // Change the window size
167}
168
169
173void WindowImplXXX::Show(bool State)
174{
175 // Show or hide the window
176}
177
181void WindowImplXXX::EnableKeyRepeat(bool Enabled)
182{
183 // Enable or disable automatic key-repeat for keydown events
184}
185
186
190void WindowImplXXX::SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels)
191{
192 // Change all the necessary icons of the window (titlebar, task bar, ...) with the
193 // provided array of 32 bits RGBA pixels
194}
195
196
197/*===========================================================
198 STRATEGY FOR OPENGL CONTEXT CREATION
199
200- If the requested level of anti-aliasing is not supported and is greater than 2, try with 2
201 --> if level 2 fails, disable anti-aliasing
202 --> it's important not to generate an error if anti-aliasing is not supported
203
204- Use a matching pixel mode, or the best of all available pixel modes if no perfect match ;
205 You should use the function EvaluateConfig to get a score for a given configuration
206
207- Don't forget to fill Params (see constructors) back with the actual parameters we got from the chosen pixel format
208
209- IMPORTANT : all OpenGL contexts must be shared (usually a call to xxxShareLists)
210
211===========================================================*/
212
213
214/*===========================================================
215 STRATEGY FOR EVENT HANDLING
216
217- Process any event matching with the ones in sf::Event::EventType
218 --> Create a sf::Event, fill the members corresponding to the event type
219 --> No need to handle joystick events, they are handled by WindowImpl::ProcessJoystickEvents
220 --> Event::TextEntered must provide UTF-16 characters
221 (see http://www.unicode.org/Public/PROGRAMS/CVTUTF/ for unicode conversions)
222 --> Don't forget to process any destroy-like event (ie. when the window is destroyed externally)
223
224- Use SendEvent function from base class to propagate the created events
225
226===========================================================*/
227
228
229} // namespace priv
230
231} // namespace sf