First commit
This commit is contained in:
41
include/Nazara/Utility/Config.hpp
Normal file
41
include/Nazara/Utility/Config.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Nazara Engine
|
||||
|
||||
Copyright (C) 2012 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_CONFIG_UTILITY_HPP
|
||||
#define NAZARA_CONFIG_UTILITY_HPP
|
||||
|
||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||
|
||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
||||
#define NAZARA_UTILITY_MEMORYLEAKTRACKER 0
|
||||
|
||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||
#define NAZARA_UTILITY_SAFE 1
|
||||
|
||||
// Fait tourner chaque fenêtre dans un thread séparé
|
||||
#define NAZARA_UTILITY_THREADED_WINDOW 1
|
||||
|
||||
#endif // NAZARA_CONFIG_UTILITY_HPP
|
||||
11
include/Nazara/Utility/Debug.hpp
Normal file
11
include/Nazara/Utility/Debug.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#if NAZARA_UTILITY_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#include <Nazara/Core/Debug/MemoryLeakTracker.hpp>
|
||||
|
||||
#define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete
|
||||
#define new new(__FILE__, __LINE__)
|
||||
#endif
|
||||
8
include/Nazara/Utility/DebugOff.hpp
Normal file
8
include/Nazara/Utility/DebugOff.hpp
Normal file
@@ -0,0 +1,8 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#if NAZARA_UTILITY_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||
#undef delete
|
||||
#undef new
|
||||
#endif
|
||||
94
include/Nazara/Utility/Event.hpp
Normal file
94
include/Nazara/Utility/Event.hpp
Normal file
@@ -0,0 +1,94 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// Interface inspirée de la SFML par Laurent Gomila
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_EVENT_HPP
|
||||
#define NAZARA_EVENT_HPP
|
||||
|
||||
#include <Nazara/Utility/Keyboard.hpp>
|
||||
#include <Nazara/Utility/Mouse.hpp>
|
||||
|
||||
struct NzEvent
|
||||
{
|
||||
struct KeyEvent
|
||||
{
|
||||
NzKeyboard::Key code;
|
||||
bool alt;
|
||||
bool control;
|
||||
bool shift;
|
||||
bool system;
|
||||
};
|
||||
|
||||
struct MouseButtonEvent
|
||||
{
|
||||
NzMouse::Button button;
|
||||
unsigned int x;
|
||||
unsigned int y;
|
||||
};
|
||||
|
||||
struct MouseMoveEvent
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
struct MouseWheelEvent
|
||||
{
|
||||
float delta;
|
||||
};
|
||||
|
||||
struct PositionEvent
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
struct SizeEvent
|
||||
{
|
||||
unsigned int height;
|
||||
unsigned int width;
|
||||
};
|
||||
|
||||
struct TextEvent
|
||||
{
|
||||
char32_t character;
|
||||
};
|
||||
|
||||
enum Type
|
||||
{
|
||||
GainedFocus,
|
||||
LostFocus,
|
||||
KeyPressed,
|
||||
KeyReleased,
|
||||
MouseButtonDoubleClicked,
|
||||
MouseButtonPressed,
|
||||
MouseButtonReleased,
|
||||
MouseEntered,
|
||||
MouseLeft,
|
||||
MouseMoved,
|
||||
MouseWheelMoved,
|
||||
Moved,
|
||||
Quit,
|
||||
Resized,
|
||||
TextEntered
|
||||
};
|
||||
|
||||
Type type;
|
||||
|
||||
union
|
||||
{
|
||||
KeyEvent key;
|
||||
MouseButtonEvent mouseButton;
|
||||
MouseMoveEvent mouseMove;
|
||||
MouseWheelEvent mouseWheel;
|
||||
PositionEvent position;
|
||||
SizeEvent size;
|
||||
TextEvent text;
|
||||
};
|
||||
};
|
||||
|
||||
#endif // NAZARA_EVENT_HPP
|
||||
45
include/Nazara/Utility/Functor.hpp
Normal file
45
include/Nazara/Utility/Functor.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_FUNCTOR_HPP
|
||||
#define NAZARA_FUNCTOR_HPP
|
||||
|
||||
#include <Nazara/Utility/Tuple.hpp>
|
||||
|
||||
// Inspiré du code de la SFML par Laurent Gomila
|
||||
|
||||
struct NzFunctor
|
||||
{
|
||||
virtual ~NzFunctor() {}
|
||||
|
||||
virtual void Run() = 0;
|
||||
};
|
||||
|
||||
template<typename F> struct NzFunctorWithoutArgs : NzFunctor
|
||||
{
|
||||
NzFunctorWithoutArgs(F func);
|
||||
|
||||
void Run();
|
||||
|
||||
F function;
|
||||
};
|
||||
|
||||
template<typename F, typename... Args> struct NzFunctorWithArgs : NzFunctor
|
||||
{
|
||||
NzFunctorWithArgs(F func, Args&... args);
|
||||
|
||||
void Run();
|
||||
|
||||
F function;
|
||||
std::tuple<Args...> arguments;
|
||||
};
|
||||
|
||||
template<typename F> struct NzFunctorWithoutArgs;
|
||||
template<typename F, typename... Args> struct NzFunctorWithArgs;
|
||||
|
||||
#include <Nazara/Utility/Functor.inl>
|
||||
|
||||
#endif // NAZARA_FUNCTOR_HPP
|
||||
24
include/Nazara/Utility/Functor.inl
Normal file
24
include/Nazara/Utility/Functor.inl
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
template<typename F> NzFunctorWithoutArgs<F>::NzFunctorWithoutArgs(F func) :
|
||||
function(func)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename F> void NzFunctorWithoutArgs<F>::Run()
|
||||
{
|
||||
function();
|
||||
}
|
||||
|
||||
template<typename F, typename... Args> NzFunctorWithArgs<F, Args...>::NzFunctorWithArgs(F func, Args&... args) :
|
||||
function(func),
|
||||
arguments(args...)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename F, typename... Args> void NzFunctorWithArgs<F, Args...>::Run()
|
||||
{
|
||||
NzUnpackTuple(function, arguments);
|
||||
}
|
||||
165
include/Nazara/Utility/Keyboard.hpp
Normal file
165
include/Nazara/Utility/Keyboard.hpp
Normal file
@@ -0,0 +1,165 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// Interface inspirée de la SFML par Laurent Gomila
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_KEYBOARD_HPP
|
||||
#define NAZARA_KEYBOARD_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
|
||||
class NAZARA_API NzKeyboard
|
||||
{
|
||||
public:
|
||||
enum Key
|
||||
{
|
||||
Undefined = -1,
|
||||
|
||||
// Lettres
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
D,
|
||||
E,
|
||||
F,
|
||||
G,
|
||||
H,
|
||||
I,
|
||||
J,
|
||||
K,
|
||||
L,
|
||||
M,
|
||||
N,
|
||||
O,
|
||||
P,
|
||||
Q,
|
||||
R,
|
||||
S,
|
||||
T,
|
||||
U,
|
||||
V,
|
||||
W,
|
||||
X,
|
||||
Y,
|
||||
Z,
|
||||
|
||||
// Touches de fonction
|
||||
F1,
|
||||
F2,
|
||||
F3,
|
||||
F4,
|
||||
F5,
|
||||
F6,
|
||||
F7,
|
||||
F8,
|
||||
F9,
|
||||
F10,
|
||||
F11,
|
||||
F12,
|
||||
F13,
|
||||
F14,
|
||||
F15,
|
||||
|
||||
// Flèches directionnelles
|
||||
Down,
|
||||
Left,
|
||||
Right,
|
||||
Up,
|
||||
|
||||
// Pavé numérique
|
||||
Add,
|
||||
Divide,
|
||||
Multiply,
|
||||
Numpad0,
|
||||
Numpad1,
|
||||
Numpad2,
|
||||
Numpad3,
|
||||
Numpad4,
|
||||
Numpad5,
|
||||
Numpad6,
|
||||
Numpad7,
|
||||
Numpad8,
|
||||
Numpad9,
|
||||
Subtract,
|
||||
|
||||
// Divers
|
||||
Backslash,
|
||||
Backspace,
|
||||
Clear,
|
||||
Comma,
|
||||
Dash,
|
||||
Delete,
|
||||
End,
|
||||
Equal,
|
||||
Escape,
|
||||
Home,
|
||||
Insert,
|
||||
LAlt,
|
||||
LBracket,
|
||||
LControl,
|
||||
LShift,
|
||||
LSystem,
|
||||
Num0,
|
||||
Num1,
|
||||
Num2,
|
||||
Num3,
|
||||
Num4,
|
||||
Num5,
|
||||
Num6,
|
||||
Num7,
|
||||
Num8,
|
||||
Num9,
|
||||
PageDown,
|
||||
PageUp,
|
||||
Pause,
|
||||
Period,
|
||||
Print,
|
||||
PrintScreen,
|
||||
Quote,
|
||||
RAlt,
|
||||
RBracket,
|
||||
RControl,
|
||||
Return,
|
||||
RShift,
|
||||
RSystem,
|
||||
Semicolon,
|
||||
Slash,
|
||||
Space,
|
||||
Tab,
|
||||
Tilde,
|
||||
|
||||
// Touches navigateur
|
||||
Browser_Back,
|
||||
Browser_Favorites,
|
||||
Browser_Forward,
|
||||
Browser_Home,
|
||||
Browser_Refresh,
|
||||
Browser_Search,
|
||||
Browser_Stop,
|
||||
|
||||
// Touches de contrôle de lecture
|
||||
Media_Next,
|
||||
Media_Play,
|
||||
Media_Previous,
|
||||
Media_Stop,
|
||||
|
||||
// Touches de contrôle du volume
|
||||
Volume_Down,
|
||||
Volume_Mute,
|
||||
Volume_Up,
|
||||
|
||||
// Touches à verrouillage
|
||||
CapsLock,
|
||||
NumLock,
|
||||
ScrollLock,
|
||||
|
||||
Count
|
||||
};
|
||||
|
||||
static bool IsKeyPressed(Key key);
|
||||
};
|
||||
|
||||
#endif // NAZARA_KEYBOARD_HPP
|
||||
40
include/Nazara/Utility/Mouse.hpp
Normal file
40
include/Nazara/Utility/Mouse.hpp
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// Interface inspirée de la SFML par Laurent Gomila
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_MOUSE_HPP
|
||||
#define NAZARA_MOUSE_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
|
||||
class NzWindow;
|
||||
|
||||
class NAZARA_API NzMouse
|
||||
{
|
||||
public:
|
||||
enum Button
|
||||
{
|
||||
Left,
|
||||
Middle,
|
||||
Right,
|
||||
XButton1,
|
||||
XButton2,
|
||||
|
||||
Count
|
||||
};
|
||||
|
||||
static NzVector2i GetPosition();
|
||||
static NzVector2i GetPosition(const NzWindow& relativeTo);
|
||||
static bool IsButtonPressed(Button button);
|
||||
static void SetPosition(const NzVector2i& position);
|
||||
static void SetPosition(const NzVector2i& position, const NzWindow& relativeTo);
|
||||
static void SetPosition(int x, int y);
|
||||
static void SetPosition(int x, int y, const NzWindow& relativeTo);
|
||||
};
|
||||
|
||||
#endif // NAZARA_MOUSE_HPP
|
||||
20
include/Nazara/Utility/NonCopyable.hpp
Normal file
20
include/Nazara/Utility/NonCopyable.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_NONCOPYABLE_HPP
|
||||
#define NAZARA_NONCOPYABLE_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
|
||||
class NAZARA_API NzNonCopyable
|
||||
{
|
||||
protected:
|
||||
NzNonCopyable() = default;
|
||||
NzNonCopyable(const NzNonCopyable&) = delete;
|
||||
NzNonCopyable& operator=(const NzNonCopyable&) = delete;
|
||||
};
|
||||
|
||||
#endif // NAZARA_NONCOPYABLE_HPP
|
||||
30
include/Nazara/Utility/Resource.hpp
Normal file
30
include/Nazara/Utility/Resource.hpp
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_RESOURCE_HPP
|
||||
#define NAZARA_RESOURCE_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Utility/NonCopyable.hpp>
|
||||
|
||||
class NAZARA_API NzResource : NzNonCopyable
|
||||
{
|
||||
public:
|
||||
NzResource(bool persistent = true);
|
||||
virtual ~NzResource();
|
||||
|
||||
void AddResourceReference() const;
|
||||
bool IsPersistent() const;
|
||||
void RemoveResourceReference() const;
|
||||
void SetPersistent(bool persistent = true);
|
||||
|
||||
private:
|
||||
// Je fais précéder le nom par 'resource' pour éviter les éventuels conflits de noms
|
||||
mutable bool m_resourcePersistent;
|
||||
mutable unsigned int m_resourceReferenceCount;
|
||||
};
|
||||
|
||||
#endif // NAZARA_RESOURCE_HPP
|
||||
16
include/Nazara/Utility/Tuple.hpp
Normal file
16
include/Nazara/Utility/Tuple.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_TUPLE_HPP
|
||||
#define NAZARA_TUPLE_HPP
|
||||
|
||||
#include <tuple>
|
||||
|
||||
template<typename F, typename... ArgsT> void NzUnpackTuple(F func, const std::tuple<ArgsT...>& t);
|
||||
|
||||
#include <Nazara/Utility/Tuple.inl>
|
||||
|
||||
#endif // NAZARA_TUPLE_HPP
|
||||
35
include/Nazara/Utility/Tuple.inl
Normal file
35
include/Nazara/Utility/Tuple.inl
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// http://stackoverflow.com/questions/687490/c0x-how-do-i-expand-a-tuple-into-variadic-template-function-arguments
|
||||
// Merci à Ryan "FullMetal Alchemist" Lahfa
|
||||
// Merci aussi à Freedom de siteduzero.com
|
||||
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
template<unsigned int N> struct NzTupleUnpack
|
||||
{
|
||||
template <typename F, typename... ArgsT, typename... Args>
|
||||
void operator()(F func, const std::tuple<ArgsT...>& t, Args&... args)
|
||||
{
|
||||
NzTupleUnpack<N-1>()(func, t, std::get<N-1>(t), args...);
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct NzTupleUnpack<0>
|
||||
{
|
||||
template <typename F, typename... ArgsT, typename... Args>
|
||||
void operator()(F func, const std::tuple<ArgsT...>&, Args&... args)
|
||||
{
|
||||
func(args...);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename F, typename... ArgsT>
|
||||
void NzUnpackTuple(F func, const std::tuple<ArgsT...>& t )
|
||||
{
|
||||
NzTupleUnpack<sizeof...(ArgsT)>()(func, t);
|
||||
}
|
||||
|
||||
#include <Nazara/Utility/DebugOff.hpp>
|
||||
38
include/Nazara/Utility/VideoMode.hpp
Normal file
38
include/Nazara/Utility/VideoMode.hpp
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// Interface inspirée de la SFML par Laurent Gomila
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_VIDEOMODE_HPP
|
||||
#define NAZARA_VIDEOMODE_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <vector>
|
||||
|
||||
class NAZARA_API NzVideoMode
|
||||
{
|
||||
public:
|
||||
NzVideoMode();
|
||||
NzVideoMode(unsigned int w, unsigned int h, nzUInt8 bpp);
|
||||
|
||||
bool IsFullscreenValid() const;
|
||||
|
||||
static NzVideoMode GetDesktopMode();
|
||||
static const std::vector<NzVideoMode>& GetFullscreenModes();
|
||||
|
||||
nzUInt8 bitsPerPixel;
|
||||
unsigned int height;
|
||||
unsigned int width;
|
||||
};
|
||||
|
||||
bool operator==(const NzVideoMode& left, const NzVideoMode& right);
|
||||
bool operator!=(const NzVideoMode& left, const NzVideoMode& right);
|
||||
bool operator<(const NzVideoMode& left, const NzVideoMode& right);
|
||||
bool operator<=(const NzVideoMode& left, const NzVideoMode& right);
|
||||
bool operator>(const NzVideoMode& left, const NzVideoMode& right);
|
||||
bool operator>=(const NzVideoMode& left, const NzVideoMode& right);
|
||||
|
||||
#endif // NAZARA_VIDEOMODE_HPP
|
||||
113
include/Nazara/Utility/Window.hpp
Normal file
113
include/Nazara/Utility/Window.hpp
Normal file
@@ -0,0 +1,113 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// Interface inspirée de la SFML par Laurent Gomila
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_WINDOW_HPP
|
||||
#define NAZARA_WINDOW_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <Nazara/Utility/Event.hpp>
|
||||
#include <Nazara/Utility/NonCopyable.hpp>
|
||||
#include <Nazara/Utility/VideoMode.hpp>
|
||||
#include <Nazara/Utility/WindowHandle.hpp>
|
||||
#include <queue>
|
||||
|
||||
#if NAZARA_UTILITY_THREADED_WINDOW
|
||||
#include <Nazara/Core/Mutex.hpp>
|
||||
#include <Nazara/Core/ThreadCondition.hpp>
|
||||
#endif
|
||||
|
||||
class NzWindowImpl;
|
||||
|
||||
class NAZARA_API NzWindow : NzNonCopyable
|
||||
{
|
||||
friend class NzWindowImpl;
|
||||
|
||||
public:
|
||||
enum Style
|
||||
{
|
||||
None = 0x0,
|
||||
Fullscreen = 0x1,
|
||||
|
||||
Closable = 0x2,
|
||||
Resizable = 0x4,
|
||||
Titlebar = 0x8,
|
||||
|
||||
Default = Closable | Resizable | Titlebar
|
||||
};
|
||||
|
||||
NzWindow();
|
||||
NzWindow(NzVideoMode mode, const NzString& title, nzUInt32 style = Default);
|
||||
NzWindow(NzWindowHandle handle);
|
||||
virtual ~NzWindow();
|
||||
|
||||
void Close();
|
||||
|
||||
bool Create(NzVideoMode mode, const NzString& title, nzUInt32 style = Default);
|
||||
bool Create(NzWindowHandle handle);
|
||||
|
||||
void EnableKeyRepeat(bool enable);
|
||||
void EnableSmoothScrolling(bool enable);
|
||||
|
||||
NzWindowHandle GetHandle() const;
|
||||
unsigned int GetHeight() const;
|
||||
NzVector2i GetPosition() const;
|
||||
NzVector2i GetSize() const;
|
||||
NzString GetTitle() const;
|
||||
unsigned int GetWidth() const;
|
||||
|
||||
bool HasFocus() const;
|
||||
|
||||
bool IsMinimized() const;
|
||||
bool IsOpen() const;
|
||||
bool IsVisible() const;
|
||||
|
||||
bool PollEvent(NzEvent* event);
|
||||
|
||||
void SetEventListener(bool listener);
|
||||
void SetFocus();
|
||||
void SetMaximumSize(const NzVector2i& maxSize);
|
||||
void SetMaximumSize(int width, int height);
|
||||
void SetMinimumSize(const NzVector2i& minSize);
|
||||
void SetMinimumSize(int width, int height);
|
||||
void SetPosition(const NzVector2i& position);
|
||||
void SetPosition(int x, int y);
|
||||
void SetSize(const NzVector2i& size);
|
||||
void SetSize(unsigned int width, unsigned int height);
|
||||
void SetTitle(const NzString& title);
|
||||
void SetVisible(bool visible);
|
||||
|
||||
void ShowMouseCursor(bool show);
|
||||
|
||||
void StayOnTop(bool stayOnTop);
|
||||
|
||||
bool WaitEvent(NzEvent* event);
|
||||
|
||||
protected:
|
||||
virtual void OnClose();
|
||||
virtual bool OnCreate();
|
||||
|
||||
NzWindowImpl* m_impl;
|
||||
|
||||
private:
|
||||
void PushEvent(const NzEvent& event);
|
||||
|
||||
std::queue<NzEvent> m_events;
|
||||
#if NAZARA_UTILITY_THREADED_WINDOW
|
||||
NzMutex m_eventMutex;
|
||||
NzMutex m_eventConditionMutex;
|
||||
NzThreadCondition m_eventCondition;
|
||||
bool m_eventListener;
|
||||
bool m_waitForEvent;
|
||||
#endif
|
||||
bool m_ownsWindow;
|
||||
};
|
||||
|
||||
#endif // NAZARA_WINDOW_HPP
|
||||
22
include/Nazara/Utility/WindowHandle.hpp
Normal file
22
include/Nazara/Utility/WindowHandle.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_WINDOWHANDLE_HPP
|
||||
#define NAZARA_WINDOWHANDLE_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
// http://msdn.microsoft.com/en-us/library/aa383751(v=vs.85).aspx
|
||||
typedef void* NzWindowHandle;
|
||||
#elif defined(NAZARA_PLATFORM_LINUX)
|
||||
// http://en.wikipedia.org/wiki/Xlib#Data_types
|
||||
typedef unsigned long NzWindowHandle;
|
||||
#else
|
||||
#error Lack of implementation: WindowHandle
|
||||
#endif
|
||||
|
||||
#endif // NAZARA_WINDOWHANDLE_HPP
|
||||
Reference in New Issue
Block a user