Пример #1
0
void ReplayMaster::init() {
    init_globals();

    SoundDriver::driver()->set_global_volume(8);  // Max volume.

    world = Rect(Point(0, 0), Preferences::preferences()->screen_size());
    play_screen = Rect(
                      world.left + kLeftPanelWidth, world.top,
                      world.right - kRightPanelWidth, world.bottom);
    viewport = play_screen;

    gRealWorld = new ArrayPixMap(world.width(), world.height());
    gRealWorld->fill(RgbColor::kBlack);
    CreateOffscreenWorld();
    InitSpriteCursor();
    RotationInit();
    InterfaceHandlingInit();
    InitDirectText();
    ScreenLabelInit();
    InitMessageScreen();
    InstrumentInit();
    SpriteHandlingInit();
    AresCheatInit();
    ScenarioMakerInit();
    SpaceObjectHandlingInit();  // MUST be after ScenarioMakerInit()
    InitSoundFX();
    MusicInit();
    InitMotion();
    AdmiralInit();
    InitBeams();
}
Пример #2
0
extern "C" void WinMainCRTStartup()
{
	//Sleep(15000);
	
	HDC hDC;
	HGLRC context;
	CreateGLWindow(&hDC, &context);
	Demo demo;
	demo.Init();

	MusicInit(music);
	sndPlaySoundA((const char*)&music, SND_ASYNC|SND_MEMORY|SND_LOOP);
    
    do
    {
		demo.Step();
		demo.RenderFrame();
		
		SwapBuffers(hDC);
		AppProcessMessages();
	}
	while(!GetAsyncKeyState(VK_ESCAPE));

    ExitProcess(0);
}
Пример #3
0
//-----------------------------------------------------------------------------
// Main global function
//-----------------------------------------------------------------------------
int main()
{
    IwGxInit();
	Iw2DInit();
	//SplashInit();
	//SplashRender();
	srand(time(NULL));
	g_Input.Init();
	LifeStatusInit();
	FontInit();
	//MenuInit();
	FondoInit();
    BaconInit();
	MusicInit("./textures/musicOn.jpg");
	while (menuB)
	{
		menuB = false;
		menu();
	}
	spriteManager->removeSprite(corazon);
	delete corazon;
	for (int i=0; i<10; i++)
	{
		spriteManager->removeSprite(garras[i]);
		delete garras[i];
		spriteManager->removeSprite(tnts[i]);
		delete tnts[i];
	}
	for (int i=0; i<20; i++)
	{
		spriteManager->removeSprite(miniCoins[i]);
		delete miniCoins[i];
	}
	delete tank;
	spriteManager->removeSprite(maxiCoin);
	delete maxiCoin;
	delete chuletas;

	g_Input.Release();
	FondoShutDown();
    BaconShutDown();
	FontShutDown();
	SplashShutDown();
	LifeStatusShutDown();
	IwGxFontTerminate();
    IwGxTerminate();
	Iw2DTerminate();
	s3eDeviceExit();
    return 0;
}
Пример #4
0
void LunaticInit(MGLDraw *mgl)
{
	gamemgl = mgl;

	logFile = AppdataOpen("loonylog.txt", "wt");
	InitCosSin();
	InitDisplay(gamemgl);
	InitSound();
	InitMonsters();
	InitTiles(mgl);
	InitItems();
	InitInterface();
	LoadOptions();
	MusicInit();
	mgl->SetLastKey(0);
	MGL_srand(timeGetTime());
	InitControls();
	InitPlayer(INIT_GAME, 0, 0);
	msgFromOtherModules = 0;
}
/* user main function, called by AppFramework after system init done && wifi
 * station on in user_main thread.
 */
