DART 6.6.2
Loading...
Searching...
No Matches
GlutWindow.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2018, The DART development contributors
3 * All rights reserved.
4 *
5 * The list of contributors can be found at:
6 * https://github.com/dartsim/dart/blob/master/LICENSE
7 *
8 * This file is provided under the following "BSD-style" License:
9 * Redistribution and use in source and binary forms, with or
10 * without modification, are permitted provided that the following
11 * conditions are met:
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef DART_GUI_GLUTWINDOW_HPP_
34#define DART_GUI_GLUTWINDOW_HPP_
35
36#include <vector>
37
40
41namespace dart {
42namespace gui {
43
46public:
47 GlutWindow();
48 virtual ~GlutWindow();
49
51 virtual void initWindow(int _w, int _h, const char* _name);
52
53 // callback functions
54 static void reshape(int _w, int _h);
55 static void keyEvent(unsigned char _key, int _x, int _y);
56 static void specKeyEvent(int _key, int _x, int _y);
57 static void mouseClick(int _button, int _state, int _x, int _y);
58 static void mouseDrag(int _x, int _y);
59 static void mouseMove(int _x, int _y);
60 static void refresh();
61 static void refreshTimer(int _val);
62 static void runTimer(int _val);
63
64 static GlutWindow* current();
65 static std::vector<GlutWindow*> mWindows;
66 static std::vector<int> mWinIDs;
67
68protected:
69 // callback implementation
70 virtual void resize(int _w, int _h) = 0;
71 virtual void render() = 0;
72 virtual void keyboard(unsigned char _key, int _x, int _y);
73 virtual void specKey(int _key, int _x, int _y);
74 virtual void click(int _button, int _state, int _x, int _y);
75 virtual void drag(int _x, int _y);
76 virtual void move(int _x, int _y);
77 virtual void displayTimer(int _val);
78 virtual void simTimer(int _val);
79
80 virtual bool screenshot();
81
90 double mBackground[4];
92 std::vector<unsigned char> mScreenshotTemp;
93 std::vector<unsigned char> mScreenshotTemp2;
94};
95
96} // namespace gui
97} // namespace dart
98
99#endif // DART_GUI_GLUTWINDOW_HPP_
Definition GlutWindow.hpp:45
virtual void resize(int _w, int _h)=0
bool mCapture
Definition GlutWindow.hpp:89
static void mouseDrag(int _x, int _y)
Definition GlutWindow.cpp:134
double mDisplayTimeout
Definition GlutWindow.hpp:86
virtual void render()=0
int mWinHeight
Definition GlutWindow.hpp:83
static void mouseMove(int _x, int _y)
Definition GlutWindow.cpp:138
static void runTimer(int _val)
Definition GlutWindow.cpp:158
static GlutWindow * current()
Definition GlutWindow.cpp:221
virtual void move(int _x, int _y)
Definition GlutWindow.cpp:245
static std::vector< int > mWinIDs
Definition GlutWindow.hpp:66
virtual void click(int _button, int _state, int _x, int _y)
Definition GlutWindow.cpp:239
virtual bool screenshot()
Definition GlutWindow.cpp:162
gui::RenderInterface * mRI
Definition GlutWindow.hpp:91
int mMouseY
Definition GlutWindow.hpp:85
static void keyEvent(unsigned char _key, int _x, int _y)
Definition GlutWindow.cpp:122
virtual void drag(int _x, int _y)
Definition GlutWindow.cpp:242
static void reshape(int _w, int _h)
Definition GlutWindow.cpp:116
bool mMouseDrag
Definition GlutWindow.hpp:88
virtual void simTimer(int _val)
Definition GlutWindow.cpp:155
static void mouseClick(int _button, int _state, int _x, int _y)
Definition GlutWindow.cpp:130
virtual void initWindow(int _w, int _h, const char *_name)
Definition GlutWindow.cpp:81
std::vector< unsigned char > mScreenshotTemp2
Definition GlutWindow.hpp:93
int mWinWidth
Definition GlutWindow.hpp:82
std::vector< unsigned char > mScreenshotTemp
Definition GlutWindow.hpp:92
static void refreshTimer(int _val)
Definition GlutWindow.cpp:146
virtual void keyboard(unsigned char _key, int _x, int _y)
Definition GlutWindow.cpp:232
static std::vector< GlutWindow * > mWindows
Definition GlutWindow.hpp:65
bool mMouseDown
Definition GlutWindow.hpp:87
int mMouseX
Definition GlutWindow.hpp:84
static void specKeyEvent(int _key, int _x, int _y)
Definition GlutWindow.cpp:126
GlutWindow()
Definition GlutWindow.cpp:61
virtual void displayTimer(int _val)
Definition GlutWindow.cpp:150
double mBackground[4]
Definition GlutWindow.hpp:90
virtual void specKey(int _key, int _x, int _y)
Definition GlutWindow.cpp:236
virtual ~GlutWindow()
Definition GlutWindow.cpp:77
static void refresh()
Definition GlutWindow.cpp:142
Definition RenderInterface.hpp:67
Definition BulletCollisionDetector.cpp:63