/usr/include/libwildmagic/Wm5WindowApplication.h is in libwildmagic-dev 5.13-1+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | // Geometric Tools, LLC
// Copyright (c) 1998-2014
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
//
// File Version: 5.0.2 (2010/05/06)
#ifndef WM5WINDOWAPPLICATION_H
#define WM5WINDOWAPPLICATION_H
#include "Wm5Application.h"
namespace Wm5
{
class WindowApplication : public Application
{
protected:
// Abstract base class.
WindowApplication (const char* windowTitle, int xPosition,
int yPosition, int width, int height, const Float4& clearColor);
public:
virtual ~WindowApplication ();
// Entry point to be implemented by the application. The return value
// is an exit code, if desired.
virtual int Main (int numArguments, char** arguments);
// Member access.
inline const char* GetWindowTitle () const;
inline int GetXPosition () const;
inline int GetYPosition () const;
inline int GetWidth () const;
inline int GetHeight () const;
inline float GetAspectRatio () const;
inline void SetWindowID (int windowID);
inline int GetWindowID () const;
inline const Renderer* GetRenderer ();
// Event callbacks. The inline functions are stubs for the derived
// classes. The non-inline functions are implemented in the class
// WindowApplication, but are still overridden by derived classes.
virtual bool OnInitialize ();
virtual void OnTerminate ();
virtual void OnMove (int x, int y);
virtual void OnResize (int width, int height);
inline virtual bool OnPrecreate ();
inline virtual void OnPreidle ();
inline virtual void OnDisplay ();
inline virtual void OnIdle ();
virtual bool OnKeyDown (unsigned char key, int x, int y);
inline virtual bool OnKeyUp (unsigned char key, int x, int y);
inline virtual bool OnSpecialKeyDown (int key, int x, int y);
inline virtual bool OnSpecialKeyUp (int key, int x, int y);
inline virtual bool OnMouseClick (int button, int state, int x, int y,
unsigned int modifiers);
inline virtual bool OnMotion (int button, int x, int y,
unsigned int modifiers);
inline virtual bool OnPassiveMotion (int x, int y);
inline virtual bool OnMouseWheel (int delta, int x, int y,
unsigned int modifiers);
// Mouse position.
void SetMousePosition (int x, int y);
void GetMousePosition (int& x, int& y) const;
// Font information. These are platform-specific, so classes that
// implement the WindowApplication interfaces must implement these
// functions. They are not defined by WindowApplication.
int GetStringWidth (const char* text) const;
int GetCharacterWidth (const char character) const;
int GetFontHeight () const;
// Key identifiers. These are platform-specific, so classes that
// implement the WindowApplication interfaces must define these variables.
// They are not defined by WindowApplication.
int KEY_TERMINATE; // default KEY_ESCAPE, redefine as desired
static const int KEY_ESCAPE;
static const int KEY_LEFT_ARROW;
static const int KEY_RIGHT_ARROW;
static const int KEY_UP_ARROW;
static const int KEY_DOWN_ARROW;
static const int KEY_HOME;
static const int KEY_END;
static const int KEY_PAGE_UP;
static const int KEY_PAGE_DOWN;
static const int KEY_INSERT;
static const int KEY_DELETE;
static const int KEY_F1;
static const int KEY_F2;
static const int KEY_F3;
static const int KEY_F4;
static const int KEY_F5;
static const int KEY_F6;
static const int KEY_F7;
static const int KEY_F8;
static const int KEY_F9;
static const int KEY_F10;
static const int KEY_F11;
static const int KEY_F12;
static const int KEY_BACKSPACE;
static const int KEY_TAB;
static const int KEY_ENTER;
static const int KEY_RETURN;
// Keyboard modifiers.
static const int KEY_SHIFT;
static const int KEY_CONTROL;
static const int KEY_ALT;
static const int KEY_COMMAND;
// Mouse buttons.
static const int MOUSE_LEFT_BUTTON;
static const int MOUSE_MIDDLE_BUTTON;
static const int MOUSE_RIGHT_BUTTON;
// Mouse state.
static const int MOUSE_UP;
static const int MOUSE_DOWN;
// Mouse modifiers.
static const int MODIFIER_CONTROL;
static const int MODIFIER_LBUTTON;
static const int MODIFIER_MBUTTON;
static const int MODIFIER_RBUTTON;
static const int MODIFIER_SHIFT;
protected:
// The hookup to the 'main' entry point into the executable.
static int Run (int numArguments, char** arguments);
// Window parameters (from the constructor).
std::string mWindowTitle;
int mXPosition, mYPosition, mWidth, mHeight;
Float4 mClearColor;
bool mAllowResize;
// The window ID is platform-specific but hidden by an 'int' opaque
// handle.
int mWindowID;
Texture::Format mColorFormat;
Texture::Format mDepthStencilFormat;
int mNumMultisamples;
Renderer* mRenderer;
// Performance measurements.
void ResetTime ();
void MeasureTime ();
void UpdateFrameCount ();
void DrawFrameRate (int x, int y, const Float4& color);
double mLastTime, mAccumulatedTime, mFrameRate;
int mFrameCount, mAccumulatedFrameCount, mTimer, mMaxTimer;
};
#include "Wm5WindowApplication.inl"
//----------------------------------------------------------------------------
#define WM5_WINDOW_APPLICATION(classname) \
WM5_IMPLEMENT_INITIALIZE(classname); \
WM5_IMPLEMENT_TERMINATE(classname); \
\
void classname::Initialize () \
{ \
Application::Run = &WindowApplication::Run; \
TheApplication = new0 classname(); \
} \
\
void classname::Terminate () \
{ \
delete0(TheApplication); \
}
//----------------------------------------------------------------------------
}
#endif
|