Esempio n. 1
0
int main() {
    clrscr();
    bordercolor(0);
    bgcolor(6);

    renderMenu(100);

    textcolor(7);
    gotoxy(0, 1);
    updateStatus(' ');
    cursor(1);
    while(1) {
        char c;
/*
        uint8_t row;
        uint8_t col;
        for (row = 0;  row < 16;  row++) {
            gotoxy(0, row + 3);
            cprintf("%3d ", row * 16);
            for (col = 0;  col < 16;  col++) {
                cputc(row * 16 + col);
                cputc(' ');
            }
        }
*/
        c = cgetc();

        if (c == 20) {
            // backspace
        } else if (c == 13) {
            // Return
        } else if (c == 157) {
            // Left
            uint8_t xpos = wherex() - 1;
            gotox(xpos);
        } else if (c == 29) {
            // Right
            uint8_t xpos = wherex() + 1;
            gotox(xpos);
        } else if (c == 17) {
            // Down
            uint8_t ypos = wherey() + 1;
            gotoy(ypos);
        } else if (c == 145) {
            // Up
            uint8_t ypos = wherey() - 1;
            gotoy(ypos);
        } else if (c == 19) {
            // Pos1
        } else if (c == 3) {
            // ESC -> Menu
            processMenu();
        } else {
            cputc(c);
        }        

        
        updateStatus(c);
    }
}
Esempio n. 2
0
int MyGame::process(){
	int errorCode;
	do{
		this->gameTimer.resetFrameTime();
		switch (gameState){
		case INITIATE:
			errorCode = init();
			break;
		case MAIN_MENU:
			processMenu();
			break;
		case NEW_GAME:
			processNewGame();
			break;
		case RUNNING:
			processGameplay();
			break;
		case WIN:
		case GAME_OVER:
			processEndGame();
			break;
		case EXIT:
			cleanUp();
			break;
		}
		draw();
	} while (gameState != EXIT);
    return gameState;
}
Esempio n. 3
0
int main() {
	bool quit;
	int choice;
	while(true) {
		printCommands();
		cin >> choice;
		quit = processMenu(choice);
		if (quit) {
			break;
		}
	}
}
Esempio n. 4
0
void CDatabaseItem::keyPressed(QKeyEvent * e)
{
#ifdef DEBUG
  qDebug("CDatabaseItem::keyPressed()");
#endif

  if (isBlocked())
    return;

  if (e->key() == QListViewItem::Key_Delete)
    processMenu(MENU_DELETE);
  else
    CDatabaseListViewItem::keyPressed(e);
}
Esempio n. 5
0
void ZLMenuVisitor::processMenu(ZLMenu &menu) {
	const ZLMenu::ItemVector &items = menu.items();
	for (ZLMenu::ItemVector::const_iterator it = items.begin(); it != items.end(); ++it) {
		switch ((*it)->type()) {
			case ZLMenu::Item::ITEM:
				processItem((ZLMenubar::PlainItem&)**it);
				break;
			case ZLMenu::Item::SUBMENU:
			{
				ZLMenubar::Submenu &submenu = (ZLMenubar::Submenu&)**it;
				processSubmenuBeforeItems(submenu);
				processMenu(submenu);
				processSubmenuAfterItems(submenu);
				break;
			}
			case ZLMenu::Item::SEPARATOR:
				processSeparator((ZLMenubar::Separator&)**it);
				break;
		}							
	}
}
Esempio n. 6
0
void *Commands::processEvent(Event *e)
{
    BarShow *b;
    ProcessMenuParam *mp;
    switch (e->type()){
    case EventPluginsUnload:
        clear();
        break;
    case EventToolbarCreate:
        return (void*)createBar((unsigned)(e->param()));
    case EventToolbarRemove:
        removeBar((unsigned)(e->param()));
        break;
    case EventShowBar:
        b = (BarShow*)(e->param());
        return show(b->bar_id, b->parent);
    case EventMenuCreate:
        return (void*)createMenu((unsigned)(e->param()));
    case EventMenuRemove:
        removeMenu((unsigned)(e->param()));
        break;
    case EventGetMenu:
        return (void*)get((CommandDef*)(e->param()));
    case EventGetMenuDef:
        return (void*)getDef((unsigned)(e->param()));
    case EventProcessMenu:
        mp = (ProcessMenuParam*)(e->param());
        return (void*)processMenu(mp->id, mp->param, mp->key);
    case EventMenuCustomize:
        customizeMenu((unsigned)(e->param()));
        break;
    default:
        break;
    }
    return NULL;
}
Esempio n. 7
0
int TitleScene::exec()
{
    LoopTiming times;
    times.start_common = SDL_GetTicks();
    bool frameSkip = g_AppSettings.frameSkip;
    menustates.clear();
    menuChain.clear();
    //Set black color clearer
    GlRenderer::setClearColor(0.f, 0.f, 0.f, 1.0f);

    for(int i = menuFirst; i < menuLast; i++)
        menustates[static_cast<CurrentMenu>(i)] = menustate(0, 0);

    setMenu(menu_main);
    //Hide mouse cursor
    PGE_Window::setCursorVisibly(false);

    while(m_isRunning)
    {
        //Refresh frameskip flag
        frameSkip = g_AppSettings.frameSkip;
        times.start_common = SDL_GetTicks();
        processEvents();
        processMenu();
        update();
        times.stop_render = 0;
        times.start_render = 0;

        /**********************Process rendering of stuff****************************/
        if((PGE_Window::vsync) || (times.doUpdate_render <= 0.0))
        {
            times.start_render = SDL_GetTicks();
            /**********************Render everything***********************/
            render();

            if(!m_doExit) renderMouse();

            GlRenderer::flush();
            GlRenderer::repaint();
            times.stop_render = SDL_GetTicks();
            times.doUpdate_render = frameSkip ? uTickf + (times.stop_render - times.start_render) : 0;
        }

        times.doUpdate_render -= uTickf;

        if(times.stop_render < times.start_render)
        {
            times.stop_render = 0;
            times.start_render = 0;
        }

        /****************************************************************************/

        if((!PGE_Window::vsync) && (uTick > times.passedCommonTime()))
            SDL_Delay(uTick - times.passedCommonTime());
    }

    menu.clear();
    PGE_Window::clean();
    //Show mouse cursor
    PGE_Window::setCursorVisibly(true);
    return ret;
}
Esempio n. 8
0
void ZLMenuVisitor::processMenu(ZLApplication &application) {
	if (!application.myMenubar.isNull()) {
		processMenu(*application.myMenubar);
	}
}