/usr/share/openscenegraph/examples/osgwidgetinput/osgwidgetinput.cpp is in openscenegraph-examples 3.2.1-7ubuntu4.
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 | // -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008
// $Id: osgwidgetinput.cpp 50 2008-05-06 05:06:36Z cubicool $
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgViewer/ViewerEventHandlers>
#include <osgWidget/WindowManager>
#include <osgWidget/Box>
#include <osgWidget/Input>
#include <osgWidget/ViewerEventHandlers>
const unsigned int MASK_2D = 0xF0000000;
int main(int argc, char** argv) {
osgViewer::Viewer viewer;
osgWidget::WindowManager* wm = new osgWidget::WindowManager(
&viewer,
1280.0f,
1024.0f,
MASK_2D,
osgWidget::WindowManager::WM_PICK_DEBUG
);
osgWidget::Box* box = new osgWidget::Box("vbox", osgWidget::Box::VERTICAL);
osgWidget::Input* input = new osgWidget::Input("input", "", 50);
input->setFont("fonts/VeraMono.ttf");
input->setFontColor(0.0f, 0.0f, 0.0f, 1.0f);
input->setFontSize(15);
input->setYOffset(input->calculateBestYOffset("y"));
input->setSize(400.0f, input->getText()->getCharacterHeight());
box->addWidget(input);
box->setOrigin(200.0f, 200.0f);
wm->addChild(box);
viewer.setUpViewInWindow(
50,
50,
static_cast<int>(wm->getWidth()),
static_cast<int>(wm->getHeight())
);
osg::Camera* camera = wm->createParentOrthoCamera();
viewer.addEventHandler(new osgWidget::MouseHandler(wm));
viewer.addEventHandler(new osgWidget::KeyboardHandler(wm));
viewer.addEventHandler(new osgWidget::ResizeHandler(wm, camera));
viewer.addEventHandler(new osgWidget::CameraSwitchHandler(wm, camera));
viewer.addEventHandler(new osgViewer::WindowSizeHandler());
wm->resizeAllWindows();
viewer.setSceneData(camera);
return viewer.run();
}
|