Exemplo n.º 1
0
void Inspect::inspectObject(Object * o) {
    
    if (o==NULL) {
        currentObject = NULL;
        clearMenu();
    } else {
        if (currentObject!=o) {
            clearMenu();
            currentObject = o;
            createMenu();

        }
    }
}
Exemplo n.º 2
0
void TabWidget::changeMenu(int idx)
{
    if(idx == -1 || (uint)idx >= m_tab_ids.size())
        return clearMenu();

    WorkTab *tab = sWorkTabMgr.getWorkTab(m_tab_ids[idx]);
    if(!tab || tab->getActions().empty())
        return clearMenu();

    clearMenu();

    const std::vector<QAction*>& acts = tab->getActions();
    for(quint32 i = 0; i < acts.size(); ++i)
        m_menu->addAction(acts[i]);
    m_menuBtn->setEnabled(true);
}
void SystemTrayMenu::init()
{
    mVKListMenu = new QMenu(gettext("Virtual Keyboard"), this);
    mSkinMenu = new QMenu(gettext("Skin"), this);
    mMozcHiraganaMenu = new QMenu(gettext("Mozc Edit mode"), this);
    mMozcToolMenu = new QMenu(gettext("Mozc Tool"), this);
    QObject::connect(this, SIGNAL(aboutToHide()), this,
        SLOT(clearMenu()));

    QObject::connect(this, SIGNAL(aboutToShow()), this,
        SLOT(triggerUpdateVKListMenu()));

    QObject::connect(this, SIGNAL(aboutToShow()), this,
        SLOT(truggerUpdateMozcHiraganaMenu()));

    QObject::connect(this, SIGNAL(aboutToShow()), this,
        SLOT(truggerUpdateMozcToolMenu()));

    QObject::connect(this, SIGNAL(aboutToShow()), this,
        SLOT(triggerUpdateIMListMenu()));

    QObject::connect(this, SIGNAL(triggered(QAction*)), this,
        SLOT(menuItemOnClick(QAction *)));

    QObject::connect(mAgent, SIGNAL(execMenu(const QList<KimpanelProperty>)),
        this, SLOT(execMenu(const QList<KimpanelProperty>)));

    QObject::connect(mAgent, SIGNAL(registerProperties(const QList<KimpanelProperty>)),
        this, SLOT(registerProperties(const QList<KimpanelProperty>)));

    QObject::connect(mAgent, SIGNAL(updateProperty(KimpanelProperty)), this,
        SLOT(updateProperty(KimpanelProperty)));
      updateMainMenu();
}
Exemplo n.º 4
0
void MainWindow::on_actionDisconnect_triggered()
{
    if (!db->isOpen()) {
        return;
    }
    db->close();
    status->clear();
    clearMenu(ui->menuBar, ui->mainToolBar);
}
Exemplo n.º 5
0
void loadMenu(std::string menu) {
	clearMenu();
	danmakux.menuChoice = 0;
	if (danmakux.level.running) closeScript(&danmakux.level);
	std::string menufile = menu + ".lua";
	loadScript(&danmakux.menu, menufile);
	regFunction(&danmakux.menu, "addMenuChoice", addMenuItem);
	regFunction(&danmakux.menu, "setBGM", setBGM);
	regFunction(&danmakux.menu, "setBG", setBG);
	runFunction(&danmakux.menu, "start");
}
Exemplo n.º 6
0
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Back to main menu:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int backToMainMenu(){
    clearMenu(&commonMenu);
    buildMainMenu();
	if (coverArt){
		oslDeleteImage(coverArt);
		coverArt = NULL;
	}
	coverArtFailed = 0;
    currentStatus = -1;
	return 0;
}
Exemplo n.º 7
0
void LCDST7565::enterModulationMenu(int menu)
{
	if(historyPos > MENU_HISTORY_SIZE - 1) return;
	menuHistory[historyPos] = currentMenu;
	itemIndexHistory[historyPos] = _item_index;
	drawIndexHistory[historyPos] = _draw_index;
	clineHistory[historyPos] = _current_line;
	historyPos++;
	currentMenu = menu;
	clearMenu();
	makeModulationMenu(menu);
	update();
}
Exemplo n.º 8
0
void PsiTabWidget::menu_aboutToShow() {
	clearMenu(menu_);
	bool vis = false;
	for (int i = 0; i < tabBar_->count(); i++) {
		QRect r = tabBar_->tabRect(i);
		bool newvis = tabBar_->rect().contains(r);
		if (newvis != vis) {
			menu_->addSeparator ();
			vis = newvis;
		}
		menu_->addAction(tabBar_->tabText(i))->setData(i+1);
	}
	emit aboutToShowMenu(menu_);
}
Exemplo n.º 9
0
void FileHistoryHandler::itemTriggered(QAction *action)
{
  if(action == clearAction)
    clearMenu();
  else
  {
    // Move file up in the list
    QString fname = action->data().toString();
    filePaths.removeAll(fname);
    filePaths.prepend(fname);
    updateMenu();

    emit fileSelected(fname);
  }
}
Exemplo n.º 10
0
void LCDST7565::enterMenu(int m)
{
	if(historyPos > MENU_HISTORY_SIZE - 1) return;
	menuHistory[historyPos] = currentMenu;
	itemIndexHistory[historyPos] = _item_index;
	drawIndexHistory[historyPos] = _draw_index;
	clineHistory[historyPos] = _current_line;
	historyPos++;
	currentMenu = m;
	// clear the current menu
	clearMenu();
	makeMenu(m);
	//lastDrawIndex = _draw_index;
	//lastItemIndex = _item_index;
	update();
}
Exemplo n.º 11
0
void loadLevel(std::string lvl) {
	clearMenu();
	clearPause();
	buildPause();
	danmakux.framesPast = 0;
	if (danmakux.menu.running) closeScript(&danmakux.menu);
	if (danmakux.level.running) closeScript(&danmakux.level);
	std::string filename = "lvl_" + lvl + ".lua";
	loadScript(&danmakux.level, filename);
	regFunction(&danmakux.level, "setBGM", setBGM);
	regFunction(&danmakux.level, "setBG", setBG);
	regFunction(&danmakux.level, "addEnemy", addEnemy);
	regFunction(&danmakux.level, "elapsedTime", timePassed);
	regFunction(&danmakux.level, "win", winLevel);
	runFunction(&danmakux.level, "start");
	al_stop_samples();
	al_play_sample(danmakux.bgm, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_LOOP, NULL);
}
Exemplo n.º 12
0
void DrasculaEngine::moveCursor() {
	copyBackground();

	updateRefresh_pre();
	moveCharacters();
	updateRefresh();

	if (!strcmp(textName, "hacker") && _hasName) {
		if (_color != kColorRed && !_menuScreen)
			color_abc(kColorRed);
	} else if (!_menuScreen && _color != kColorLightGreen)
		color_abc(kColorLightGreen);
	if (_hasName && !_menuScreen)
		centerText(textName, _mouseX, _mouseY);
	if (_menuScreen)
		showMenu();
	else if (_menuBar)
		clearMenu();
}
Exemplo n.º 13
0
void QRecentFilesMenu::updateRecentFileActions()
{
    int numRecentFiles = qMin(m_files.size(), maxCount());

    clear();

    for (int i = 0; i < numRecentFiles; ++i) {
        QString strippedName = QFileInfo(m_files[i]).fileName();

        QString text = m_format;
        text.replace(QLatin1String("%d"), QString::number(i + 1));
        text.replace(QLatin1String("%s"), strippedName);

        QAction* recentFileAct = addAction(text);
        recentFileAct->setData(m_files[i]);
    }
    addSeparator();
    addAction(QIcon(":/images/cancel.png"),tr("Clear Menu"), this, SLOT(clearMenu()));

    setEnabled(numRecentFiles > 0);
}
Exemplo n.º 14
0
void LCDST7565::menuBack()
{
	if(_menu_items[_item_index].type == MENU_ITEM_TYPE_INLINE_INT)
	{
		int val = this->updateInlineInt(_menu_items[_item_index].value,
				--_menu_items[_item_index].inlineValue);
		_menu_items[_item_index].inlineValue = val;
	}
	else
	{
		if(historyPos <= 1) return;
		historyPos--;
		currentMenu = menuHistory[historyPos];
		// clear the current menu
		valueMenuActive = false;
		clearMenu();
		makeMenu(currentMenu);
		_item_index = itemIndexHistory[historyPos];
		_draw_index = drawIndexHistory[historyPos];
		_current_line = clineHistory[historyPos];
	}
	update();
}
Exemplo n.º 15
0
void gameloop() {
	while (!danmakux.done) {
		ALLEGRO_EVENT ev;
		al_wait_for_event(event_queue, &ev);
		if (ev.type == ALLEGRO_EVENT_TIMER) {
			redraw = true;
			update();
			gameLogic();
		}
		else if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
			danmakux.done = true;
		}
		else if (ev.type == ALLEGRO_EVENT_KEY_DOWN) {
			if (danmakux.state_playing && !danmakux.state_paused) {
				switch (ev.keyboard.keycode) {
					case ALLEGRO_KEY_UP:
						danmakux.player->moveu = true;
						break;
					case ALLEGRO_KEY_DOWN:
						danmakux.player->moved = true;
						break;
					case ALLEGRO_KEY_LEFT:
						danmakux.player->movel = true;
						break;
					case ALLEGRO_KEY_RIGHT:
						danmakux.player->mover = true;
						break;
					case ALLEGRO_KEY_Z:
						danmakux.player->fireFront = 1;
						break;
					case ALLEGRO_KEY_X:
						danmakux.player->fireBack = 1;
						break;
					case ALLEGRO_KEY_C:
						danmakux.player->fireSide = 1;
						break;
					case ALLEGRO_KEY_LSHIFT:
						danmakux.player->focused = true;
						break;
					case ALLEGRO_KEY_ESCAPE:
						break;
				}
			}
			else if (danmakux.state_menu) {
				std::stringstream levelno;
				std::string level;
				switch (ev.keyboard.keycode) {
					case ALLEGRO_KEY_UP:
						danmakux.menuChoice -= 1;
						if (danmakux.menuChoice < 0) danmakux.menuChoice = danmakux.menuitems.size()-1;
						break;
					case ALLEGRO_KEY_DOWN:
						danmakux.menuChoice = (danmakux.menuChoice + 1) % danmakux.menuitems.size();
						break;
					case ALLEGRO_KEY_LEFT:
						danmakux.menuChoice -= 1;
						if (danmakux.menuChoice < 0) danmakux.menuChoice = danmakux.menuitems.size()-1;
						break;
					case ALLEGRO_KEY_RIGHT:
						danmakux.menuChoice = (danmakux.menuChoice + 1) % danmakux.menuitems.size();
						break;
					case ALLEGRO_KEY_Z:
						switch (danmakux.menuChoice) {
						case 0:
							clearMenu();
							danmakux.state_menu = false;
							danmakux.state_playing = true;
							danmakux.state_paused = false;
							danmakux.state_dialog = false;
							levelno << danmakux.currentLevel;
							level = "level" + levelno.str();
							plyr_load(danmakux.player, "machine");
							loadLevel(level);
							break;
						case 1:
							break;
						case 2:
							danmakux.done = true;
							break;
						}
						break;
					case ALLEGRO_KEY_X:
						danmakux.menuChoice = 2;
						break;
				}
			}
			else if (danmakux.state_paused) {
				switch (ev.keyboard.keycode) {
					case ALLEGRO_KEY_UP:
						danmakux.menuChoice -= 1;
						if (danmakux.menuChoice < 0) danmakux.menuChoice = danmakux.pauseitems.size()-1;
						break;
					case ALLEGRO_KEY_DOWN:
						danmakux.menuChoice = (danmakux.menuChoice + 1) % danmakux.pauseitems.size();
						break;
					case ALLEGRO_KEY_LEFT:
						danmakux.menuChoice -= 1;
						if (danmakux.menuChoice < 0) danmakux.menuChoice = danmakux.pauseitems.size()-1;
						break;
					case ALLEGRO_KEY_RIGHT:
						danmakux.menuChoice = (danmakux.menuChoice + 1) % danmakux.pauseitems.size();
						break;
					case ALLEGRO_KEY_Z:
						break;
					case ALLEGRO_KEY_X:
						danmakux.fireBomb = true;
						break;
				}
			}
		}
		else if (ev.type == ALLEGRO_EVENT_KEY_UP) {
			if (danmakux.state_playing && !danmakux.state_paused) {
				switch (ev.keyboard.keycode) {
					case ALLEGRO_KEY_UP:
						danmakux.player->moveu = false;
						break;
					case ALLEGRO_KEY_DOWN:
						danmakux.player->moved = false;
						break;
					case ALLEGRO_KEY_LEFT:
						danmakux.player->movel = false;
						break;
					case ALLEGRO_KEY_RIGHT:
						danmakux.player->mover = false;
						break;
					case ALLEGRO_KEY_Z:
						danmakux.player->fireFront = 0;
						break;
					case ALLEGRO_KEY_X:
						danmakux.player->fireBack = 0;
						break;
					case ALLEGRO_KEY_C:
						danmakux.player->fireSide = 0;
						break;
					case ALLEGRO_KEY_LSHIFT:
						danmakux.player->focused = false;
						break;
				}
			}
		}

		if (redraw && al_is_event_queue_empty(event_queue)) {
			redrawDisp();
		}
	}
}
Exemplo n.º 16
0
MainWindow::MainWindow(QWidget* parent)
  : CGAL::Qt::DemosMainWindow(parent)
{
  ui = new Ui::MainWindow;
  ui->setupUi(this);

  // remove the Load Script menu entry, when the demo has not been compiled with QT_SCRIPT_LIB
#if !defined(QT_SCRIPT_LIB)
  ui->menuBar->removeAction(ui->actionLoad_Script);
#endif
  
  // Save some pointers from ui, for latter use.
  sceneView = ui->sceneView;
  viewer = ui->viewer;

  // do not save the state of the viewer (anoying)
  viewer->setStateFileName(QString::null);

  // setup scene
  scene = new Scene(this);
  viewer->setScene(scene);

  {
    QShortcut* shortcut = new QShortcut(QKeySequence(Qt::ALT+Qt::Key_Q), this);
    connect(shortcut, SIGNAL(activated()),
            this, SLOT(setFocusToQuickSearch()));
  }

  proxyModel = new QSortFilterProxyModel(this);
  proxyModel->setSourceModel(scene);

  connect(ui->searchEdit, SIGNAL(textChanged(QString)),
          proxyModel, SLOT(setFilterFixedString(QString)));
  sceneView->setModel(proxyModel);

  // setup the sceneview: delegation and columns sizing...
  sceneView->setItemDelegate(new SceneDelegate(this));

  sceneView->header()->setStretchLastSection(false);
  sceneView->header()->setSectionResizeMode(Scene::NameColumn, QHeaderView::Stretch);
  sceneView->header()->setSectionResizeMode(Scene::NameColumn, QHeaderView::Stretch);
  sceneView->header()->setSectionResizeMode(Scene::ColorColumn, QHeaderView::ResizeToContents);
  sceneView->header()->setSectionResizeMode(Scene::RenderingModeColumn, QHeaderView::Fixed);
  sceneView->header()->setSectionResizeMode(Scene::ABColumn, QHeaderView::Fixed);
  sceneView->header()->setSectionResizeMode(Scene::VisibleColumn, QHeaderView::Fixed);
  sceneView->resizeColumnToContents(Scene::ColorColumn);
  sceneView->resizeColumnToContents(Scene::RenderingModeColumn);
  sceneView->resizeColumnToContents(Scene::ABColumn);
  sceneView->resizeColumnToContents(Scene::VisibleColumn);

  // setup connections
  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
          this, SLOT(updateInfo()));
  
  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
          this, SLOT(updateDisplayInfo()));

  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
          viewer, SLOT(updateGL()));

  connect(scene, SIGNAL(updated()),
          viewer, SLOT(updateGL()));

  connect(scene, SIGNAL(updated()),
          this, SLOT(selectionChanged()));

  connect(scene, SIGNAL(itemAboutToBeDestroyed(Scene_item*)),
          this, SLOT(removeManipulatedFrame(Scene_item*)));

  connect(scene, SIGNAL(updated_bbox()),
          this, SLOT(updateViewerBBox()));

  connect(scene, SIGNAL(selectionChanged(int)),
          this, SLOT(selectSceneItem(int)));

  connect(sceneView->selectionModel(), 
          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
          this, SLOT(updateInfo()));

  connect(sceneView->selectionModel(), 
          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
          this, SLOT(updateDisplayInfo()));

  connect(sceneView->selectionModel(), 
          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
          this, SLOT(selectionChanged()));

  sceneView->setContextMenuPolicy(Qt::CustomContextMenu);
  connect(sceneView, SIGNAL(customContextMenuRequested(const QPoint & )),
          this, SLOT(showSceneContextMenu(const QPoint &)));

  connect(viewer, SIGNAL(selected(int)),
          this, SLOT(selectSceneItem(int)));
  connect(viewer, SIGNAL(selectedPoint(double, double, double)),
          this, SLOT(showSelectedPoint(double, double, double)));

  connect(viewer, SIGNAL(selectionRay(double, double, double, 
                                      double, double, double)),
          scene, SIGNAL(selectionRay(double, double, double,
                                     double, double, double)));

  connect(viewer, SIGNAL(requestContextMenu(QPoint)),
          this, SLOT(contextMenuRequested(QPoint)));

  // The contextMenuPolicy of infoLabel is now the default one, so that one
  // can easily copy-paste its text.
  // connect(ui->infoLabel, SIGNAL(customContextMenuRequested(const QPoint & )),
  //         this, SLOT(showSceneContextMenu(const QPoint &)));

  connect(ui->actionRecenterScene, SIGNAL(triggered()),
          viewer, SLOT(update()));

  connect(ui->actionAntiAliasing, SIGNAL(toggled(bool)),
          viewer, SLOT(setAntiAliasing(bool)));

  connect(ui->actionDraw_two_sides, SIGNAL(toggled(bool)),
          viewer, SLOT(setTwoSides(bool)));

  // add the "About CGAL..." and "About demo..." entries
  this->addAboutCGAL();
  this->addAboutDemo(":/cgal/Polyhedron_3/about.html");

  // Connect the button "addButton" with actionLoad
  ui->addButton->setDefaultAction(ui->actionLoad);
  // Same with "removeButton" and "duplicateButton"
  ui->removeButton->setDefaultAction(ui->actionErase);
  ui->duplicateButton->setDefaultAction(ui->actionDuplicate);

  // Connect actionQuit (Ctrl+Q) and qApp->quit()
  connect(ui->actionQuit, SIGNAL(triggered()),
          this, SLOT(quit()));

  // Connect "Select all items"
  connect(ui->actionSelect_all_items, SIGNAL(triggered()),
          this, SLOT(selectAll()));

  // Recent files menu
  this->addRecentFiles(ui->menuFile, ui->actionQuit);
  connect(this, SIGNAL(openRecentFile(QString)),
	  this, SLOT(open(QString)));

  // Reset the "Operation menu"
  clearMenu(ui->menuOperations);

