/** \fn ChannelBase::StoreInputChannels(const InputMap&) * \brief Sets starting channel for the each input in the input map. * \param input Map from cardinputid to input params. */ void ChannelBase::StoreInputChannels(const InputMap &inputs) { MSqlQuery query(MSqlQuery::InitCon()); InputMap::const_iterator it = inputs.begin(); for (; it != inputs.end(); ++it) { if ((*it)->name.isEmpty() || (*it)->startChanNum.isEmpty()) continue; query.prepare( "UPDATE cardinput " "SET startchan = :STARTCHAN " "WHERE cardinputid = :CARDINPUTID"); query.bindValue(":STARTCHAN", (*it)->startChanNum); query.bindValue(":CARDINPUTID", it.key()); if (!query.exec() || !query.isActive()) MythDB::DBError("StoreInputChannels", query); } }
//////////////////////////////////////////////////////////// ///Entrypoint of application //////////////////////////////////////////////////////////// int main() { gui.setScale(16); gui.m_debug = true; bool updateGUI = true; registerInputs(); // Create the main window sf::RenderWindow window(sf::VideoMode(g_screenW, g_screenH, 32), "Tower Of Hanoi"); // Start game loop while (window.isOpen()) { // Process events sf::Event Event; while (window.pollEvent(Event)) { // Close window : exit if (Event.type == sf::Event::Closed) window.close(); // Escape key : exit if ((Event.type == sf::Event::KeyPressed) && ((Event.key.code == g_keyboard.Escape) || (Event.key.code == g_keyboard.BackSpace)/*Alt+F4 support here*/)) window.close(); #pragma region Input //Update all keys for (InputMap::iterator mStart = buttons.begin(), mIter = mStart, mEnd = buttons.end(); mIter != mEnd; ++mIter) { mIter->second.update(); } //Check all keys, take actions, figure out if we need to update the GUI if (*buttons[LEFT]) { updateGUI = game.moveLeft(); } if (*buttons[RIGHT]) { updateGUI = game.moveRight(); } if (*buttons[UP]) { updateGUI = game.moveUp(); } if (*buttons[DOWN]) { updateGUI = game.moveDown(); } if (*buttons[ACTION]) { updateGUI = game.actionButton(); } if (*buttons[SCALEUP]) { updateGUI = gui.setScale(gui.getScale() + 1); } if (*buttons[SCALEDOWN]) { updateGUI = gui.setScale(gui.getScale() - 1); } if (*buttons[NUM0]) { updateGUI = game.returnDisc(); } if (*buttons[NUM1]) { updateGUI = game.handleDisc(0); } if (*buttons[NUM2]) { updateGUI = game.handleDisc(1); } if (*buttons[NUM3]) { updateGUI = game.handleDisc(2); } if (*buttons[NUM4]) { updateGUI = game.handleDisc(3); } if (*buttons[NUM5]) { updateGUI = game.handleDisc(4); } if (*buttons[NUM6]) { updateGUI = game.handleDisc(5); } if (*buttons[NUM7]) { updateGUI = game.handleDisc(6); } if (*buttons[NUM8]) { updateGUI = game.handleDisc(7); } if (*buttons[NUM9]) { updateGUI = game.handleDisc(8); } #pragma endregion } // Draw loop if (updateGUI) { window.clear(g_clearCol); gui.drawGame(window, game); window.display(); updateGUI = false; } } return EXIT_SUCCESS; }