コード例 #1
0
ファイル: game.c プロジェクト: engineerOfLies/garden
void Init_All()
{
  Init_Graphics();
  InitSpriteList();
  Init_Audio();
  InitSoundList();
  atexit(CleanUpAll);
  LoadFonts();
  InitMessages();
  LoadMouse(Cyan,Gold,DarkViolet);
  InitEntityList();
  ResetAllParticles();
  DrawSplashScreen();
  LoadContent();
  NewMap(32, 48,0,15);
  DrawMap();
}
コード例 #2
0
void CSpecPearlInfEngine::EnterEvidence( const CEvidence* evidence,
                                     int maximize, int sumOnMixtureNode )
{
    PNL_CHECK_IS_NULL_POINTER(evidence);

    m_bMaximize = maximize ? 1 : 0;

    // clear all the previous data
    ClearMessagesStorage();
    
    // init new data
    InitEngine(evidence);

    // initialize messages
    InitMessages(evidence);

    // start inference
    ParallelProtocol();
}
コード例 #3
0
void ExampleInit()
{
#define NUM_MESSAGES 30
#define MESSAGE_LEN 80

    InitMessages(NUM_MESSAGES, MESSAGE_LEN);
    AppendMessageColour(GREEN, "Checking for extension");
    
    SetButtonScale(GetButtonScale()-1);
    g_MessageBox = NewButton("MessageBox");
    if (s3eNOpenFeintAvailable())
	{
		g_NOFInitialize = NewButton("OF Initialize");
		g_NOFShutdown = NewButton("OF Shutdown");
		g_NOFLaunchDashboard = NewButton("OF LaunchDashboard");
		g_NOFTestButton1 = NewButton("OF Test 1");
		g_NOFTestButton2 = NewButton("OF Test 2");
		

		// Register for callbacks
		AppendMessageColour(BLUE, "*************");
		AppendMessage("");
		AppendMessage("");
		AppendMessage("");
		AppendMessage("");
		AppendMessage("");
		AppendMessage("");
		AppendMessage("");
		AppendMessage("");
		AppendMessage("");
		AppendMessage("");
		AppendMessage("");
		AppendMessage("");		
		AppendMessage("");
		AppendMessage("");
		AppendMessageColour(GREEN, "Registering for callback");
		
		s3eNOpenFeintRegister(S3E_NOPENFEINT_CALLBACK_PLAYER_LOGGEDIN, &playerLoggedIn, NULL);
		s3eNOpenFeintRegister(S3E_NOPENFEINT_CALLBACK_DASHBOARD_DID_APPEAR, &dashBoardAppeared, NULL);
		s3eNOpenFeintRegister(S3E_NOPENFEINT_CALLBACK_DID_DOWNLOAD_ALL_CHALLENGE_DEFINITIONS,
							  &didDownloadAllChallengeDefinitions,
							  NULL);
		s3eNOpenFeintRegister(S3E_NOPENFEINT_CALLBACK_DID_FAIL_DOWNLOAD_CHALLENGE_DEFINITIONS,
							  &didFailDownloadChallengeDefinitions,
							  NULL);
		s3eNOpenFeintRegister(S3E_NOPENFEINT_CALLBACK_USER_LAUNCHED_CHALLENGE,
							  &userLaunchedChallenge,
							  NULL);
    
    s3eNOpenFeintRegister(S3E_NOPENFEINT_CALLBACK_IS_OPENFEINT_NOTIFICATION_ALLOWED,
                          &isOpenFeintNotificationAllowed,
                          NULL);
    
	}
    else
    {
        AppendMessageColour(RED,"Could not load s3eNOpenFeint extension");
      return;
    }
  
  if(s3eFacebookAvailable())
  {
    s3eFBInit("193667878484");
  }
  else
    AppendMessageColour(RED,"Could not load s3eFacebook extension");
//  if (!s3eIOSNotificationsAvailable())
//  {
//    AppendMessageColour(RED,"Extension Not Available");
//    return;
//  }
//  else {
//      // Register IOS Notification
//      //     s3eDeviceRegister(S3E_DEVICE_PUSH_NOTIFICATION, RemotePushNotificationRecieved, 0);
//           s3eIOSNotificationsRegister(S3E_IOSNOTIFICATIONS_REMOTE, RemotePushNotificationRecieved, NULL);
//
//      // s3eIOSNotificationsGetLaunchNotification();
//  }
//	g_is3eNGAvailable = NewButton("IsNGAvailable");
}
コード例 #4
0
ファイル: spy.c プロジェクト: Ukusbobra/open-watcom-v2
/*
 * spyInit - initialization
 */
