aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llcameraview.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llcameraview.cpp97
1 files changed, 96 insertions, 1 deletions
diff --git a/linden/indra/newview/llcameraview.cpp b/linden/indra/newview/llcameraview.cpp
index 6c63359..d9bd282 100644
--- a/linden/indra/newview/llcameraview.cpp
+++ b/linden/indra/newview/llcameraview.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -28,6 +29,7 @@
28#include "llviewerprecompiledheaders.h" 29#include "llviewerprecompiledheaders.h"
29 30
30#include "llcameraview.h" 31#include "llcameraview.h"
32#include "llvieweruictrlfactory.h"
31 33
32// Library includes 34// Library includes
33#include "llfontgl.h" 35#include "llfontgl.h"
@@ -36,6 +38,8 @@
36#include "llagent.h" 38#include "llagent.h"
37#include "lljoystickbutton.h" 39#include "lljoystickbutton.h"
38#include "llviewercontrol.h" 40#include "llviewercontrol.h"
41#include "llviewerwindow.h"
42#include "viewer.h"
39 43
40// Constants 44// Constants
41const char *CAMERA_TITLE = ""; 45const char *CAMERA_TITLE = "";
@@ -158,4 +162,95 @@ BOOL LLFloaterCamera::visible(void*)
158 } 162 }
159} 163}
160 164
161// EOF 165LLFloaterJoystick *LLFloaterJoystick::sInstance = NULL;
166
167
168LLFloaterJoystick::LLFloaterJoystick( )
169: LLFloater("Joystick floater")
170{
171 sInstance = this;
172}
173
174LLFloaterJoystick::~LLFloaterJoystick()
175{
176 sInstance = NULL;
177}
178
179void LLFloaterJoystick::draw()
180{
181 for (U32 i = 0; i < 6; i++)
182 {
183 F32 value = gViewerWindow->getWindow()->getJoystickAxis(i);
184 mAxis[i]->addValue(value*gFrameIntervalSeconds);
185
186 if (mAxisBar[i]->mMinBar > value)
187 {
188 mAxisBar[i]->mMinBar = value;
189 }
190 if (mAxisBar[i]->mMaxBar < value)
191 {
192 mAxisBar[i]->mMaxBar = value;
193 }
194 }
195
196 LLFloater::draw();
197}
198
199// static
200void LLFloaterJoystick::show(void*)
201{
202 if (sInstance)
203 {
204 sInstance->open(); /*Flawfinder: ignore*/
205 }
206 else
207 {
208 LLFloaterJoystick* floater = new LLFloaterJoystick();
209
210 gUICtrlFactory->buildFloater(floater, "floater_joystick.xml");
211 F32 range = gSavedSettings.getBOOL("FlycamAbsolute") ? 1024.f : 2.f;
212 LLUIString axis = floater->childGetText("Axis");
213 LLUIString joystick = floater->childGetText("JoystickMonitor");
214
215 LLView* child = floater->getChildByName("ZoomLabel");
216 LLRect rect;
217
218 if (child)
219 {
220 LLRect r = child->getRect();
221 LLRect f = floater->getRect();
222 rect = LLRect(150, r.mTop, r.mRight, 0);
223 }
224
225 floater->mAxisStats = new LLStatView("axis values", joystick, "", rect);
226 floater->mAxisStats->setDisplayChildren(TRUE);
227
228 for (U32 i = 0; i < 6; i++)
229 {
230 axis.setArg("[NUM]", llformat("%d", i));
231 floater->mAxis[i] = new LLStat(4);
232 floater->mAxisBar[i] = floater->mAxisStats->addStat(axis, floater->mAxis[i]);
233 floater->mAxisBar[i]->mMinBar = -range;
234 floater->mAxisBar[i]->mMaxBar = range;
235 floater->mAxisBar[i]->mLabelSpacing = range * 0.5f;
236 floater->mAxisBar[i]->mTickSpacing = range * 0.25f;
237 }
238
239
240
241 floater->addChild(floater->mAxisStats);
242 floater->open(); /*Flawfinder: ignore*/
243 }
244}
245
246//static
247LLFloaterJoystick* LLFloaterJoystick::getInstance()
248{
249 return sInstance;
250}
251
252// static
253BOOL LLFloaterJoystick::visible(void*)
254{
255 return (sInstance != NULL);
256}