void entrypoint( void )
{              
    // full screen
    #ifdef SETRESOLUTION
    if( ChangeDisplaySettings(&screenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL) return;
    ShowCursor( 0 );
    #endif
    // create window
    HWND hWnd = CreateWindow( "static",0,WS_POPUP|WS_VISIBLE|WS_MAXIMIZE,0,0,0,0,0,0,0,0);
    HDC hDC = GetDC(hWnd);
    // initalize opengl
    if( !SetPixelFormat(hDC,ChoosePixelFormat(hDC,&pfd),&pfd) ) return;
    HGLRC hRC = wglCreateContext(hDC);
    wglMakeCurrent(hDC,hRC);

	// init intro
	intro_init();

#ifdef USEDSOUND
	// calculate music
	mzk_init( myMuzik+22 );
	// and play it 
    memcpy( myMuzik, wavHeader, 44 );
    sndPlaySound( (const char*)&myMuzik, SND_ASYNC|SND_MEMORY );
#endif

    long t;
	long to = timeGetTime();
    do 
	{
		//ShowCursor(false);

        t = timeGetTime(); 
        //if( !to ) to=t; 
        t = t-to;//-150;
    
        intro_do( t );
    
        //SwapBuffers ( hDC );   
        wglSwapLayerBuffers( hDC, WGL_SWAP_MAIN_PLANE );
	}while ( !GetAsyncKeyState(VK_ESCAPE) && t<(MZK_DURATION*1000) );

    sndPlaySound(0,0);

	intro_end();

    ExitProcess(0);
}
Esempio n. 2
0
//void entrypoint( void )
int main( void )
{
    XEvent      event;
    int         done=0;
    WININFO     *info = &wininfo;


    if( !smalloc_init() )
        {
        #ifdef ERRORMSG
        printf( "window_init()!" );
        #endif
        return( 1 );
        }

/*
    if( MessageBox( 0, "fullscreen?", info->wndclass, MB_YESNO|MB_ICONQUESTION)==IDYES )
        info->full++;
*/
    if( !window_init(info) )
        {
        window_end( info );
        #ifdef ERRORMSG
        printf( "window_init()!" );
        #endif
        return( 2 );
        }

    FONT_Init( (long)info->hDisplay );

    if( !intro_init( XRES, YRES, 0, (int)info->hWnd ) )
        {
        window_end( info );
        #ifdef ERRORMSG
        printf( msg_error );
        #endif
        return( 3 );
        }

    while( !done )
        {
        done = intro_do();

	while( XPending(info->hDisplay) )
            {
            XNextEvent( info->hDisplay, &event );
            switch( event.type )
                {
                case KeyPress:
                    switch( XKeycodeToKeysym( info->hDisplay, event.xkey.keycode, 0 ) )
			{
			case XK_Escape:
			    done = 1;
			    break;
                        }
					
                    break;
		case DestroyNotify:
		    done = 1;
                    break;
		}
            }
        glXSwapBuffers( info->hDisplay, info->hWnd );
        }

    intro_end();

    window_end( info );

    smalloc_end();

    return( 0 );
}