Esempio n. 1
0
//////////////////////////////////////////////////////
//              METHODS OF CLASS 'ADMIN'            //
//////////////////////////////////////////////////////
void Admin::Menu()
{
  char choice;
  SplashScreen(1,FName);
  delay(4000);
  do {
    clrscr();
    gotoxy(29,4);
    textcolor(12);
    cprintf("Please enter your option : ");
    textcolor(7);
    cout<<"\n\n\t\t[1] View applicants list\n\t\t[2] Applicant search\n\t\t[3] View employers\n\t\t[4] Employer search\n\t\t[5] Delete Applicant \n\t\t[6] Delete Employer \n\t\t[7] Logout \n\t\t[8] Exit";
    DrawBorder(15,2,59,20,0);
    gotoxy(29,15);
    cin>>choice;
    switch (choice)
    {
      case '1' : 
        clrscr();
        ListApplicants();
        break;
      case '2' : 
        clrscr();
        SearchApplicants();
        break;
      case '3' : 
        clrscr();
        ListEmployers();
        break;
      case '4' :  
        clrscr();
        SearchEmployers();
        break;
      case '5' :
        DeleteApplicant();
        break;
      case '6' :
        DeleteEmployer();
        break;
      case '7' :  
        break;
      case '8' : 
        SplashScreen(2,NULL);
      default  : 
        error(1);
        break;
    }
  } while (choice!='5');
}
Esempio n. 2
0
void Initialize(){
	DrawString(TOP_SCREEN,  " INITIALIZE... ", 0, 240-8, WHITE, BLACK);
	if(FSInit()){
		DrawString(TOP_SCREEN,  " LOADING...    ", 0, 240-8, WHITE, BLACK);
	}else{
		DrawString(TOP_SCREEN,  " ERROR!        ", 0, 240-8, RED, BLACK);
	}
	LoadPack();
	//Console Stuff
	memset(TOP_SCREEN, 0x00, 0x46500);
	memset(TOP_SCREEN2, 0x00, 0x46500);
	ConsoleSetXY(15, 15);
	ConsoleSetWH(370, 160);
	ConsoleSetBorderColor(BLUE);
	ConsoleSetTextColor(WHITE);
	ConsoleSetBackgroundColor(BLACK);
	ConsoleSetSpecialColor(BLUE);
	ConsoleSetSpacing(2);
	ConsoleSetBorderWidth(3);
	//Check that the data is installed
	f_mkdir ("rxTools");
	f_mkdir ("rxTools/nand");
	InstallConfigData();
	
	SplashScreen();
	for(int i = 0; i < 0x333333*6; i++){
		u32 pad = GetInput();
		if(pad & BUTTON_R1 && i > 0x333333) goto rxTools_boot;
	}
    rxModeQuickBoot();
	rxTools_boot:
	memset(TOP_SCREEN, 0x00, 0x46500);
	memset(TOP_SCREEN2, 0x00, 0x46500);
}
Esempio n. 3
0
bool Game::Run()
{
	
	SplashScreen();

	LoadScreen();
	

	Initialize();
	_currentState=_pMenu;
	//_currentState = new Level1(_rWindow,_rSfmlDebugDraw,_pWorld,score);
	
	LoadContent();

	Clock timeElapsed;

	while ( _rWindow.isOpen() )
	{
		
		_rWindow.pollEvent(e);

		if ( e.type == Event::Closed )
		{
			_rWindow.close();
			UnloadContent();
			break;
		}

		if(e.type==Event::KeyPressed)
		{
			if(Keyboard::isKeyPressed(Keyboard::LAlt) && Keyboard::isKeyPressed(Keyboard::F4))
			{
				_rWindow.close();
				UnloadContent();
				break;
			}

			
		}
		
		HandleInput( e );

		//Time lastUpdateCall = timeElapsed.restart();

		if ( timeElapsed.getElapsedTime().asMilliseconds() >= timeStep)
		{
			Update( e, oldEvent, timeElapsed.restart() );
		}
	
		Time lastDrawCall = /*lastUpdateCall +*/ timeElapsed.getElapsedTime(); //.restart();

		Draw( _rWindow, lastDrawCall );

		oldEvent = e;
	}
	
	return true;
}
Esempio n. 4
0
//////////////////////////////////////////////////////
//      METHODS OF CLASS 'EMPLOYER'       //
//////////////////////////////////////////////////////
void Employer::Menu()
{
  char choice;
  SplashScreen(1,FName);
  delay(2000);
  do {
    clrscr();
    gotoxy(29,5);
    textcolor(12);
    cprintf("Please enter your option : ");
    textcolor(7);
    cout<<"\n\n\t\t\t[1] View employer profile\n\n\t\t\t[2] Edit profile\n\n\t\t\t[3] View applicant list \n\n\t\t\t[4] Applicant search\n\n\t\t\t[5] Logout\n\n\t\t\t[6] Exit";
    DrawBorder(23,3,55,19,0);
    gotoxy(29,21);
    cin>>choice;
    cin.ignore();
    switch (choice)
    {
      case '1' : 
        clrscr();
        ViewProfile();
        break;
      case '2' : 
        cout<<"Taking you to profile....";
        delay(500);
        clrscr();
        ViewProfile();
        break;
      case '3' : clrscr();
        ListApplicants();
        break;
      case '4' :  clrscr();
        SearchApplicants();
        break;
      case '5' : 
        break;
      case '6' : 
        SplashScreen(2,NULL);
      default  : 
        error(1);
       break;
    }
  } while (choice!='5');
}
Esempio n. 5
0
//////////////////////////////////////////////////////
//      METHODS OF CLASS 'APPLICANT'        //
//////////////////////////////////////////////////////
void Applicant::Menu()
{
  char choice;
  SplashScreen(1,FName);
  delay(4000);
  do {
    clrscr();
    gotoxy(29,4);
    textcolor(12);
    cprintf("Please enter your option : ");
    textcolor(7);
    cout<<"\n\n\t[1] View Profile \n\n\t[2] Edit Profile \n\n\t[3] View Employers \n\n\t[4] Logout\n\n\t[5] Exit\n";
    DrawBorder(6,2,73,18,0);
    gotoxy(29,17);
    cin>>choice;
    cin.ignore();
    switch (choice)
    {
      case '1': 
        clrscr();
        ViewProfile();
        break;
      case '2': 
        cout<<"Taking you to profle ........";
        delay(500);
        clrscr();
        ViewProfile();
      case '3': 
        clrscr();
        ListEmployers();
        break;
      case '4': 
        break;
      case '5': 
        SplashScreen(2,NULL);
      default : 
        error(1);
    }
  } while(choice!='4');
}
Esempio n. 6
0
/*
 * Function
 *	TorcsEntry
 *
 * Description
 *	entry point of TORCS
 *
 * Parameters
 *	none
 *
 * Return
 *	none
 *
 * Remarks
 *	
 */