static BOOL spyInit( HANDLE currinst, HANDLE previnst, int cmdshow )
{
    WNDCLASS    wc;
    HANDLE      memhdl;
    WORD        i;

    i=i;
    memhdl = memhdl;    /* shut up the compiler for non-NT version */
    JDialogInit();
    Instance = currinst;
    ResInstance = currinst;
    if( !InitGblStrings() ) {
        return( FALSE );
    }
    SpyMenu = LoadMenu( ResInstance, "SPYMENU" );
#ifdef __WATCOMC__
    _STACKLOW = 0;
#endif
    MemStart();

    HandleMessageInst = MakeProcInstance( (FARPROC) HandleMessage, Instance );
    HintWndInit( Instance, NULL, 0 );


    /*
     * set up window class
     */
    if( !previnst ) {
        wc.style = 0L;
        wc.lpfnWndProc = SpyWindowProc;
        wc.cbClsExtra = 0;
        wc.cbWndExtra = sizeof( LONG_PTR );
        wc.hInstance = Instance;
        wc.hIcon = LoadIcon( ResInstance, "APPLICON" );
        wc.hCursor = LoadCursor( (HANDLE)NULL, IDC_ARROW);
#ifdef __NT__
        wc.hbrBackground = NULL;
#else
        wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
#endif
        wc.lpszMenuName = NULL;
        wc.lpszClassName = SPY_CLASS_NAME;
        if( !RegisterClass( &wc ) ) {
            return( FALSE );
        }

#ifdef USE_SNAP_WINDOW
        if( !RegisterSnapClass( Instance ) ) {
            return( FALSE );
        }
#endif
    }

#ifndef NOUSE3D
    CvrCtl3DInit( Instance );
    CvrCtl3dRegister( Instance );
    CvrCtl3dAutoSubclass( Instance );
#endif

    /*
     * now make the main window
     */
    LoadSpyConfig( NULL );
    SpyMainWindow = CreateWindow(
        SPY_CLASS_NAME,         /* Window class name */
        SpyName,                /* Window caption */
        WS_OVERLAPPEDWINDOW,    /* Window style */
        SpyMainWndInfo.xpos,    /* Initial x position */
        SpyMainWndInfo.ypos,    /* Initial y position */
        SpyMainWndInfo.xsize,   /* Initial x size */
        SpyMainWndInfo.ysize,   /* Initial y size */
        (HWND)NULL,             /* Parent window handle */
        (HMENU)SpyMenu,         /* Window menu handle */
        Instance,               /* Program instance handle */
        NULL );                 /* Create parameters */

    if( SpyMainWindow == NULL ) {
        return( FALSE );
    }
    MyTask = GetWindowTask( SpyMainWindow );

    ShowWindow( SpyMainWindow, cmdshow );
    UpdateWindow( SpyMainWindow );

    InitMessages();
    return( TRUE );

} /* spyInit */
コード例 #5
0
ファイル: main.c プロジェクト: hylics/IRFS105
int main(void)
{
    //STATIC_ASSERT(sizeof(uint16_t) == 2);
    InitGPIO();
    InitSPI_soft();
    InitI2C_soft();
    InitADC();
    InitSystemTimer();
    InitTimers();
    InitMessages();
    InitCC2500(preferredSettings); //(const uint8_t **)conf(+6bytes of code), preferredSettings
    uart0_init( UART_BAUD_SELECT(RS485_BAUDRATE, F_CPU) );
    //_delay_ms(5000);
    //InitEXTI();
    //MCUCR |= (_BV(ISC11) | _BV(ISC01));

    /*check Watchdog reset flag*/
    if(bit_is_set(MCUCSR, WDRF)) {
      //increase wathcdog reset counter and save in eeprom
    }

    set_sleep_mode(SLEEP_MODE_IDLE); //варианты SLEEP_MODE_PWR_SAVE SLEEP_MODE_IDLE SLEEP_MODE_ADC
    //wdt_enable(WDTO_2S);
    sei(); //enable interrupts

    for (uint8_t i = 0; i<0x05; i++) {
          //_spi_start();
          //spi_TxRx(0x9D);
          //_spi_stop();
          _delay_ms(100);
          PORTC |= _BV(PC2); //blink for test
          _delay_ms(100);
          PORTC &= ~_BV(PC2);
          _delay_ms(100);

          RS485_DE_HIGH;
          uart0_putc(0xba);
          _delay_ms(2);
          RS485_DE_LOW;
        }
        RS485_DE_LOW;

    while(1) {
      cc_table_state[CC_state]();


      ProcessTimers(&sys_timer);
      ProcessMessages();
      wdt_reset();

      /*enter in sleep mode until interrupts occured*/
//      cli(); //disable interrupts
//      if (some_condition)
//      {
//        sleep_enable();
//        sei();
//        sleep_cpu();
//        sleep_disable();
//      }
//      sei();
    }

    return 0;
}
コード例 #6
0
ファイル: main.c プロジェクト: arktur04/gas_analyser_v1
/*************************************************************************
 * Function Name: main
 * Parameters: none
 *
 * Return: none
 *
 * Description: main
 *
 *************************************************************************/
