void Button28OnClick() {
    unsigned char l,cnt[4];
    if(i==6) {
        if(a==0) {  
            a=1; 
            i=0; 
            InitMCU();
            SF_Start();
            SF_mem();
            Write_Log("Security armed");             
        }
        else {  
            i=0;
            InitMCU();            
            SF_Start();
            SF_rem();
            Write_Log("Security disarmed");   
        }
        DrawScreen(&System_Log_Screen);
        Delay_ms(2000);
        strcpy(Label24.Caption," ");
        hom=1;
        DrawScreen(&Home);
    }
}
void SF_mem()
{
  unsigned char i,l,cnt[4];
  long adr=0x111111;

  for(i=0;i<6;i++) {
    SerialFlash_WriteByte(arm[i],adr);
    adr+=0x000020;
  }

  strcpy(Label24.Caption,"  ******");
  DrawScreen(&System_Log_Screen);
  for(l=0;l<10;l++) {
    ByteToStr(10-l,cnt);
    strcpy(Label25.Caption,"      ");
    strcat(Label25.Caption,cnt);
    DrawScreen(&System_Log_Screen);
    FT812_Sound_SetAndPlay(_FT812_SOUND_CLICK,_FT812_SOUND_PITCH_B3,vol);
    Delay_ms(1000);
  }
  Box30.Color=0x00FF0000;
  Box36.Color=0x00FF0000;
  Image65.Visible=0;
  Image66.Visible=1;
  strcpy(Label25.Caption,"   ARMED");
  strcpy(Label8.Caption,"   ARMED");
}
Esempio n. 3
0
File: flight.c Progetto: tachyo/SNP
/**
 * Runs the game.
 * @param track file
 * @return
 */
