Ejemplo n.º 1
0
void DisplayFunc()
{
	//Clear screen
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    //Main Viewport
    glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(60.0 , ((float) model->width) / ((float) model->height), 1.0f , 2000.0);
	glViewport(0 , 0 , model->width, model->height);
    
   
	switch(model->state){
        case TITLE:
            pregame();
            break;
		case MAINMENU:
			mainMenu();
			break;
		case METAPAUSE:
			metapause();
			break;
		case MINIPAUSE:
			minipause();
			break;
        case GAMEPLAY:
            gameplay();
            break;
        case MINIGAME:
            minigame();
            break;
	}
    
    model->tickCount++;
	glutSwapBuffers();
}
Ejemplo n.º 2
0
int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil) {
    /* Here messages to the application are saved */
    MSG messages;

    /* Data structure for the windowclass */
    WNDCLASSEX wincl;

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default color as the background of the window */
    wincl.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);

    /* Register the window class, and if  it fails quit the program */
    if (!RegisterClassEx (&wincl)) {
        return 0;
    }

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           "ISL - Emulator",    /* Title Text */
           WS_OVERLAPPEDWINDOW, /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           400,                 /* The programs width */
           350,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           ); 
   
    ShowWindow (hwnd, nFunsterStil);

    readTeamFiles();
    
    frameOneDec();
    frameTwoDec();
    frameThreeDec();
    frameFourDec();
    multFrameDec();

    frame = 1;
    inProg = false;

    while (GetMessage (&messages, NULL, 0, 0)) {
        TranslateMessage(&messages);
        DispatchMessage(&messages);
        
        if (frame == 1) {
            ShowWindow(stat_percent,SW_HIDE);
            ShowWindow(stat_score,SW_HIDE);
            ShowWindow(btn_back,SW_HIDE);
            ShowWindow(btn_start,SW_SHOW);
            ShowWindow(btn_close,SW_SHOW);
        } else if (frame == 2) {
            ShowWindow(btn_start,SW_HIDE);
            ShowWindow(btn_close,SW_HIDE);
            ShowWindow(lbox_teamsOne,SW_SHOW);
            ShowWindow(lbox_teamsTwo,SW_SHOW);
            ShowWindow(btn_continue,SW_SHOW);
            ShowWindow(cb_ot,SW_SHOW);
            ShowWindow(cb_so,SW_SHOW);
            ShowWindow(stat_teamsOne,SW_SHOW);
            ShowWindow(stat_teamsTwo,SW_SHOW);
        } else if (frame == 3) {
            ShowWindow(lbox_teamsOne,SW_HIDE);
            ShowWindow(lbox_teamsTwo,SW_HIDE);
            ShowWindow(cb_ot,SW_HIDE);
            ShowWindow(cb_so,SW_HIDE);
            ShowWindow(stat_teamsOne,SW_HIDE);
            ShowWindow(stat_teamsTwo,SW_HIDE);
            ShowWindow(btn_continue,SW_HIDE);
            ShowWindow(stat_percent,SW_SHOW);
            if (!inProg) {
              inProg = true;
              pregame();  //the game
              game();
              postgame(); //ending of the game
              frame = 4;
            }
        } else if (frame == 4) {
            ShowWindow(stat_score,SW_SHOW);
            ShowWindow(btn_back,SW_SHOW);
            inProg = false;
        }
    }
    return messages.wParam;
}