int main(void)
{
  MamInit();
  // Init clock
  InitClock();
  // Init GPIO
  GpioInit();
  // Init VIC
  init_VIC();

  // Enable TIM0 clocks  
  PCONP_bit.PCTIM0 = 1; // enable clock  
  PCLKSEL0_bit.PCLK_TIMER0 = 1; //timer clock = pclk

  // Init Time0
  T0TCR_bit.CE = 0;     // counting  disable
  T0TCR_bit.CR = 1;     // set reset
  T0TCR_bit.CR = 0;     // release reset
  T0CTCR_bit.CTM = 0;   // Timer Mode: every rising PCLK edge
  T0MCR_bit.MR0I = 1;   // Enable Interrupt on MR0
  T0MCR_bit.MR0R = 1;   // Enable reset on MR0
  T0MCR_bit.MR0S = 0;   // Disable stop on MR0
  // set timer 0 period
  T0PR = 18-1;
  T0MR0 = (TIMER0_IN_FREQ)/(18 * TIMER0_TICK_PER_SEC);
  // init timer 0 interrupt
  T0IR_bit.MR0INT = 1;  // clear pending interrupt
  VIC_SetVectoredIRQ(Timer0IntrHandler,0,VIC_TIMER0);
  VICINTENABLE |= 1UL << VIC_TIMER0;
  T0TCR_bit.CE = 1;     // counting Enable
  
  __enable_interrupt();
  
  LcdInitPio();
  BoardInit();
  SysSpiInitPio();
  DacInitPio();
  AdcInitPio();
  InitAdc();
  LcdInitModule();
  LcdClear();
  
 // LcdLine(10,32,130, 32);
//  LcdLine(60,10,60, 60);
//  LcdLine(70,10,70, 60);
//  LcdRect(10,20,40, 50);
 // LcdRect(10,1,80, 7);

 /* SetFont(BIG_FONT);

  LcdLine(10, 28, 120, 28);
  LcdLine(10, 45, 120, 45);
 // LcdRect(10, 30, 50, 43);
  
  LcdText(50, 20, 200, 36, "-123456789.0");
  */
  /*
  LcdBmp(10, 20, BMP_HN_WIDTH, BMP_HN_HEIGHT, bmp_hn); 
  LcdBmp(10, 35, BMP_O2_WIDTH, BMP_O2_HEIGHT, bmp_o2); 
  DrawCheckBox(8, 8, 0, 1);
  DrawCheckBox(20, 8, 1, 1);*/
  
 // DrawMainScreen();
  DrawParamScreen();
  LcdClear();
  //DrawMenuScreen();
  
  DrawDOutTestScreen();
  
  LcdDraw();
  
  OutputSet(LCD_LED);

  InitMessages();
  InitKeyb();
  InitCursor();
  InitAdc();
  
//  SetCursorPos(100, 32);
  SendMessage(MSG_EDITOR_SCREEN_ACTIVATE);
  
  int debug = 0, debug2 = 0;
  char s[4];
  
  /*
      LcdClear();
      for(char i = 0; i < 16; i++)
        LcdLine(i * 8, 0, i * 8, 63);
      LcdDraw();
    */  
 // debug = ReadTemp() / 32;
  debug = 3855.0 + 20.0 * ((402.0 - 3855.0) / 20.0);
  unsigned int dac_codes[4] = {0, 0, 0, 0};
  dac_codes[0] = debug;
//  unsigned int dac_codes[4] = {0, 0, 0, 4095};
   WriteToDac(dac_codes);  
 // char adc_codes[4] = {0x58, 0, 0, 0};
 // char adc_codes2[4] = {0, 0, 0, 0,};
  
  char state = 0;
  while(1)
  {
/*
  WriteIntToFram(0, 100);
 
  ReadIntFromFram(0, &debug);  
 */ 
    /*
  WriteToDac(dac_codes);
    */
  /*
  switch(state)
    {
    case 0:
      //if(GetTimer(KEYB_TIMER) > 100)
      if(GetMessage(MSG_R_ENCODER_PRESSED))
      {
           OutputSet(LED11);
           OutputClr(LED12);
           OutputClr(LED13);
           OutputSet(LED15);
           ResetTimer(KEYB_TIMER);
           SendMessage(MSG_CUR_DEACTIVATE);
           state = 1;
      };
      break;
    case 1:
    //  if(GetTimer(KEYB_TIMER) > 100)
      if(GetMessage(MSG_R_ENCODER_PRESSED))      
      {
           OutputClr(LED11);
           OutputSet(LED12);
           OutputClr(LED13);
           OutputClr(LED15);           
           ResetTimer(KEYB_TIMER);
           SendMessage(MSG_CUR_ACTIVATE);
           state = 0;
      };
      break;
    case 2:
//      if(GetTimer(KEYB_TIMER) > 100)
      if(GetMessage(MSG_KEY_PRESSED))      
      {
           OutputClr(LED11);
           OutputClr(LED12);
           OutputSet(LED13);
           OutputClr(LED15);           
           ResetTimer(KEYB_TIMER);
           state = 3;
      };
      break;
    case 3:
     // if(GetTimer(KEYB_TIMER) > 100)
      if(GetMessage(MSG_KEY_PRESSED))      
      {
           OutputClr(LED11);
           OutputClr(LED12);
           OutputClr(LED13);
           OutputSet(LED15);           
           ResetTimer(KEYB_TIMER);
           state = 0;
      };
      break;      
    };
  
    if (GetMessage(MSG_L_ENCODER_CW))
    {
      debug++;
      sprintf(s, "%d", debug);
   //   LcdClear();
      LcdText(0, 0, 63, 9, s);  
      LcdDraw();
    };
     if (GetMessage(MSG_L_ENCODER_CCW))
    {
      debug--;
      sprintf(s, "%d", debug);
    //  LcdClear();
      LcdText(0, 0, 63, 9, s);  
      LcdDraw();      
    };
    
    if (GetMessage(MSG_R_ENCODER_CW))
    {
      debug2++;
      sprintf(s, "%d", debug2);
    //  LcdClear();
      LcdText(100, 0, 127, 9, s);  
      LcdDraw();
    };
     if (GetMessage(MSG_R_ENCODER_CCW))
    {
      debug2--;
      sprintf(s, "%d", debug2);
   //   LcdClear();
      LcdText(100, 0, 127, 9, s);  
      LcdDraw();      
    };
    */
 //   ProcessEditorScreen();
 //   ProcessEditor();
    
    ProcessAdc();
    ProcessCursor();
    ProcessKeyb();
    ProcessMessages();
  }
}
コード例 #7
0
ファイル: s3eFlurry.cpp プロジェクト: escotia/flurry
//Example Main
void ExampleInit()
{
    InitMessages(10,60);

    g_ButtonLogEvent = NewButton("Log Event");
    g_ButtonLogTimedEvent = NewButton("Log Timed Event");
    g_ButtonEndTimedEvent = NewButton("End Timed Event");
    g_ButtonLogError = NewButton("Log Error");
    g_ButtonUserInfo = NewButton("Set User Info");
    g_ButtonUserLocation = NewButton("Log User Location");
    g_ButtonToggleSendOnClose = NewButton("Disable send session report on close");
    g_ButtonToggleSendOnPause = NewButton("Disable send session report on pause");

    g_ButtonSetDefaultMessage = NewButton("Set Default Banner Message");
    g_ButtonToggleAdBanner = NewButton("Toggle Ad Banner");
    g_ButtonShowOfferWall = NewButton("Display Offer Wall");

    g_ButtonLogEvent->m_Enabled = false;
    g_ButtonLogTimedEvent->m_Enabled = false;
    g_ButtonEndTimedEvent->m_Enabled = false;
    g_ButtonLogError->m_Enabled = false;
    g_ButtonUserInfo->m_Enabled = false;
    g_ButtonUserLocation->m_Enabled = false;
    g_ButtonToggleSendOnClose->m_Enabled = false;
    g_ButtonToggleSendOnPause->m_Enabled = false;

    g_ButtonSetDefaultMessage->m_Enabled = false;
    g_ButtonToggleAdBanner->m_Enabled = false;
    g_ButtonShowOfferWall->m_Enabled = false;

    if (!s3eFlurryAvailable())
    {
        AppendMessageColour(RED,"Extension Not Available");
        return;
    }

    // Enable AppCircle
    // We need to call this *before* calling s3eFlurryStart
    s3eFlurryAppCircleEnable();

    //iOS Applicaton Key
    if(s3eDeviceGetInt (S3E_DEVICE_OS) == S3E_OS_ID_IPHONE)
        s3eFlurryStart("DNWX7I7XZYYL9V1QAZFC");
    //Android Applicaton Key
    else if(s3eDeviceGetInt (S3E_DEVICE_OS) == S3E_OS_ID_ANDROID)
        s3eFlurryStart("HD4EZJ147ELQAT9H43KM");


    g_ButtonLogEvent->m_Enabled = true;
    g_ButtonLogTimedEvent->m_Enabled = true;
    g_ButtonEndTimedEvent->m_Enabled = true;
    g_ButtonLogError->m_Enabled = true;
    g_ButtonUserInfo->m_Enabled = true;
    g_ButtonUserLocation->m_Enabled = true;
    g_ButtonToggleSendOnClose->m_Enabled = true;
    g_ButtonToggleSendOnPause->m_Enabled = true;

    g_ButtonSetDefaultMessage->m_Enabled = true;
    g_ButtonToggleAdBanner->m_Enabled = true;
    g_ButtonShowOfferWall->m_Enabled = true;

    s3eLocationStart();
}