Example #1
0
Error Ssao::init(const ConfigSet& config)
{
	m_width = m_r->getWidth() / SSAO_FRACTION;
	m_height = m_r->getHeight() / SSAO_FRACTION;

	ANKI_R_LOGI("Initializing SSAO. Size %ux%u", m_width, m_height);

	// RT
	m_rtDescrs[0] = m_r->create2DRenderTargetDescription(m_width, m_height, RT_PIXEL_FORMAT, "SSAOMain");
	m_rtDescrs[0].bake();

	m_rtDescrs[1] = m_r->create2DRenderTargetDescription(m_width, m_height, RT_PIXEL_FORMAT, "SSAOBlur");
	m_rtDescrs[1].bake();

	// FB descr
	m_fbDescr.m_colorAttachmentCount = 1;
	m_fbDescr.m_colorAttachments[0].m_loadOperation = AttachmentLoadOperation::DONT_CARE;
	m_fbDescr.bake();

	Error err = initMain(config);

	if(!err)
	{
		err = initBlur(config);
	}

	if(err)
	{
		ANKI_R_LOGE("Failed to init PPS SSAO");
	}

	return err;
}
Example #2
0
// main
void main() 
{
    initMain();
    
    int right1, left1, right2, left2, right3, left3;

    while(1) {
        
        switch (MotorPort.Sensor) {            // 1 for in black line, 0 for out of black line
            default:
				left3 = (MotorPort.Sensor & 0b1000000) >> 6;
                left2 = (MotorPort.Sensor & 0b0100000) >> 5;
                left1 = (MotorPort.Sensor & 0b0010000) >> 4;
                right1 = (MotorPort.Sensor & 0b0000100) >> 2;
                right2 = (MotorPort.Sensor & 0b0000010) >> 1;
				right3 = (MotorPort.Sensor & 0b0000001);
                index2 = (index2 + 8 - right3 * 4 - right2 * 2 - right1) % 32;
                index1 = (index1 + 8 - left3 * 4 - left2 * 2 - left1) % 32;
                break;
        }
        MotorPort.Motor = LOOKUPTABLE[index2] + (LOOKUPTABLE[index1] << 4);       // output is left + right.
        Delay_ms(4);
        
    }
}   // End main()
Example #3
0
int main(int argc, char** argv)
{
	grid_size = GRID_SIZE;
	nthreads = NTHREADS;	
	if(argc>=2){
	nthreads = atoi(argv[1]);
	grid_size = atoi(argv[2]);
	}
   	omp_set_num_threads(nthreads);
   
   /*#pragma omp parallel
   {
		cout<<"Hello"<<endl;
   }*/
   //int i=0;
   /*matrix<double > temp;
   temp.resize(10,10);
   #pragma omp parallel for
   	for(int i=0;i<10;i++)
		for(int j=0;j<10;j++)
			cout<<temp(i,j);
   */
  
   glutInit(&argc, argv);
   initMain ();
   int i=pthread_getconcurrency();

   char windowName[]="   Liquid_Simulator-LevelSet+Surface" ;
   openGlutWindow(windowName);

   glutMainLoop();
   
   return 0; 
}
int pjsuaRestart()
{
    pj_status_t status;

    pjsuaDestroy();

    return initMain(restart_argc, restart_argv);
}
Example #5
0
//*****************************************************************************
//
// Interrupt handlers
//
//*****************************************************************************
void
SysTickIntHandler(void){
	// Handle state changes
	if (done){
		tick++;
		if (tick>1){
			if (lose){
				// Turn off the noise
				PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT | PWM_OUT_1_BIT, false);
				PWMGenDisable(PWM0_BASE, PWM_GEN_0);
				unsigned long ulPeriod = SysCtlClockGet() / 220;

				// Set the PWM period to 220 (A) Hz.
				PWMGenConfigure(PWM0_BASE, PWM_GEN_0,
						PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC);
				PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, ulPeriod);

				// Make some noise again
				PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT | PWM_OUT_1_BIT, true);
				PWMGenEnable(PWM0_BASE, PWM_GEN_0);
			}
		}
		if (tick>2){
			if (lose){
				// Turn off the noise
				PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT | PWM_OUT_1_BIT, false);
				PWMGenDisable(PWM0_BASE, PWM_GEN_0);

				unsigned long ulPeriod = SysCtlClockGet() / 440;
				// Set the PWM period to 440 (A) Hz. again
				PWMGenConfigure(PWM0_BASE, PWM_GEN_0,
						PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC);
				PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, ulPeriod);
				lose = 0;
			}
			if (state==1){
				startClassic();
				tick = 0;
				done = 0;
			}
			else if(state==2){
				if(tick>4){
					RIT128x96x4Clear();
					initMain();
					state = 0;
					pointer = 0;
					tick = 0;
					done = 0;
				}
			}
			else if (state==3){
				startContinuous();
				tick = 0;
				done = 0;
			}
		}
	}
}
Example #6
0
bool SelectHeroLayer::init()
{
	if( !Layer::init())
	{
		return false;
	}

	initMain();

	return true;
}
Example #7
0
EventWinRecurrence::EventWinRecurrence(QWidget* parent, const char* name, bool todo)
    : QFrame( parent, name, 0 )
{
    isTodo = todo;
    resize( 600,400 );

    initMain();
    initDaily();
    initWeekly();
    initMonthly();
    initYearly();
    initExceptions();
}
int pjsuaStart()
{
    pj_status_t status;

    const char **argv = pjsua_app_def_argv;
    int argc = pjsua_app_def_argc;

    pj_bzero(&android_app_config, sizeof(android_app_config));

    android_app_config.on_config_init = &on_cli_config;
    android_app_config.on_started = &on_cli_started;
    android_app_config.on_stopped = &on_cli_stopped;

    return initMain(argc, (char**)argv);
}
Example #9
0
void UnitEmitter::addTrivialPseudoMain() {
  initMain(0, 0);
  auto const mfe = getMain();
  emitOp(OpInt);
  emitInt64(1);
  emitOp(OpRetC);
  mfe->maxStackCells = 1;
  mfe->finish(bcPos(), false);
  recordFunction(mfe);

  TypedValue mainReturn;
  mainReturn.m_data.num = 1;
  mainReturn.m_type = KindOfInt64;
  m_mainReturn = mainReturn;
  m_mergeOnly = true;
}
Example #10
0
std::unique_ptr<UnitEmitter>
createFatalUnit(StringData* filename, const MD5& md5, FatalOp /*op*/,
                StringData* err) {
  auto ue = std::make_unique<UnitEmitter>(md5);
  ue->m_filepath = filename;
  ue->initMain(1, 1);
  ue->emitOp(OpString);
  ue->emitInt32(ue->mergeLitstr(err));
  ue->emitOp(OpFatal);
  ue->emitByte(static_cast<uint8_t>(FatalOp::Runtime));
  FuncEmitter* fe = ue->getMain();
  fe->maxStackCells = 1;
  // XXX line numbers are bogus
  fe->finish(ue->bcPos(), false);
  ue->recordFunction(fe);
  return ue;
}
Example #11
0
// main
void main() 
{
    initMain();
    
    int right1, left1, right2, left2, right3, left3;

    while(1) {
        
        switch (MotorPort.Sensor) {            // 1 for in black line, 0 for out of black line
            case 0b0001000:
                index1 = (index1 + 8) % 32;     // index1 for left motor, index2 for right motor
                index2 = (index2 + 8) % 32;
                break;
            case 0b0011000:
                index1 = (index1 + 8) % 32;
                index2 = (index2 + 6) % 32;
                break;
            case 0b0001100:
                index1 = (index1 + 6) % 32;
                index2 = (index2 + 8) % 32;
                break;
            case 0b1111000:
                index1 = (index1 + 8) % 32;
                index2 = (index2 + 2) % 32;
                break;
            case 0b0001111:
                index1 = (index1 + 2) % 32;
                index2 = (index2 + 8) % 32;
                break;
            default:
				left3 = (MotorPort.Sensor & 0b1000000) >> 6;
                left2 = (MotorPort.Sensor & 0b0100000) >> 5;
                left1 = (MotorPort.Sensor & 0b0010000) >> 4;
                right1 = (MotorPort.Sensor & 0b0000100) >> 2;
                right2 = (MotorPort.Sensor & 0b0000010) >> 1;
				right3 = (MotorPort.Sensor & 0b0000001);
                index2 = (index2 + 8 - (right3 - left3) * 4 - (right2 - left2) * 2 - (right1 - left1)) % 32;
                index1 = (index1 + 8 - (left3 - right3) * 4 - (left2 - right2) * 2 - (left1 - right1)) % 32;
                break;
        }
        MotorPort.Motor = LOOKUPTABLE[index1] + (LOOKUPTABLE[index2] << 4);       // output is left + right.
        Delay_ms(5);
        
    }
}   // End main()
Example #12
0
// main
void main() 
{
    initMain();
    
    int right1, left1, right2, left2;

    while(1) {
        
        switch (MotorPort.Sensor) {            // 0 for in black line, 1 for out of black line
            case 0b00100:
                index1 = (index1 + 8) % 32;     // index1 for right motor, index2 for left motor
                index2 = (index2 + 8) % 32;
                break;
            case 0b01100:
                index1 = (index1 + 8) % 32;
                index2 = (index2 + 4) % 32;
                break;
            case 0b00110:
                index1 = (index1 + 4) % 32;
                index2 = (index2 + 8) % 32;
                break;
            case 0b11100:
                index1 = (index1 + 8) % 32;
                index2 = (index2 + 2) % 32;
                break;
            case 0b00111:
                index1 = (index1 + 2) % 32;
                index2 = (index2 + 8) % 32;
                break;
            default:
                left2 = (MotorPort.Sensor & 0b10000) >> 4;
                left1 = (MotorPort.Sensor & 0b01000) >> 3;
                right1 = (MotorPort.Sensor & 0b00010) >> 1;
                right2 = (MotorPort.Sensor & 0b00001);
                index2 = ((right2 - left2) * 4 + (right1 - left1) + 4 + index2) % 32;
                index1 = ((left2 - right2) * 4 + (left1 - right1) + 4 + index1) % 32;
                break;
        }
        MotorPort.Motor = LOOKUPTABLE[index1] + (LOOKUPTABLE[index2] << 4);       // output is left + right.
        Delay_ms(5);
        
    }
}   // End main()
Example #13
0
// main
void main() 
{
    initMain();

    while(MotorPort.Power == 1) {
        while (MotorPort.Sensor1 == 0) {
            motor(0,FORWARD);
            if (MotorPort.Sensor1 == 1) break;
        }
        while (MotorPort.Sensor1 == 0) {
            motor(0,BACKWARD);
            if (MotorPort.Sensor1 == 1) break;
        }
        while (MotorPort.Sensor1 == 0) {
            motor(0,BACKWARD);
            if (MotorPort.Sensor1 == 1) break;
        }
        
    }
}   // End main()
Example #14
0
int main(int argc, char** argv)
{
	grid_size = GRID_SIZE;
	nthreads = NTHREADS;	
	if(argc>=2){
	nthreads = atoi(argv[1]);
	grid_size = atoi(argv[2]);
	}
 	omp_set_num_threads(nthreads);
	struct timeval tt1, tt2;
	initMain();
	int i=pthread_getconcurrency();
	int it=0;
	int ni= 0;
	while(ni++<NO_OF_ITERATIONS){
		gettimeofday(&tt1, NULL);
		animate();
		gettimeofday(&tt2, NULL);
		int milliSeconds = (tt2.tv_sec - tt1.tv_sec) * 1000 + (tt2.tv_usec - tt1.tv_usec)/1000;
		cout<<"Iteration "<<it<<" : "<<milliSeconds<<"ms"<<endl<<endl;
		it++;
	}
	return 0;
}
Example #15
0
int main( void )
{
    
    initMain();

    while ( state >= 0  &&  state < 2 )
    {
        // simple state management
        switch ( state )
        {
            case 0:
                menu();
                break;
            case 1:
                game();
                break;
            default:
                break;
        }
        SDL_Flip(screen);
    }

    return 0;
}
Example #16
0
int main()
{
	setlocale(LC_ALL, "");
	int width, height;
	int i = 0;
	width = 640; height = 480;
	init(&width, &height);
	
	loadConf();
	
	TMain Main;
	
	initMain(&Main, width, height);

	for(i = 0; i <= (widget_count - 1); i++){
		Widgets[i].init( &Widgets[i], &Main );
	}
	
	while(Main.work >= 1) {
		Start(width, height);
		vgSetPixels(Main.mX, Main.mY, background_image, 0, 0, width, height);
		
		loadConf();
		
		for(i = 0; i <= (widget_count -1); i++){
			if(Widgets[i].state == 1){
				Widgets[i].draw( &Widgets[i], &Main );
			}
		}
		End();
		usleep(10000);
	}
	finish();
	exit(0);
	return 0;
}
Example #17
0
//-----------------------------------【main( )函数】------------------------------------------------------------------------------  
//      描述:控制台应用程序的入口函数,我们的程序从这里开始  
//--------------------------------------------------------------------------------------------------------------------------------  
int main(int agrc, char** agrv)
{


	initMain();//初始化

	//载入原图  
	g_srcImage = imread(".\\sourcePicture\\3.bmp");

	//添加噪音
	if (noice)
	{
		salt(g_srcImage);
		imwrite("./output/noice.bmp", g_gradBmp);
	}

	//定义一个Mat类型并给其设定ROI区域  
	//g_srcImage = g_srcImage(Rect(0, 0, 250, 250));

	//判断是否读取成功
	if (!g_srcImage.data)
	{
		cout << "读取图片srcImage时出错!\n";
		return false;
	}


	//将原图转换为灰度图  
	cvtColor(g_srcImage, g_srcGrayImage, CV_BGR2GRAY);

	ShowHelpText(g_srcGrayImage);

	//histGram(g_srcGrayImage);
	Edge edge1;
	Edge edge(g_srcGrayImage);//传值初始化
	edge.Init();//深入初始化
	//edge.edgeDection(1,NULL);

	//创建Canny检测的tracebar
	namedWindow("Canny检测");
	//namedWindow("listk1"); namedWindow("listk1&&listk2");
	createTrackbar("参数值:", "Canny检测", &g_cannyLowThreshold, 160, edge.on_Canny);
	namedWindow("g_mergImg");//, CV_WINDOW_NORMAL
	//createTrackbar("梯度:", "g_mergImg", &TH, 80, edge.edgeDection);	
	//createTrackbar("相似度:", "g_mergImg", &TH1, 40, edge.edgeDection);
	//createTrackbar("相似度:", "g_edge[1]", &g_di, 80, edge.listK);
	edge.edgeDection();
	//edge.edgeDection1();
	g_srcGrayImage.convertTo(g_srcGrayImage, CV_32F);

	if (xls)
	{
		edge.outXls(g_srcGrayImage, "./output/gray.xls");
		//outxlsInt(g_biGrad, "./output/bigrad.xls");
	}

	//cout << g_ltedge << endl;
	//将原图转换为灰度图
	//g_dstImage.convertTo(g_dstImage, CV_8UC1);
	//namedWindow("dst");
	//imshow("dst", g_dstImage);
	//显示梯度图片

	g_srcGrad.convertTo(g_gradBmp, CV_8UC1);
	imshow("梯度图", g_gradBmp);
	imwrite("./output/grad.bmp", g_gradBmp);





	//轮询获取按键信息,若按下Q,程序退出  
	while ((char(waitKey(1)) != 'q')) {}
	return 0;
}
Example #18
0
int main(int argc, char* argv[])
{
    u8 *tex_ptrone=GRRLIB_LoadTexture(handpointerred_png);
    u8 *tex_ptrtwo=GRRLIB_LoadTexture(handpointergreen_png);
    u8 *tex_back=GRRLIB_LoadJPG(bigmenuback_jpg, bigmenuback_jpg_size);
    u8 *tex_fore=GRRLIB_LoadTexture(credits_png);

    fatInitDefault();
    GRRLIB_InitVideo();
    WPAD_Init();

    SYS_SetResetCallback(WiiResetPressed);
    SYS_SetPowerCallback(WiiPowerPressed);
    WPAD_SetPowerButtonCallback(WiimotePowerPressed);
    rmode = VIDEO_GetPreferredMode(NULL);

    AESND_Init(NULL);
    MODPlay_Init(&mod_track);
    Init_Voice();

    AESND_Pause(0);                // the sound loop is running now

                                 // set the MOD song
    if (MODPlay_SetMOD (&mod_track, dojo_dan_oriental_mod) < 0 ) {
        MODPlay_Unload (&mod_track);
    } else {
        // set the music volume to the minimum so we don't hear the music before saved volume is known
        MODPlay_SetVolume( &mod_track, 0,0);
        MODPlay_Start (&mod_track);// Play the MOD
    }

    WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR);

    WPAD_SetVRes(WPAD_CHAN_ALL, rmode->fbWidth, rmode->xfbHeight);

    initMain();

    MODPlay_SetVolume( &mod_track, opt_music, opt_music);

    while( HWButton == 0) {
        WPAD_ScanPads();
        u32 wpad_one_down = WPAD_ButtonsDown(0);
        u32 wpad_two_down = WPAD_ButtonsDown(1);

        u32 type;
        WPADData *wd_one, *wd_two;
        WPAD_ReadPending(WPAD_CHAN_ALL, countevs);
        WPAD_Probe(WPAD_CHAN_ALL, &type);

        wd_one = WPAD_Data(0);
        wd_two = WPAD_Data(1);

        switch(main_mode) {
            case STARTUP :
                GRRLIB_FillScreen(0xFF000000);
                GRRLIB_DrawImg(0, 0, 640, 480, tex_back, 0, 1, 1, alpha>255?255:alpha);
                GRRLIB_DrawImg(68,308, 256, 80, tex_fore, 0, 1, 1, alpha>255?255:alpha);
                if(alpha++>394 || wpad_one_down > 0) {
                    main_mode=MENU;
                    if(tex_back) free(tex_back);
                    if(tex_fore) free(tex_fore);
                    initMenu();
                }
                break;
            case MENU :
                GRRLIB_FillScreen(0xFF000000);
                int menuopt = menuWiimote(wd_one,wpad_one_down);
                if(menuopt==EXIT) {
                    if(tex_ptrone) free(tex_ptrone);
                    if(tex_ptrtwo) free(tex_ptrtwo);
                }

                if(menuopt>NOTHING) {
                    processMenuOption(menuopt);
                    if(main_mode==GAME) {
                        MODPlay_Unload (&mod_track);
                        if(opt_tileset==SPOOKY)
                            MODPlay_SetMOD (&mod_track, graveyard_mod);
                        else
                        if(opt_tileset==EGYPTIAN)
                            MODPlay_SetMOD (&mod_track, egypt_crap_mod);
                        else
                        if(opt_tileset==SIMPLE)
                            MODPlay_SetMOD (&mod_track, childhood_mod);
                        else
                        if(opt_tileset==SPACE)
                            MODPlay_SetMOD (&mod_track, nebulos_mod);
                        else
                            MODPlay_SetMOD (&mod_track, sushi_mod);
                        MODPlay_SetVolume( &mod_track, opt_music, opt_music);
                        MODPlay_Start (&mod_track);
                    }
                    else
                        drawMenu(wd_one);
                }
                else
                    drawMenu(wd_one);
                break;
            case GAME :
                if(gameWiimote(wd_one,wpad_one_down,wd_two,wpad_two_down)) {
                    // we are exiting the game back to the menu
                    main_mode=MENU;
                    MODPlay_Unload (&mod_track);
                    MODPlay_SetMOD (&mod_track, dojo_dan_oriental_mod);
                    MODPlay_SetVolume( &mod_track, opt_music, opt_music);
                    MODPlay_Start (&mod_track);
                    killGame();
                    initMenu();
                }
                else {
                    drawGame();
                }
                break;
        }

        // alternate which pointer is on top every frame to not give the advantage to player one in two player mode
        static int ticktock=0;

        ticktock++;

        if(wd_two->ir.valid && ticktock%2==0) {
            if(main_mode==GAME && whatGameMode()==ONE_PLAYER_GAME) {
                // don't display second pointer in one player mode
            }
            else
                GRRLIB_DrawColImg(wd_two->ir.x - 9,wd_two->ir.y - 7,68,80,tex_ptrtwo,0,1,1,0xEEFFFFFF);
        }

        if(wd_one->ir.valid) {
            GRRLIB_DrawColImg(wd_one->ir.x - 9,wd_one->ir.y - 7,68,80,tex_ptrone,0,1,1,0xEEFFFFFF);
        }

        if(wd_two->ir.valid && ticktock%2!=0) {
            if(main_mode==GAME && whatGameMode()==ONE_PLAYER_GAME) {
                // don't display second pointer in one player mode
            }
            else
                GRRLIB_DrawColImg(wd_two->ir.x - 9,wd_two->ir.y - 7,68,80,tex_ptrtwo,0,1,1,0xEEFFFFFF);
        }

        if(wd_one->btns_h & WPAD_BUTTON_1) {
            GRRLIB_ScrShot("MahjonggWii_Screen_%y%m%d_%H%M%S.png",time(NULL));
        }

        GRRLIB_Render();
    }

    // we are exiting, free the mallocs
    switch( main_mode) {
        case GAME:
            killGame();

    }
    if(tex_ptrone) free(tex_ptrone);
    if(tex_ptrtwo) free(tex_ptrtwo);
    killMenuLanguages();
    MODPlay_Unload (&mod_track);
    Free_Voice();
    WPAD_Shutdown();
    GRRLIB_Stop();
    saveConfig(FILE_CFG);
    SYS_ResetSystem(HWButton, 0, 0);

    return 0;
}
Example #19
0
FFDemo::FFDemo()
{
    mRunning = true;
    SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
    mScreen = SDL_SetVideoMode(320, 240, 32, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL);
    SDL_EnableUNICODE(1);
    SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
    SDL_ShowCursor(0);
    SDL_WM_SetCaption("Gui-chan FF demo", NULL);
    Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 1024);

    mChooseSound = Mix_LoadWAV("sound/sound1.wav");
    mEscapeSound = Mix_LoadWAV("sound/sound2.wav");

    mSDLImageLoader = new fcn::SDLImageLoader();
    fcn::Image::setImageLoader(mSDLImageLoader); 
    mSDLGraphics = new fcn::SDLGraphics();
    mSDLGraphics->setTarget(mScreen);
    mSDLInput = new fcn::SDLInput();
	
    mSplashImage = fcn::Image::load("images/splash.png");	

    mTop = new fcn::Container();
    mTop->setBaseColor(fcn::Color(0x000000));
    mTop->setDimension(fcn::Rectangle(0, 0, 320, 240));
    mGui = new fcn::Gui();
    mGui->setTabbingEnabled(false);
    mGui->setGraphics(mSDLGraphics);
    mGui->setInput(mSDLInput);	
    mGui->setTop(mTop);
    mFontWhite = new fcn::ImageFont("images/rpgfont.png", " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&`'*#=[]\""); 	
    mFontCyan = new fcn::ImageFont("images/rpgfont2.png", " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&`'*#=[]\"");	
    fcn::Widget::setGlobalFont(mFontWhite);
	
    initMain();

    mMenu = new FFContainer();
    mMenu->setDimension(fcn::Rectangle(230, 0, 90, 130));
    mMenu->setOpaque(false);
    mTop->add(mMenu);
	
    mGoldFootsteps = new FFContainer();
    mGoldFootsteps->setDimension(fcn::Rectangle(210, 170, 110, 70));
    mGoldFootsteps->setOpaque(false);
    mGoldFootsteps->setFrameSize(0);
    mTop->add(mGoldFootsteps);

    mTime = new FFContainer();
    mTime->setDimension(fcn::Rectangle(230, 130, 90, 40));
    mTime->setOpaque(false);
    mTop->add(mTime);
																	 
    mGoldFootstepsInfo1 = new fcn::TextBox("Steps\n\nGP");
    mGoldFootstepsInfo1->setFont(mFontCyan);
    mGoldFootstepsInfo1->setOpaque(false);
    mGoldFootstepsInfo1->setEditable(false);
    mGoldFootstepsInfo1->setFocusable(false);
    mGoldFootstepsInfo1->setFrameSize(0);
		
    mGoldFootstepsInfo2 = new fcn::TextBox("\n    9119092\n\n    1009213");
    mGoldFootstepsInfo2->setOpaque(false);
    mGoldFootstepsInfo2->setEditable(false);
    mGoldFootstepsInfo2->setFocusable(false);
    mGoldFootstepsInfo2->setFrameSize(0);
	
    mTimeLabel1 = new fcn::Label("Time");
    mTimeLabel1->setFont(mFontCyan);
    mTimeLabel2 = new fcn::Label();
    mTime->add(mTimeLabel1, 5, 5);	
    mTime->add(mTimeLabel2, 22, 20);

	
    mGoldFootsteps->add(mGoldFootstepsInfo2, 5, 0);
    mGoldFootsteps->add(mGoldFootstepsInfo1, 5, 5);
	
    mMenuListModel = new StringListModel();
    mMenuListModel->add("Items");
    mMenuListModel->add("Status");
    mMenuListModel->add("Skills");
    mMenuListModel->add("Magic");
    mMenuListModel->add("About");
    mMenuListModel->add("");
    mMenuListModel->add("Quit");
	
    mMenuList = new FFListBox();
    mMenuList->setActionEventId("menu");
    mMenuList->addActionListener(this);	
    mMenuList->setListModel(mMenuListModel);
    mMenu->add(mMenuList, 5, 5);
    mMenuList->setSelected(0);
    mMenuList->requestFocus();

    initStatus();
    initAbout();
    initItems();
    initMagicSkills();
}
Example #20
0
void
GPIOFIntHandler(void){
	// Method for handling multiple functions for a select button press

	// Clear the GPIO interrupt
	GPIOPinIntClear(GPIO_PORTF_BASE, GPIO_PIN_1);

	// Disable Interrupts
	GPIOPinIntDisable(GPIO_PORTF_BASE, GPIO_PIN_1);
	GPIOPinIntDisable(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);

	// Check which state we are in
	if (state==0){
		// This state handles the main menu

		if (pointer==0){
			// Begin Classic Mode
			state = 1;
			startClassic();
		}
		else if (pointer==1){
			// Begin Continuous Mode
			state = 3;
			startClassic();
		}
		else if (pointer==2){
			// Show the instructions
			state = 2;
			RIT128x96x4Clear();
			displayInstructions();
			done = 1;
		}
		else if (pointer==3){
			// Show the high scores
			state = 2;
			RIT128x96x4Clear();
			displayScores();
			done = 1;
		}
		else if (pointer==4){
			state = 0;
			initMain();
		}
	}
	else if (state==1){
		// This state handles classic mode

		// Black out the letter that was selected
		int idx = position + position2;
		int pos = 0;
		char *puc_letter = alpha[idx];
		if (idx>12){
			pos = position2 * 10;
			RIT128x96x4StringDraw(puc_letter, pos, 87, 2);
		}
		else {
			pos = position * 10;
			RIT128x96x4StringDraw(puc_letter, pos, 75, 2);
		}

		// Add the letter to the list of selected letters
		int i;
		int wrong = 1;
		int used = 0;
		// Loop through the list until we find an empty spot to place the letter
		for (i=0; i<26; i++){
			if (strcmp(selected[i],"!")==0){
				selected[i] = puc_letter;
				break;
			}
			if (strcmp(selected[i],puc_letter)==0){
				wrong = 0;
				used = 1;
				break;
			}
		}

		// Check to see if the letter was already used
		if (!used){
			// Check the word to see if a letter matches the one selected. If it
			// does, we need to display the letters instead of an underscore
			for (i=0; i<strlen(words[wotd]); i++){
				char w_let = words[wotd][i];
				static char g[3];
				usprintf(g, "%d", w_let);
				char p_let = *puc_letter;
				if (w_let==p_let){
					wrong = 0;
					// Display the letter selected
					RIT128x96x4StringDraw(puc_letter, 10+i*10, 53, 15);
					correct++;
				}
			}
		}

		// Check to see if it was a wrong selection
		if (wrong==1){
			// Increment the number of wrong attempts
			try++;
			// If the selection was wrong, we need to draw a piece of the hangman
			if (try==1){
				drawHead();
			}
			else if (try==2){
				drawBody();
			}
			else if (try==3){
				drawRightArm();
			}
			else if (try==4){