#ifdef QT_SCRIPT_LIB
  std::cerr << "Enable scripts.\n";
  script_engine = new QScriptEngine(this);
  qScriptRegisterMetaType<Scene_item*>(script_engine,
                                       myScene_itemToScriptValue,
                                       myScene_itemFromScriptValue);
#  ifdef QT_SCRIPTTOOLS_LIB
  QScriptEngineDebugger* debugger = new QScriptEngineDebugger(this);
  debugger->setObjectName("qt script debugger");
  QAction* debuggerMenuAction = 
    menuBar()->addMenu(debugger->createStandardMenu());
  debuggerMenuAction->setText(tr("Qt Script &debug"));
  for(unsigned int i = 0; i < 9; ++i)
  {
    QDockWidget* dock = new QDockWidget(debug_widgets_names[i], this);
    dock->setObjectName(debug_widgets_names[i]);
    dock->setWidget(debugger->widget(debug_widgets[i]));
    this->addDockWidget(Qt::BottomDockWidgetArea, dock);
    dock->hide();
  }
  debugger->setAutoShowStandardWindow(false);
  debugger->attachTo(script_engine);
#  endif // QT_SCRIPTTOOLS_LIB
  QScriptValue fun = script_engine->newFunction(myPrintFunction);
  script_engine->globalObject().setProperty("print", fun);
  
  //  evaluate_script("print('hello', 'world', 'from QtScript!')");
  QScriptValue mainWindowObjectValue = script_engine->newQObject(this);
  script_engine->globalObject().setProperty("main_window", mainWindowObjectValue);

  QScriptValue sceneObjectValue = script_engine->newQObject(scene);
  mainWindowObjectValue.setProperty("scene", sceneObjectValue);
  script_engine->globalObject().setProperty("scene", sceneObjectValue);

  QScriptValue viewerObjectValue = script_engine->newQObject(viewer);
  mainWindowObjectValue.setProperty("viewer", viewerObjectValue);
  script_engine->globalObject().setProperty("viewer", viewerObjectValue);

  QScriptValue cameraObjectValue = script_engine->newQObject(viewer->camera());
  viewerObjectValue.setProperty("camera", cameraObjectValue);
  script_engine->globalObject().setProperty("camera", cameraObjectValue);

  evaluate_script("var plugins = new Array();");