void
TorcsEntry(void)
{
	ssgInit();

	GfInitClient();

	TorcsMainMenuInit();

	SplashScreen();
	
	startMenuMusic();
}
Esempio n. 7
0
void init()
{
	wdt_start(wdt_250ms);
	initProc();
	initVars();
	initParams();
#ifndef _DEBUG_
	lcd_init(LCD_DISP_ON);
	//init_lcd_simbols();
#ifdef _DEMO_VERSION_
	SplashScreen();
#endif // _DEMO_VERSION_
#endif // _DEBUG_
	SetMenu(&mPrograms);
}
void ScreenManager::AddScreen(std::string screenName, ScreenTypes screenType)
{
	switch (screenType)
	{
		case ScreenTypes::SplashScreen:
			m_screenCollection.push_back((Screen)SplashScreen(screenName, m_stalker));
			break;
		case ScreenTypes::MainScreen:
			break;
		case ScreenTypes::Credits:
			break;
		default:
			break;
	}
	
}
int APIENTRY _tWinMain(HINSTANCE hInstance,
                       HINSTANCE hPrevInstance,
                       LPTSTR    lpCmdLine,
                       int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);

    hInst = hInstance;

    if (__argc == 2 && _wcsicmp(__wargv[0], _T("SPLASH")) == 0)
    {
        HBITMAP hSplashBitmap = static_cast<HBITMAP>(LoadImage(hInst, MAKEINTRESOURCE(IDB_SPLASH), IMAGE_BITMAP, 0, 0, 0));
        if (hSplashBitmap)
        {
            parentProcId = _wtoi(__wargv[1]);
            parentProcHandle = OpenProcess(SYNCHRONIZE, FALSE, parentProcId);
            if (IsParentProcessRunning(parentProcHandle)) SplashScreen(hSplashBitmap);
        }
        CloseHandle(parentProcHandle);
        return 0;
    }

    //it's OK to return 0 here, because the control is transferred to the first instance
    if (!CheckSingleInstance()) return 0;

    if (nativesplash = wcsstr(lpCmdLine, _T("/nativesplash")) != NULL) StartSplashProcess();

    if (!LocateJVM()) return 1;
    if (!LoadVMOptions()) return 1;
    if (!LoadJVMLibrary()) return 1;
    if (!CreateJVM()) return 1;

    hSingleInstanceWatcherThread = CreateThread(NULL, 0, SingleInstanceThread, NULL, 0, NULL);

    if (!RunMainClass()) return 1;

    jvm->DestroyJavaVM();

    terminating = true;
    SetEvent(hEvent);
    WaitForSingleObject(hSingleInstanceWatcherThread, INFINITE);
    CloseHandle(hEvent);
    CloseHandle(hFileMapping);

    return 0;
}
Esempio n. 10
0
BOOLEAN
StartGame (void)
{
	do
	{
		while (!TryStartGame ())
		{
			if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
			{	// timed out
				GLOBAL (CurrentActivity) = 0;
				SplashScreen (0);
				if(optWhichIntro == OPT_3DO){
					Drumall ();
				}
				Credits (FALSE);
			}

			if (GLOBAL (CurrentActivity) & CHECK_ABORT)
				return (FALSE); // quit
		}

		if (LastActivity & CHECK_RESTART)
		{	// starting a new game
			FadeMusic (NORMAL_VOLUME, 0);
			if(!optSkipIntro){
				Introduction ();
			}
		}
	
	} while (GLOBAL (CurrentActivity) & CHECK_ABORT);

	{
		extern STAR_DESC starmap_array[];
		extern const BYTE element_array[];
		extern const PlanetFrame planet_array[];

		star_array = starmap_array;
		Elements = element_array;
		PlanData = planet_array;
	}

	PlayerControl[0] = HUMAN_CONTROL | STANDARD_RATING;
	PlayerControl[1] = COMPUTER_CONTROL | AWESOME_RATING;

	return (TRUE);
}
Esempio n. 11
0
//====================================================================================
void main()
{
// Init SysTick
SysTick_Config(SystemCoreClock / 1000);	// Generate interrupt every 1 ms

// Init the OLED display and required hardware
InitOLED();

// Init on-board LED as output
LPC_GPIO1->FIODIR |= 1 << 18;

for(;;)
{
SplashScreen();
TextDemo();
ImageDemo();
AnimationDemo();
}
}
Esempio n. 12
0
BOOLEAN
StartGame (void)
{
	do
	{
		while (!TryStartGame ())
		{
			if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
			{	// timed out
				GLOBAL (CurrentActivity) = 0;
				SplashScreen (0);
				Credits (FALSE);
			}

			if (GLOBAL (CurrentActivity) & CHECK_ABORT)
				return (FALSE); // quit
		}

		if (LastActivity & CHECK_RESTART)
		{	// starting a new game
			Introduction ();
		}
	
	} while (GLOBAL (CurrentActivity) & CHECK_ABORT);

	{
		extern STAR_DESC starmap_array[];
		extern const BYTE element_array[];
		extern const PlanetFrame planet_array[];

		star_array = starmap_array;
		Elements = element_array;
		PlanData = planet_array;
	}

	PlayerControl[0] = HUMAN_CONTROL | STANDARD_RATING;
	PlayerControl[1] =  COMPUTER_CONTROL | AWESOME_RATING;
	SetPlayerInput ();

	return (TRUE);
}
//====================================================================================
int main(int argc, char **argv)
{
	int i;
	
	printf("Black Ram Electronics Mono OLED Demo\n");
	
	// Configure interface hardware and setup the display
	InitOLED();
	
	// Loop through the demo three times
	for(i = 0; i < 3; i++)
	{
		SplashScreen();
		TextDemo();
		ImageDemo();
		AnimationDemo();
	}
	
	// Release the hardware
	DeinitOLED();

	return(0);
}
Esempio n. 14
0
//------------
//Main Program
//------------
int main(void)
{
 Initialization();
 Info_Msg = MemString(Info_Msg, "Ncurses initialized\n");

 SplashScreen();
 Info_Msg = MemString(Info_Msg, "SplashScreen displayed\n");

 ScreenBorderSetup();
 if ((MaxRows <= 19) & (MaxCols <= 58) |
     (MaxRows <= 19) |
     (MaxCols <= 30))
 {
  free(Info_Msg);
  endwin();
  return(0);
 }
 Info_Msg = MemString(Info_Msg, "ScreenBorderSetup\n");

 ScreenWindowSetup();
 Info_Msg = MemString(Info_Msg, "Windows Initialized\n");

 InfoLineCounter();
 InfoScroller();

 wprintw(MainWin, "The Main Window");
 wrefresh(MainWin);

 mvwprintw(StatusWin, 0, COLS - 43, "Window: Menu  |                       ");
 wrefresh(StatusWin);

 DisplayMainMenu(HighlightedChoice);
 ChoiceSelection();
 free(Info_Msg);
 End();
 return 0;
}
Esempio n. 15
0
bool LegacyMenu::activate()
{
    bool (*fnSplashBackWork)(void) = LegacyMenu::backLoad;
    bool (*fnOnSplashClosed)(void) = 0;
    bool bInteractive = true;

    // Get the race to start if specified, and check if it's an available one.
    std::string strRaceToStart;
    if (GfApp().hasOption("startrace", strRaceToStart)
		&& !GfRaceManagers::self()->getRaceManager(strRaceToStart))
	{
        GfLogError("No such race type '%s', falling back to interactive choice\n",
				   strRaceToStart.c_str());
		strRaceToStart.clear(); // Cancel wrong choice.
	}

    // If no specified race to start, or if not an available one,
	// simply open the splash screen, load the menus in the background
	// and finally open the main menu.
	if (strRaceToStart.empty())
	{
        // If not specified, simply open the splash screen, load the menus in the background
        // and finally open the main menu.
        fnOnSplashClosed = LegacyMenu::activateMainMenu;
    }

	// Otherwise, run the selected race.
    else
	{
        // Open the splash screen, load some stuff in the background
        // and finally start the specified race.
        fnOnSplashClosed = LegacyMenu::startRace;
        bInteractive = false;
    }

    return SplashScreen(fnSplashBackWork, fnOnSplashClosed, bInteractive);
}
Esempio n. 16
0
/* draw the screensaver once */
ENTRYPOINT void draw_atunnel(ModeInfo * mi)
{
  	atunnelstruct *sa = &Atunnel[MI_SCREEN(mi)];
  	Display    *display = MI_DISPLAY(mi);
  	Window      window = MI_WINDOW(mi);

  	if (!sa->glx_context)
		return;

  	glXMakeCurrent(display, window, *(sa->glx_context));

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glLoadIdentity();

	DrawTunnel(sa->ts, do_texture, do_light, sa->texture);
	SplashScreen(sa->ts, do_wire, do_texture, do_light);

	glFlush();  
	/* manage framerate display */
    	if (MI_IS_FPS(mi)) do_fps (mi);
  	glXSwapBuffers(display, window);

}
Esempio n. 17
0
File: main.cpp Progetto: libgpl/GPL
void main()
{
	// Cria uma sprite para o splash screen
	Sprite splashSprite;

	// Carrega uma animação de um sprite sheet
	splashSprite.loadSpriteSheet("splash.png", 1, 15);

	// Define a velocidade da animação a ser usada na splash screen
	splashSprite.setSpeed(206);

	// Define a animação e o tempo de exibição da splash screen
	SplashScreen(splashSprite, 3);

	// Cria a janela
	Window janela(800, 600, "Minha Janela", true, false);

	// Define a quantidade máxima de FPS
	janela.setFPS(60);

	// Define o icone da janela
	janela.setIcon("icone.png");

	// INICIO DA SEÇÃO DE CARREGAMENTO DE ARQUIVOS

	// FIM DA SEÇÃO DE CARREGAMENTO DE ARQUIVOS

	// Enquanto a tecla 'ESC' não for pressionada
	while (!input->isPressed(KEY::Escape))
	{
		// BLOCO DE COMANDOS

		// Atualiza a tela - deve ser a última coisa a ser chamada dentro do loop
		janela.flush();
	}
}
Esempio n. 18
0
void Game::OnRender()
{
    static int framing = 0;

    SDL_RenderClear(Renderer);

    //cout<<"Kx = "<<Kx<<" Ky = "<<Ky<<endl;

    if(SplashScreen() == true)
      return;

    if(sunny == true)
        Background = backDay;
    else
        Background = backNight;

    Draw(Background, 0, 0, WindowWidth, WindowHeight, SDL_FLIP_NONE);

    //cout<<"Background"<<endl;

   // SDL_RenderDrawLine(Renderer, lineX1, lineY1, lineX2, lineY2);

    Draw(Meter.Image, Meter.XPos, Meter.YPos, Meter.Width, Meter.Height, Meter.Flip);

    Draw(MeterF.Image, MeterF.XPos, MeterF.YPos, MeterF.Width, MeterF.Height, MeterF.Flip);

    Draw(RecycleBin.Image, RecycleBin.XPos, RecycleBin.YPos, RecycleBin.Width, RecycleBin.Height, RecycleBin.Flip);

    Draw(DayNight.Image, DayNight.XPos, DayNight.YPos, DayNight.Width, DayNight.Height, DayNight.Flip);

    if(sunny == false)
    {
        Draw(MyMoon.Animate,
            Moon.XPos, Moon.YPos, Moon.Width, Moon.Height,
            MyMoon.width, MyMoon.height, MyMoon.Width, MyMoon.Height,
            Moon.Flip);
    }
    else
    {
        Draw(MySun.Animate,
            Sun.XPos, Sun.YPos, Sun.Width, Sun.Height,
            MySun.width, MySun.height, MySun.Width, MySun.Height,
            Sun.Flip);
    }

    Draw(MyTree.Animate,
            Tree.XPos, Tree.YPos, Tree.Width, Tree.Height,
            MyTree.width, MyTree.height, MyTree.Width, MyTree.Height,
            Tree.Flip);

    Draw(Level[level].Image, Level[level].XPos, Level[level].YPos, Level[level].Width, Level[level].Height, SDL_FLIP_NONE);

    for(int i = 0; i < maxKapki; i ++)
    {
        if(Kapka[i].falling == true)
            Draw(Kapchica, Kapka[i].XPos, Kapka[i].YPos, Kapka[i].Width, Kapka[i].Height, SDL_FLIP_NONE);
    }

    for(int i = 0; i < 10; i ++)
    {
        if(Rubish[i].falling == true)
            Draw(Rubish[i].Image, Rubish[i].XPos, Rubish[i].YPos, Rubish[i].Width, Rubish[i].Height, SDL_FLIP_NONE);
    }

    Draw(Cloud.Image, Cloud.XPos, Cloud.YPos, Cloud.Width, Cloud.Height, Cloud.Flip);

    Draw(Fertilizer.Image, Fertilizer.XPos, Fertilizer.YPos, Fertilizer.Width, Fertilizer.Height, Fertilizer.Flip);

    Draw(Kapchica, waterPointer.x * Kx, waterPointer.y * Ky, waterPointer.w * Kx, waterPointer.h * Ky, SDL_FLIP_NONE);

    Draw(Kapchica, fertilizePointer.x * Kx, fertilizePointer.y * Ky, fertilizePointer.w * Kx, fertilizePointer.h * Ky, SDL_FLIP_NONE);

    ///      Creating animation

    MySun.Animate = Sun.Image;
    MySun.Frames = 4;
    MySun.Height = 85;
    MySun.Width = 85;
    MySun.SpriteHeight = 85;
    MySun.SpriteWidth = 340;

    MyMoon.Animate = Moon.Image;
    MyMoon.Frames = 8;
    MyMoon.Height = 100;
    MyMoon.Width = 100;
    MyMoon.SpriteHeight = 100;
    MyMoon.SpriteWidth = 800;

    MyTree.Animate = Tree.Image;
    MyTree.Frames = 11;
    MyTree.Height = 330;
    MyTree.Width = 463;
    MyTree.SpriteHeight = 330;
    MyTree.SpriteWidth = 5093;

    if(framing == 3)
    {
        MyMoon.Animation();
        MySun.Animation();
        MyTree.Animation();
        framing = 0;
    }

    framing ++;

    SDL_RenderPresent(Renderer);
}
Esempio n. 19
0
/*-----------------------------------------------*/
int WelcomeScreen()
{
  int i,j;
  char choice,animation_array[14]="Login Portals";
  clrscr();
  textbackground(0);
  textcolor(7);
  for(i=20,j=58;i<59;i++,j--)
  {
    delay(50);
    gotoxy(i,3);
    cprintf(".");
    gotoxy(j,7);
    cprintf(".");
  }
  for(i=3,j=6;i<7;i++,j--)
  {
    delay(50);
    gotoxy(20,i);
    cprintf(".");
    gotoxy(58,j);
    cprintf(".");
  }
  delay(200);
  gotoxy(23,5);
  cout<<"Welcome to Intellisoft Job Portal";
  delay(500);
  gotoxy(33,13);
  for(i=0;i<14;i++)
  {
    delay(100);
    cout<<animation_array[i];
  }
  delay(200);
  textbackground(3);
  for (i=4;i<24;i++)
  {
    for(j=15;j<20;j++)
    {
      gotoxy(i,j);
      cprintf(" ");
    }
  }
  textcolor(0);
  gotoxy(10,17);
  cprintf("[1] Admin");
  delay(200);
  textbackground(4);
  for (i=29;i<49;i++)
  {
    for(j=15;j<20;j++)
    {
      gotoxy(i,j);
      cprintf(" ");
    }
  }
  gotoxy(33,17);
  cprintf("[2] Applicant");
  delay(200);
  textbackground(6);
  for (i=54;i<74;i++)
  {
    for(j=15;j<20;j++)
    {
      gotoxy(i,j);
      cprintf(" ");
    }
  }
  gotoxy(59,17);
  cprintf("[3] Employer");
  delay(200);
  textbackground(7);
  for (i=35;i<45;i++)
  {
    gotoxy(i,21);
    cprintf(" ");
  }
  gotoxy(35,21);
  cprintf("[4] Exit");
  delay(200);
  textattr(8<<0);
  gotoxy(20,23);
  cprintf("Enter choice : ");
  cin>>choice;
  cin.ignore();
  switch (choice)
  {
  	case '1' : 
      AdminPortal();
      break;
  	case '2' : 
      ApplicantPortal();
      break;
  	case '3' : 
      EmployerPortal();
      break;
  	case '4' : 
      SplashScreen(2,NULL);
      break;
  	default :  
      error(1);
      break;
  }
  return 0;
}
Esempio n. 20
0
int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR     lpCmdLine,
                   int       nCmdShow = SW_SHOW)
{
	HWND hwnd;
	MSG msg;
	WNDCLASSEX wcl;
	RECT windowRect;
	DWORD dwExStyle;		
	DWORD dwStyle;
	int mbResponse;

// To remind myself if I'm using the debug build!
#ifdef _DEBUG
	MessageBox(NULL, "This is the DEBUG build!", "DEBUG!", MB_OK);
#endif

	mbResponse = MessageBox(NULL, "Would you like to play in windowed mode?", "AntiVirus 2 Game Demo Display Mode", MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON1);

	switch(mbResponse)
	{
		case IDYES:
			windowed = true;
			break;
		case IDNO:
			windowed = false;
			break;
		case IDCANCEL:
			exit(0);
			break;
		default:
			break;
	}

	// Define a window class. 
	wcl.cbSize = sizeof(WNDCLASSEX); 
	wcl.hInstance = hInstance;     
	wcl.lpszClassName = szWinName; 
	wcl.lpfnWndProc = WindowFunc;  
	wcl.style = CS_HREDRAW | CS_VREDRAW;
	wcl.hCursor = (HCURSOR) LoadImage(hInstance, MAKEINTRESOURCE(IDC_CURSOR1), IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE);
	wcl.hIcon = (HICON) LoadImage(hInstance, MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE);
	wcl.lpszMenuName = NULL; 
	wcl.cbClsExtra = 0; 
	wcl.cbWndExtra = 0; 
	wcl.hbrBackground = reinterpret_cast <HBRUSH> (GetStockObject(BLACK_BRUSH)); 

	// Adjust size in pixels for performance reasons.
	windowRect.left = 0;
	windowRect.top = 0;
	windowRect.right = 800;
	windowRect.bottom = 600;

	// Register the window class. 
	if(!RegisterClassEx(&wcl)) 
		return 0;
	
	if(windowed)
	{
		SwitchToWindowed(hwnd, hInstance);
		ShowWindow(hwnd, SW_SHOW);
	}
	else
	{
		// Switch to full screen.
		if(!SwitchToFullScreen(hwnd, hInstance, windowRect, dwExStyle, dwStyle, windowRect.right, windowRect.bottom, 32))
			MessageBox(NULL, "Switch to full screen failed.", "Full Screen Error...", MB_OK);
		ShowWindow(hwnd, SW_MAXIMIZE);

	}

	ghwnd = hwnd;

	UpdateWindow(hwnd);

	// Start off and initialise game here!

	InitialiseAGUIMenu();
	iFeatureIsInitialised = 0;			// Do not invoke any gameplay modes.

	// Display the splashscreen!
	ShowCursor(false);
	if(windowed)
		SplashScreenInWindow();
	else
		SplashScreen();
	Sleep(4000);
	ShowCursor(true);

	// Initialise DirectSound and DiectInput components of DirectX
	if(!(DirectSoundInitialisation() && DirectInputDevicesInitialisation(hInstance)))
	{
		MessageBox(hwnd, "Program shutting down.", "DirectX Unrecoverable Error", MB_OK | MB_ICONINFORMATION);
		DeleteDirectSoundResources();
		DeleteDirectInputResources();
		exit(0);
	}

	// Fire up the menu beat!
	PlayMenuMusic();

	// Initialise player position in the environment.
	SphereObjectCoords[0].xcoord = 780.0f;
	SphereObjectCoords[0].ycoord = 270.0f;
	SphereObjectCoords[0].zcoord = -500.0f;

	FetchCurrentTime();

	ZeroMemory(&msg, sizeof(MSG));

	while(msg.message != WM_DESTROY)
	{
		if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) 
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);  
		}
		else
			if(CheckTimeDelta())
				GameLoopBody(hwnd);
	}

	ChangeDisplaySettings(NULL, 0);		// Restore original screen resolution.

	return (int) msg.wParam;
}
Esempio n. 21
0
int
Starcon2Main (void *threadArg)
{
#if CREATE_JOURNAL
{
int ac = argc;
char **av = argv;

while (--ac > 0)
{
	++av;
	if ((*av)[0] == '-')
	{
		switch ((*av)[1])
		{
#if CREATE_JOURNAL
			case 'j':
				++create_journal;
				break;
#endif //CREATE_JOURNAL
		}
	}
}
}
#endif // CREATE_JOURNAL

	{
		/* TODO: Put initAudio back in main where it belongs once threading
		 *       is gone.
		 */
		extern sint32 initAudio (sint32 driver, sint32 flags);
		initAudio (snddriver, soundflags);
	}

	if (!LoadKernel (0,0))
	{
		log_add (log_Fatal, "\n  *** FATAL ERROR: Could not load basic content ***\n\nUQM requires at least the base content pack to run properly.");
		log_add (log_Fatal, "This file is typically called uqm-%d.%d.0.uqm.  UQM was expecting it", P6014_MAJOR_VERSION, P6014_MINOR_VERSION);
		log_add (log_Fatal, "in the %s/packages directory.", baseContentPath);
		log_add (log_Fatal, "Either your installation did not install the content pack at all, or it\ninstalled it in a different directory.\n\nFix your installation and rerun UQM.\n\n  *******************\n");
		exit (EXIT_FAILURE);
	}
	log_add (log_Info, "We've loaded the Kernel");

	Logo ();
	
	GLOBAL (CurrentActivity) = 0;
	// show splash and init the kernel in the meantime
	SplashScreen (BackgroundInitKernel);

//	OpenJournal ();
	while (StartGame ())
	{
		// Initialise a new game
		if (!SetPlayerInputAll ()) {
			log_add (log_Fatal, "Could not set player input.");
			explode ();  // Does not return;
		}
		
		InitGameStructures ();
		InitGameClock ();
		AddInitialGameEvents();

		do
		{
#ifdef DEBUG
			if (debugHook != NULL)
			{
				void (*saveDebugHook) (void);
				saveDebugHook = debugHook;
				debugHook = NULL;
						// No further debugHook calls unless the called
						// function resets debugHook.
				(*saveDebugHook) ();
				continue;
			}
#endif
			SetStatusMessageMode (SMM_DEFAULT);

			if (!((GLOBAL (CurrentActivity) | NextActivity) & CHECK_LOAD))
				ZeroVelocityComponents (&GLOBAL (velocity));
					// not going into talking pet conversation
			else if (GLOBAL (CurrentActivity) & CHECK_LOAD)
				GLOBAL (CurrentActivity) = NextActivity;
			
			if ((GLOBAL (CurrentActivity) & START_ENCOUNTER)
					|| GET_GAME_STATE (CHMMR_BOMB_STATE) == 2)
			{
				if (GET_GAME_STATE (CHMMR_BOMB_STATE) == 2
						&& !GET_GAME_STATE (STARBASE_AVAILABLE))
				{	/* BGD mode */
					InstallBombAtEarth ();
				}
				else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) == (BYTE)~0
						|| GET_GAME_STATE (CHMMR_BOMB_STATE) == 2)
				{
					GLOBAL (CurrentActivity) |= START_ENCOUNTER;
					VisitStarBase ();
				}
				else
				{
					GLOBAL (CurrentActivity) |= START_ENCOUNTER;
					RaceCommunication ();
				}

				if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
				{
					GLOBAL (CurrentActivity) &= ~START_ENCOUNTER;
					if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY)
						GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
				}
			}
			else if (GLOBAL (CurrentActivity) & START_INTERPLANETARY)
			{
				GLOBAL (CurrentActivity) = MAKE_WORD (IN_INTERPLANETARY, 0);

				DrawAutoPilotMessage (TRUE);
				SetGameClockRate (INTERPLANETARY_CLOCK_RATE);
				ExploreSolarSys ();
			}
			else
			{
				// Entering HyperSpace or QuasiSpace.
				GLOBAL (CurrentActivity) = MAKE_WORD (IN_HYPERSPACE, 0);

				DrawAutoPilotMessage (TRUE);
				SetGameClockRate (HYPERSPACE_CLOCK_RATE);
				Battle (&on_battle_frame);
			}

			LockMutex (GraphicsLock);
			SetFlashRect (NULL);
			UnlockMutex (GraphicsLock);

			LastActivity = GLOBAL (CurrentActivity);

			if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
					&& (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE 
						|| LOBYTE (GLOBAL (CurrentActivity)) == BLACK_ORB_CUTSCENE 	// JMS: End demo at cutscene upon finding black orb.
						|| GLOBAL_SIS (CrewEnlisted) == (COUNT)~0)) // if died for some reason
			{
				if (GET_GAME_STATE (KOHR_AH_KILLED_ALL))
					InitCommunication (BLACKURQ_CONVERSATION);
						// surrendered to Ur-Quan
				else if (GLOBAL (CurrentActivity) & CHECK_RESTART)
					GLOBAL (CurrentActivity) &= ~CHECK_RESTART;
				break;
			}
		} while (!(GLOBAL (CurrentActivity) & CHECK_ABORT));

		StopSound ();
		UninitGameClock ();
		UninitGameStructures ();
		ClearPlayerInputAll ();
	}
//	CloseJournal ();

	UninitGameKernel ();
	FreeMasterShipList ();
	FreeKernel ();

	MainExited = TRUE;

	(void) threadArg;  /* Satisfying compiler (unused parameter) */
	return 0;
}