int Gameplay(FILE* track)
{
  int sleeptime = START_PERIOD;
  int freeze = 0;
  size_t count = 0;
  unsigned planepos = SCREEN_WIDTH / 2;

  DrawScreen();
  while (1)
  {
    usleep(sleeptime);
    if (sleeptime > 100 * 1000)
      sleeptime = sleeptime - sleeptime / 20;

    if (input.key_pressed == quit) //TODO: Handle quit
    {
      break;
    }
    
    if (freeze)
    {
      continue;
    }

    if (!ScrollScreen(track))
    {
      mvprintw(SCREEN_HEIGHT / 2, 10, "   Track completed!   ");
      refresh();
      freeze = 1;
      continue;
    }
    pthread_mutex_lock(&input.lock);
    if ((input.key_pressed == left) && planepos > 0) // TODO: Handle left movement
    {
      planepos--;
      input.key_pressed = not_pressed;
    }
    
    if ((input.key_pressed == right) && planepos < SCREEN_WIDTH - 1) // TODO: Handle right movement
    {
      planepos++;
      input.key_pressed = not_pressed;
    }
    pthread_mutex_unlock(&input.lock);
    
    if (screen[SCREEN_WIDTH * (SCREEN_HEIGHT - 1) + planepos] == OBSTACLE)
    {
      // Ohhh no... Crash!
      mvprintw(SCREEN_HEIGHT / 2, 10, "   CRASH! Game over.   ");
      refresh();
      freeze = 1;
      continue;
    }
    screen[SCREEN_WIDTH * (SCREEN_HEIGHT - 1) + planepos] = PLANE;
    DrawScreen();
    mvprintw(0, 0, " %zu ", count++);
    refresh();
  }
  return 0;
}
Esempio n. 4
0
bool OpenGLSWFrameBuffer::Wiper_Crossfade::Run(int ticks, OpenGLSWFrameBuffer *fb)
{
	Clock += ticks;

	// Put the initial screen back to the buffer.
	DrawScreen(fb, fb->InitialWipeScreen);

	// Draw the new screen on top of it.
	DrawScreen(fb, fb->FinalWipeScreen, GL_FUNC_ADD, ColorValue(0,0,0,Clock / 32.f), ColorRGBA(255,255,255,0));

	return Clock >= 32;
}
Esempio n. 5
0
bool D3DFB::Wiper_Crossfade::Run(int ticks, D3DFB *fb)
{
	Clock += ticks;

	// Put the initial screen back to the buffer.
	DrawScreen(fb, fb->InitialWipeScreen);

	// Draw the new screen on top of it.
	DrawScreen(fb, fb->FinalWipeScreen, D3DBLENDOP_ADD,
		D3DCOLOR_COLORVALUE(0,0,0,Clock / 32.f), D3DCOLOR_RGBA(255,255,255,0));

	return Clock >= 32;
}
void CircleButton7OnPress() {
    if((Box62.Left+Box62.Width)>=(Box64.Left+Box64.Width)) Box64.Left+=1;
    d_l[choice_t]=0+(int)floor((Box64.Left-219)*100/197);
    dim_l[choice_t]=Box64.Left;
    IntToStr(d_l[choice_t],Label97.Caption);
    DrawScreen(&Light_Mode);
}
Esempio n. 7
0
void
App::Run()
{
    //
    // Initialize the event handler
    //
    EventManager eventHandler;
    
    // Main game loop
    while(1)
    {
        //
        // Draw the next screen
        //
        
        DrawScreen();
        
        // Step the physics world
        PhysicsWorld::GetInstance()->Step(1.0 / 60.0);
        
        // Sleep
        SDL_Delay(1000.0 / 60.0);
        
        //
        // Handle events
        //
        while(eventHandler.IsEventWaiting())
            eventHandler.HandleEvent();
    }
    
    
}
void SM_BT_MMClick() {
// Go back to Main Screen
Counterflag = 0;
remote_mod=0;
DrawScreen(&MainMenu);

}
Esempio n. 9
0
void doSettings() {
    BLED_Fade_Out();
    DrawScreen(&Settings);
    BLED_Fade_In();
    Logger_State = 2;

}
Esempio n. 10
0
void ChangeResolution()
{
if (bFullScreen)
  {
  if (vmVideoMode==vmGraph512)
    sfScreen = SDL_SetVideoMode(512, 384, 8,
                                SDL_SWSURFACE | SDL_FULLSCREEN |
                                SDL_HWPALETTE);
  else if (vmVideoMode==vmGraph800)
    sfScreen = SDL_SetVideoMode(800, 600, 8,
                                SDL_SWSURFACE | SDL_FULLSCREEN |
                                SDL_HWPALETTE);
  else
    sfScreen = SDL_SetVideoMode(640, 480, 8,
                                SDL_SWSURFACE | SDL_FULLSCREEN |
                                SDL_HWPALETTE);
  SDL_ShowCursor(SDL_DISABLE);
  }
else
  {
  if (vmVideoMode==vmGraph512)
    sfScreen = SDL_SetVideoMode(512, 384, 8,
                                SDL_SWSURFACE | SDL_HWPALETTE);
  else if (vmVideoMode==vmGraph800)
    sfScreen = SDL_SetVideoMode(800, 600, 8,
                                SDL_SWSURFACE | SDL_HWPALETTE);
  else
    sfScreen = SDL_SetVideoMode(640, 480, 8,
                                SDL_SWSURFACE | SDL_HWPALETTE);
  SDL_ShowCursor(SDL_ENABLE);
  }
//printf("w=%d, h=%d, pitch=%d\n",SDL_GetVideoSurface()->w,SDL_GetVideoSurface()->h,SDL_GetVideoSurface()->pitch);
SetPalette();
DrawScreen();
}
void Button40OnClick() {
    char i;
    if(ti!=1 && tim[1]!=1) {
        ti=1;
        dat=2;
        Button39.Color=0x00800000;
        Button40.Color=0x00FF0000;
        Button41.Color=0x00800000;
        Button42.Color=0x00800000;
        Button46.Color=0x00800000;
        Label34.Font_Color=0x00FFFFFF;
        Label44.Font_Color=0x00400000;
        Label45.Font_Color=0x00FFFFFF;
        Label71.Font_Color=0x00FFFFFF;
        Label72.Font_Color=0x00FFFFFF;
        
        strcpy(Label44.Caption,"Minutes:  ");
        datum.min=0;
        for(i=2;i<4;i++) {
            date[i]=0;
        }
        
        DrawScreen(&Settings_Screen);
    }
}
void Button39OnClick() {
    char i;
    if(ti!=0 && tim[0]!=1) {
        ti=0;
        dat=0;
        Button39.Color=0x00FF0000;
        Button40.Color=0x00800000;
        Button41.Color=0x00800000;
        Button42.Color=0x00800000;
        Button46.Color=0x00800000;
        Label34.Font_Color=0x00400000;
        Label44.Font_Color=0x00FFFFFF;
        Label45.Font_Color=0x00FFFFFF;
        Label71.Font_Color=0x00FFFFFF;
        Label72.Font_Color=0x00FFFFFF;
        
        strcpy(Label34.Caption,"Hour:  ");
        datum.hour=0;
        for(i=0;i<2;i++) {
            date[i]=0;
        }
        
        DrawScreen(&Settings_Screen);
    }
}
void Button11OnClick() {
    unsigned char i;
    strcpy(Label73.Caption,"");
    strcpy(Label75.Caption,"");
    strcpy(Label76.Caption,"");
    strcpy(Label77.Caption,"");
    strcpy(Label78.Caption,"");
    strcpy(Label34.Caption,"Hours:  ");
    strcpy(Label44.Caption,"Minutes:  ");
    strcpy(Label45.Caption,"Day:  ");
    strcpy(Label71.Caption,"Month:  ");
    strcpy(Label72.Caption,"Year:  ");
    for(i=0;i<12;i++) {
        date[i]=0;
    } 
    for(i=0;i<5;i++) {
        tim[i]=0;
    }
    dat=0;
    datum.hour=0;
    datum.min=0;
    datum.day=0;
    datum.mon=0;
    datum.year=0;
    Button39OnClick();
    DrawScreen(&Settings_Screen);    
}
void Box24OnClick() {
    CheckBox1.Checked=1-CheckBox1.Checked;
    DrawScreen(&Keyboard_Screen);
    vol=255-vol;
    FT812_Sound_SetAndPlay(_FT812_SOUND_XYLOPHONE,_FT812_SOUND_PITCH_B3,vol);
    Delay_ms(1000);
}
void Button27OnClick() {
    char cnt;
    for(cnt=0;cnt<=5;cnt++) arm[cnt]=0;
    i=0;
    strcpy(Label24.Caption,"");
    DrawScreen(&System_Log_Screen);
}
void CircleButton8OnPress() {
    if((Box63.Left+Box63.Width)>=(Box65.Left+Box65.Width)) Box65.Left+=1;
    h_l[choice_t]=15+(int)floor((Box65.Left-219)*15/197);
    hum_l[choice_t]=Box65.Left;
    IntToStr(h_l[choice_t],Label98.Caption);
    DrawScreen(&Light_Mode);
}
Esempio n. 17
0
int main(void) {

	// Initialise the clock to have a /1 prescaler and use the external crystal clock source for accuracy.
	CLK_DeInit();
	CLK_SYSCLKConfig(CLK_PRESCALER_CPUDIV1);
	CLK_ClockSwitchConfig(CLK_SWITCHMODE_AUTO, CLK_SOURCE_HSE, DISABLE, CLK_CURRENTCLOCKSTATE_DISABLE);
	
	// Reset ("de-initialise") GPIO port D.
	GPIO_DeInit(GPIOD);
	// Initialise pin 0 of port D by setting it as:
	// - an output pin,
	// - using a push-pull driver,
	// - at a low logic level (0V), and
	// - 10MHz.
	GPIO_Init(GPIOD, GPIO_PIN_0, GPIO_MODE_OUT_PP_LOW_FAST);
	
	LCDInit(); // Init the LCD
	DecodeInit(); // Init the GPS decoding
	DrawScreen(); // Setup Screen and Buffer
	
	// Infinite loop.
	for(;;) {
		// Blink Debug LED
		GPIO_WriteReverse(GPIOD, GPIO_PIN_0);
		
		DrawDemo();	
	}
}
void Button41OnClick() {
    char i;
    if(ti!=2 && tim[2]!=1) {
        ti=2;
        dat=4;
        Button39.Color=0x00800000;
        Button40.Color=0x00800000;
        Button41.Color=0x00FF0000;
        Button42.Color=0x00800000;
        Button46.Color=0x00800000;
        Label34.Font_Color=0x00FFFFFF;
        Label44.Font_Color=0x00FFFFFF;
        Label45.Font_Color=0x00400000;
        Label71.Font_Color=0x00FFFFFF;
        Label72.Font_Color=0x00FFFFFF;
        
        strcpy(Label45.Caption,"Day:  ");
        datum.day=0;
        for(i=4;i<6;i++) {
            date[i]=0;
        }
        
        DrawScreen(&Settings_Screen);
    }
}
Esempio n. 19
0
void doPrevScreen() {
    BLED_Fade_Out();
    DrawScreen(&Speedometer);
    BLED_Fade_In();
    Logger_State = 0;

}
void Button42OnClick() {
    char i;
    if(ti!=3 && tim[3]!=1) {
        ti=3;
        dat=6;
        Button39.Color=0x00800000;
        Button40.Color=0x00800000;
        Button41.Color=0x00800000;
        Button42.Color=0x00FF0000;
        Button46.Color=0x00800000;
        Label34.Font_Color=0x00FFFFFF;
        Label44.Font_Color=0x00FFFFFF;
        Label45.Font_Color=0x00FFFFFF;
        Label71.Font_Color=0x00400000;
        Label72.Font_Color=0x00FFFFFF;
        
        strcpy(Label71.Caption,"Month:  ");
        datum.mon=0;
        for(i=6;i<8;i++) {
            date[i]=0;
        }
        
        DrawScreen(&Settings_Screen);    
    }
}
Esempio n. 21
0
void doSensorTest() {
    BLED_Fade_Out();
    DrawScreen(&Sensor_test);
    BLED_Fade_In();
    Logger_State = 4;

}
void Button46OnClick() {
    char i;
    if(ti!=4 && tim[4]!=1) {
        ti=4;
        dat=8;
        Button39.Color=0x00800000;
        Button40.Color=0x00800000;
        Button41.Color=0x00800000;
        Button42.Color=0x00800000;
        Button46.Color=0x00FF0000;
        Label34.Font_Color=0x00FFFFFF;
        Label44.Font_Color=0x00FFFFFF;
        Label45.Font_Color=0x00FFFFFF;
        Label71.Font_Color=0x00FFFFFF;
        Label72.Font_Color=0x00400000;
        
        strcpy(Label72.Caption,"Year:  ");
        datum.year=0;
        for(i=8;i<12;i++) {
            date[i]=0;
        }
                
        DrawScreen(&Settings_Screen);
    }
}
void CDrawableWidget::OnPaint()
{
	// CButton::OnPaint();
	BeginPaint(&m_ps);
	DrawScreen();
	EndPaint(&m_ps);
}
void Button12OnClick() {
    strcpy(Label23.Caption,Label94.Caption);
    strcat(Label23.Caption,"h");
    gr_pow=0;
    hom=1;
    DrawScreen(&Home);    
}
Esempio n. 25
0
void CopyToClipBoard( MainWndInfo *info ) {

    HBITMAP     copy;
    HBITMAP     old_bitmap;
    HDC         dc;
    HDC         mdc;
    POINT       origin = { 0, 0 };



    /* clone the bitmap */
    dc = info->screen->memdc;
    mdc = CreateCompatibleDC( dc );
    copy = CreateCompatibleBitmap( dc, info->wndsize.x, info->wndsize.y );
    old_bitmap = SelectObject( mdc, copy );

    DrawScreen( info->screen, mdc, &origin, &info->wndsize,
                    &origin, &info->magsize );

    SelectObject( mdc, old_bitmap );
    DeleteDC( mdc );

    /* add the bitmap */
    OpenClipboard( info->screen->hwnd );
    EmptyClipboard();
    SetClipboardData( CF_BITMAP, copy );
    CloseClipboard();
}
void CircleButton3OnPress() {
    if((Box47.Left+Box47.Width)>=(Box23.Left+Box23.Width)) Box23.Left+=1;
    t_t[choice_t]=15+(int)floor((Box23.Left-219)*15/197);
    temp_t[choice_t]=Box23.Left;
    IntToStr(t_t[choice_t],Label95.Caption);
    DrawScreen(&Temperature_Mode);
}
void CircleButton4OnPress() {
    if((Box48.Left+Box48.Width)>=(Box49.Left+Box49.Width)) Box49.Left+=1;
    h_t[choice_t]=20+(int)floor((Box49.Left-219)*60/197);
    hum_t[choice_t]=Box49.Left;
    IntToStr(h_t[choice_t],Label96.Caption);
    DrawScreen(&Temperature_Mode);
}
void SS_BT_RMClick() {
//
remote_mod=1;
 UART1_Write_Text("Remote");
DrawScreen(&RemoteMode);

}
Esempio n. 29
0
int main(int argc, char **argv) {
	ros::init(argc, argv, "HumanInterface"); //Creates a node named "HumanInterface"
	ros::NodeHandle n;

	pose_sub = n.subscribe("/motion/Odometry", 1000, receive_pose_estimate);
	pose_target_sub = n.subscribe("/motion/Speed", 1000, receive_pose_target);

	cv::Mat screen(HEIGHT,WIDTH,CV_8UC1,cv::Scalar(0));
	cv::cvtColor(screen, screen, CV_GRAY2BGR);
	
	//ros::Rate loop_rate(30); // frequency
	cv::imshow("Human Interface", screen);
	cv::waitKey(1);
	
	int time_old = ros::Time::now().nsec;
	
	while (ros::ok()) {
		if (ros::Time::now().nsec-time_old > 100E6	&& redraw) {
			time_old = ros::Time::now().nsec ;
			DrawScreen(screen);
			redraw = false;
		}

		//loop_rate.sleep(); // Sleep for 10 ms
		ros::spinOnce(); // Process ros messages
	}

	return EXIT_SUCCESS;
}
void SF_rem()
{
  unsigned char i,temp[6];
  char txte[4],txtex[4];
  int val=0;
  long adr=0x111111;

  for(i=0;i<6;i++) {
    temp[i] = SerialFlash_ReadByte(adr);
    ByteToStr(temp[i],txte);
    ByteToStr(arm[i],txtex);
    if(temp[i]!=arm[i]) val=1;
    adr+=0x000020;
  }

  Delay_ms(3000);
  for(i=0;i<6;i++) arm[i]=0;
  strcpy(Label24.Caption,"");
  DrawScreen(&System_Log_Screen);
  if(val==0) {
    a=0;
    Box30.Color=0x00008040;
    Box36.Color=0x00008040;
    Image65.Visible=1;
    Image66.Visible=0;
    strcpy(Label25.Caption,"DISARMED");
    strcpy(Label8.Caption,"DISARMED");
  }
}