#  ifdef QT_SCRIPTTOOLS_LIB
  QScriptValue debuggerObjectValue = script_engine->newQObject(debugger);
  script_engine->globalObject().setProperty("debugger", debuggerObjectValue);
#  endif
#endif

  readSettings(); // Among other things, the column widths are stored.

  // Load plugins, and re-enable actions that need it.
  loadPlugins();

  // Setup the submenu of the View menu that can toggle the dockwidgets
  Q_FOREACH(QDockWidget* widget, findChildren<QDockWidget*>()) {
    ui->menuDockWindows->addAction(widget->toggleViewAction());
  }
Exemplo n.º 17
0
int main()
#endif
{
	int quit = 0;
	int timer = 0;

	srand(time(NULL));
	Context context = FIRSTMENU;
	SDL_Event event;
	SDL_Window *window = NULL;
	SDL_Surface *windowSurface = NULL;
	SDL_Renderer *windowRenderer = NULL;
	Menu *menu = NULL;
	Game *game = NULL;
	
	/* Init the window or exit if failure. */
	if(!init(&window))
		return EXIT_FAILURE;

	/* Make the window renderer and the window surface */
	windowRenderer = SDL_CreateRenderer(window, 0, SDL_RENDERER_TARGETTEXTURE);
	if(windowRenderer == NULL)
		printf("%s \n", SDL_GetError());

	windowSurface = SDL_GetWindowSurface(window);

	/* Make all context of the game. */
	menu = initMenu(windowRenderer);
	game = initGame(windowRenderer);

	while(!quit)
	{
		/* event loop. */
		while(SDL_PollEvent(&event))
		{
			if(event.type == SDL_QUIT)
				quit = 1;

			else if(event.type == SDL_KEYDOWN)
			{
				const Uint8* keyPressed = SDL_GetKeyboardState(NULL);
				if(context == GAME)
				{
					/* Handle the translation of the blocks */
					if(event.key.keysym.scancode == SDL_SCANCODE_LEFT || event.key.keysym.scancode == SDL_SCANCODE_RIGHT || event.key.keysym.scancode == SDL_SCANCODE_DOWN)
					{
						if(event.key.keysym.scancode == SDL_SCANCODE_LEFT)
							moveCurrentBlock(game, LEFT);
						if(event.key.keysym.scancode == SDL_SCANCODE_RIGHT)
							moveCurrentBlock(game, RIGHT);
						if(event.key.keysym.scancode == SDL_SCANCODE_DOWN)
							moveCurrentBlock(game, DOWN);
					}

					/* Handle the rotation of the blocks */
					else if(event.key.keysym.sym == SDLK_w || event.key.keysym.sym == SDLK_x)
					{
						/* Check the direction the user want to move */
						Direction direction = NONE;
						if(keyPressed[SDL_SCANCODE_RIGHT])
							direction = RIGHT;
						else if(keyPressed[SDL_SCANCODE_LEFT])
							direction = LEFT;

						if(event.key.keysym.sym == SDLK_w)
						{
							rotateCurrentBlock(game, 1, direction);
						}
						else
							rotateCurrentBlock(game, -1, direction);
					}

					else if(event.key.keysym.scancode == SDL_SCANCODE_SPACE)
					{
						putDownCurrentBlock(game);
					}
				}
			}
		}

		SDL_RenderClear(windowRenderer);

		/* Call the correct context */
		if(context == FIRSTMENU)
			firstMenu(menu, windowRenderer, &context);
		else if(context == QUIT)
			quit = 1;
		else if(context == GAME)
			updateGame(game);

		SDL_RenderPresent(windowRenderer);
		fpsManager(&timer);
	}

	/* Clear the allocated memory */
	clearMenu(menu);
	clearGame(game);
	SDL_DestroyRenderer(windowRenderer);
	SDL_FreeSurface(windowSurface);
	SDL_DestroyWindow(window);
	clear();

	return 0;
}