OSStatus user_main( app_context_t * const app_context )
{
  user_log_trace();
  OSStatus err = kUnknownErr;
  unsigned char rdata[64];
  unsigned char sdata[64];
  uint16_t datalen;

  require(app_context, exit);

  // platform initialize
  AaSysComInit();
  AaSysLogInit();

  // application initialize
  ControllerBusInit();
  OuterTriggerInit(NULL);
  TemperatureInit();  // will be support in release 2
  BatteryInit();

  // reset f411 and wait until it startup
  ResetF411();

#if 1
  MOInit();
#endif

  err = SntpInit(app_context);
  if(kNoErr != err) {
    AaSysLogPrint(LOGLEVEL_ERR, "SntpInit finished with err code %d", err);
  }
  else {
    AaSysLogPrint(LOGLEVEL_INF, "SntpInit success");
  }

#if 1
  DeviceInit(app_context);
  HealthInit(app_context);
  LightsInit(app_context);
  MusicInit(app_context);

  // start the downstream thread to handle user command
  err = mico_rtos_create_thread(&user_downstrem_thread_handle, MICO_APPLICATION_PRIORITY, "user_downstream", 
                                user_downstream_thread, STACK_SIZE_USER_DOWNSTREAM_THREAD, 
                                app_context );
  require_noerr_action( err, exit, user_log("ERROR: create user_downstream thread failed!") );
#endif


  user_log("[DBG]net_main: Appilcation Initialize success @"SOFTWAREVERSION);

  // user_main loop, update oled display every 1s
  while(1){

#if 1
    mico_thread_sleep(MICO_WAIT_FOREVER);
#else

    mico_thread_sleep(5);

    datalen = user_uartRecv(rdata, 5);
    if(datalen) {
      user_log("[DBG]user_main: Usart recevice datalen %d", datalen);
      user_log("[DBG]user_main: receive %.*s", datalen, rdata);
    }
    else {
      user_log("[DBG]user_main: Usart didn't recevice data");
    }

    mico_thread_sleep(2);

    sprintf(sdata, "hello, world!\r\n");
    user_uartSend(sdata, strlen(sdata));
#endif

  }

exit:
  if(kNoErr != err){
    user_log("[ERR]user_main: user_main thread exit with err=%d", err);
  }
  mico_rtos_delete_thread(NULL);  // delete current thread
  return err;
}
Пример #6
0
void menu()
{
	MenuInit();
	//MusicInit("./textures/musicOn.jpg");
	g_Input.gameOff();
	MenuRender();
	MusicRender();

	while(!g_Input.getGame())
	{
		int64 start = s3eTimerGetMs();
		while ((s3eTimerGetMs() - start) < MS_PER_FRAME)
        {
			
            int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start));
            if (yield<0)
                break;
            s3eDeviceYield(yield);
        }
		if (g_Input.getTouchCount() != 0)
		{
			int x = g_Input.getTouch(0)->x;
			int y = g_Input.getTouch(0)->y;

			if (x <= 750 && x >= 500 && y <= 400 && y >= 200)
			{
				if (g_Input.getSound())
				{
					MusicShutDown();
					MusicInit("./textures/musicOf.jpg");
					MusicRender();
					g_Input.soundOff();
				}
				else
				{
					MusicShutDown();
					MusicInit("./textures/musicOn.jpg");
					MusicRender();
					g_Input.soundOn();
				}
			}

			if (x <= 1270 && x >= 500 && y <= 190 && y >= 10)
				g_Input.gameOn();
		}
	}
	//MusicShutDown();
	//MenuShutDown();
    IwGxSetColClear(0xff, 0xff, 0xff, 0xff);
    IwGxPrintSetColour(128, 128, 128);
	g_Input.initTimer();	
	g_Input.setTotalTime();
	g_Input.setPosInitY(g_Input.getAccelerometerY());
	
	SplashInit();
	SplashUpdate("loading");
	SplashRender();
	MenuShutDown();
	if (initMenu)
	{
		//Creating objects
		corazon = new corazones("corazones", 64, 64, -100, 1,2,false);
		for (int i=0; i<10; i++)
		{
			garras[i] = new claws("claws", 128, 128, -150,1,2,false);
		}
		maxiCoin = new Coin("./textures/monedas200pts.png", 128, 128, -150,1,2,false);
		for (int j=0; j<20; j++)
		{
			miniCoins[j] = new MiniCoin("coins", 64, 64, -100,1,2,true);
		}
		for (int i=0; i<10; i++)
		{
			tnts[i] = new Tnt("tnts", 128, 128, -150,1,2,false);
		}
		tank = new Tank();
		tank->Init("./textures/tank.png", 256, 256, -300,1,2,false);
		chuletas = new Chuletas();
		chuletas->Init("./textures/chuletas.png", 512, 512, -600,1,2,false);
	}
	SplashShutDown();
	//SplashInit();
	//SplashUpdate("go");
	ciclo();
}