// ---------------------------------------------------------------------------------------------------- // // Public // ---------------------------------------------------------------------------------------------------- // ParkingShield::ParkingShield(void) : sevenSeg(sevensegment_pins) { setupOutput(); setupInput(); setAllLeds(false); }
void Sample::setupEngine() { // Create root node and load plugins which are defined inside our plugin.cfg mRoot = new Ogre::Root(PLUGIN_CFG); if (!mRoot->restoreConfig()) { mRoot->showConfigDialog(); } // Create our main window mWindow = mRoot->initialise(true, "noesisGUI: Basic Ogre Sample"); // Parse resources parseResources(); // start script parsing Ogre::ResourceGroupManager::getSingletonPtr()->initialiseResourceGroup(Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); // Create the scenemanger mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC); mCamera = mSceneMgr->createCamera("MyCam"); // Setup NoesisGUI Noesis_Init(); Noesis_LoadXAML(&mUIRoot, &mUIRenderer, "Time.xaml"); //Noesis_LoadXAML(&mUIRoot, &mUIRenderer, "Menu.xaml", "Themes/NoesisStyle.xaml"); Noesis_RendererAntialiasingMode(mUIRenderer, NsAntialiasingMode_PPAA); Noesis_RendererTessQuality(mUIRenderer, NsTessellationQuality_High); // Setup input setupInput(); // Add frame listener mRoot->addFrameListener(this); }
void SampleContext::setup() { mWindow = createWindow(); setupInput(); //locateResource(); createDummyScene(); }
// ---------------------------------------------------------------------------------------------------- // // Public // ---------------------------------------------------------------------------------------------------- // ParkingShield::ParkingShield(void) : sevenSeg(sevensegment_pins), buttonS1(Device::ANALOG_PIN_0), buttonS2(Device::ANALOG_PIN_1) { setupOutput(); setupInput(); setAllLeds(false); }
bool OgreBaseApp::go(void) { #ifdef _DEBUG mPluginsCfg = "plugins_d.cfg"; mResourcesCfg = "resources_d.cfg"; #else mPluginsCfg = "plugins.cfg"; mResourcesCfg = "resources.cfg"; #endif if (!setup()) return false; mRoot->initialise(false); //do NOT create a window //connect SDL and Ogre here Ogre::NameValuePairList misc; #ifdef WIN32 SDL_SysWMinfo wmInfo; SDL_VERSION(&wmInfo.version); SDL_GetWMInfo(&wmInfo); size_t winHandle = reinterpret_cast<size_t>(wmInfo.window); size_t winGlContext = reinterpret_cast<size_t>(wmInfo.hglrc); misc["externalWindowHandle"] = StringConverter::toString(winHandle); misc["externalGLContext"] = StringConverter::toString(winGlContext); #else misc["currentGLContext"] = Ogre::String("True"); #endif //NOW we make a RenderWindow! mWindow = mRoot->createRenderWindow("MainRenderWindow", mWindowWidth, mWindowHeight, false, &misc); mWindow->setVisible(true); //just have Ogre create our window for us //mWindow = mRoot->initialise(true, "OgreBaseApp Render Window"); //set the default mipmap level Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5); //initialize the resource groups Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); mSceneMgr = mRoot->createSceneManager("DefaultSceneManager"); createCamera(); createViewport(); createScene(); setupInput(); mRoot->addFrameListener(this); mRoot->startRendering(); return true; }
OISInputWindow::OISInputWindow(RenderWindow& renderWindow) : m_inputManager(nullptr) , m_mouse(nullptr) , m_keyboard(nullptr) , m_uiMouse(nullptr) , m_uiKeyboard(nullptr) , m_shutdownRequested(false) { setupInput(renderWindow.handle()); }
/** Calculate the derivatives for a set of points on the spline * * @param out :: The array to store the derivatives in * @param xValues :: The array of x values we wish to know the derivatives of * @param nData :: The size of the arrays * @param order :: The order of the derivatives o calculate */ void CubicSpline::derivative1D(double* out, const double* xValues, size_t nData, const size_t order) const { int n = getAttribute("n").asInt(); boost::scoped_array<double> x(new double[n]); boost::scoped_array<double> y(new double[n]); //setup the reference points and calculate if(m_recalculateSpline) setupInput(x,y,n); calculateDerivative(out,xValues,nData,order); }
void ApplicationContext::setup() { mWindow = createWindow(); setupInput(mGrabInput); locateResources(); #ifdef OGRE_BUILD_COMPONENT_RTSHADERSYSTEM initialiseRTShaderSystem(); #endif loadResources(); // adds context as listener to process context-level (above the sample level) events mRoot->addFrameListener(this); #if OGRE_PLATFORM != OGRE_PLATFORM_ANDROID Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this); #endif }
void StateLevel::init() { // Setup callbacks to user input setupInput(); // Setup message callbacks setupMessages(); // Setup level scene nodes setupScene(); setupLevel(); setupTrackers(); m_waveManager.setup( GAME_MANAGER.getLevelData() ); m_waveManager.start(); m_iKeyEscape = INPUT_MANAEGER.addCallback( InputManager::Event_KeyUp, sf::Keyboard::Escape, [this](){ MSG_SYSTEM.sendPost( c_msgStateChange, StateType::State_map ); } ); }
CTest(): spApp(core::IApplication::Create()) { spApp->addTask(core::PTask(new core::CRenderTask(2))); spApp->addTask(core::PTask(new core::CGameTask(1))); spApp->addTask(core::PTask(new core::CInputTask(0))); //инициализация рендера setupGraphics(); //инициализация ввода setupInput(); //инициализация камер setupCameras(); spApp->Run(); }
int init () { enum LEDs led1,led2,led3,led4; led1 = GREEN; led2 = GREEN; led3 = GREEN; led4 = GREEN; uint8_t led[4] = {led1,led2,led3,led4}; /* uint16_t motor1 = Motor1; uint16_t motor2 = Motor2; uint16_t motor3 = Motor3; uint16_t motor4 = Motor4; uint16_t flipflop = FlipFlop; uint16_t input = Input;*/ struct Motor motor; motor.Motor1=171; motor.Motor2=172; motor.Motor3=173; motor.Motor4=174; motor.FlipFlop=175; motor.Input=176; if (isInitialized) { return 1 ; } if (!init_GPIO ()) { return 0 ; } fd_act = open ("/dev/ttyO0", O_RDWR | O_NOCTTY | O_NDELAY) ; if (fd_act < 0) { return 0 ; } int flags = fcntl(fd_act, F_GETFL, 0) ; fcntl(fd_act, F_SETFL, flags | O_NONBLOCK); //read calls are non blocking //set port options struct termios options; //Get the current options for the port tcgetattr (fd_act, &options); //Set the baud rates to 115200 cfsetispeed (&options, B115200); cfsetospeed (&options, B115200); options.c_cflag |= (CLOCAL | CREAD); //Enable the receiver and set local mode options.c_iflag = 0; //clear input options options.c_lflag = 0; //clear local options options.c_oflag &= ~OPOST; //clear output options (raw output) //Set the new options for the port tcsetattr (fd_act, TCSANOW, &options); setupInput (motor.Input) ; setupOutput (motor.FlipFlop) ; clear_GPIO (motor.FlipFlop) ; usleep (1000) ; set_GPIO (motor.FlipFlop) ; setupOutput (motor.Motor1); setupOutput (motor.Motor2); setupOutput (motor.Motor3); setupOutput (motor.Motor4); set_GPIO (motor.Motor1) ; set_GPIO (motor.Motor2) ; set_GPIO (motor.Motor3) ; set_GPIO (motor.Motor4) ; //configure motors uint8_t reply[256]; int m; for (m = 0; m < 4; m++) { clear_GPIO (motor.Motor1 + m); sendCmd (0xe0, reply, 2); if (reply[0] != 0xe0 || reply[1] != 0x00) { printf ("motor%d cmd=0x%02x reply=0x%02x\n", m + 1, (int) reply[0], (int) reply[1]); } usleep(1000); sendCmd (m + 1, reply, 1); set_GPIO (motor.Motor1 + m); } //all select lines active clear_GPIO (motor.Motor1) ; clear_GPIO (motor.Motor2) ; clear_GPIO (motor.Motor3) ; clear_GPIO (motor.Motor4) ; //start multicast sendCmd (0xa0, reply, 1); sendCmd (0xa0, reply, 1); sendCmd (0xa0, reply, 1); sendCmd (0xa0, reply, 1); sendCmd (0xa0, reply, 1); //reset IRQ flipflop - on error 176 reads 1, this code resets 176 to 0 clear_GPIO (motor.FlipFlop) ; set_GPIO (motor.FlipFlop); set(led) ; signal(SIGINT,terminate_interrupt); //Interrupts for Ctrl+C. isInitialized = 1 ; return 1 ; }
void TestContext::setup() { // standard setup mWindow = createWindow(); mWindow->setDeactivateOnFocusChange(false); setupInput(false);// grab input, since moving the window seemed to change the results (in Linux anyways) locateResources(); loadResources(); Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5); mRoot->addFrameListener(this); #if OGRE_PLATFORM != OGRE_PLATFORM_ANDROID Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this); #endif // get the path and list of test plugins from the config file Ogre::ConfigFile testConfig; testConfig.load(mFSLayer->getConfigFilePath("tests.cfg")); mPluginDirectory = testConfig.getSetting("TestFolder"); Ogre::ConfigFile::SectionIterator sections = testConfig.getSectionIterator(); // parse for the test sets and plugins that they're made up of for (; sections.hasMoreElements(); sections.moveNext()) { Ogre::String setName = sections.peekNextKey(); if (setName != "") { mTestSets[setName] = Ogre::StringVector(); Ogre::ConfigFile::SettingsMultiMap::iterator it = sections.peekNextValue()->begin(); for (; it != sections.peekNextValue()->end(); ++it) mTestSets[setName].push_back(it->second); } } // timestamp for the filename char temp[25]; time_t raw = time(0); strftime(temp, 19, "%Y_%m_%d_%H%M_%S", gmtime(&raw)); Ogre::String filestamp = Ogre::String(temp); // name for this batch (used for naming the directory, and uniquely identifying this batch) Ogre::String batchName = mTestSetName + "_" + filestamp; // a nicer formatted version for display strftime(temp, 20, "%Y-%m-%d %H:%M:%S", gmtime(&raw)); Ogre::String timestamp = Ogre::String(temp); if (mReferenceSet) batchName = "Reference"; else if (mBatchName != "AUTO") batchName = mBatchName; // set up output directories setupDirectories(batchName); // an object storing info about this set mBatch = new TestBatch(batchName, mTestSetName, timestamp, mWindow->getWidth(), mWindow->getHeight(), mOutputDir + batchName + "/"); mBatch->comment = mComment; OgreBites::Sample* firstTest = loadTests(mTestSetName); runSample(firstTest); }