Пример #1
0
void Quit(int returnCode) {
    KillFont();

    SDL_Quit();

    exit(returnCode);
}
Пример #2
0
void FCEUGUI_Kill() {
	// free stuff
	if (g_bg)
		SDL_FreeSurface(g_bg);
	if (gui_screen)
		SDL_FreeSurface(gui_screen);
	KillFont();
}
Пример #3
0
void* KillGLWindow()								// Properly Kill The Window
{
	if (g_fullscreen)										// Are We In Fullscreen Mode?
	{
		ChangeDisplaySettings(NULL,0);					// If So Switch Back To The Desktop
		ShowCursor(true);								// Show Mouse Pointer
	}
	KillFont();
}
Пример #4
0
CVisText::~CVisText()
{
	Show=0;
	KillFont();
	if(VisWindow && Show){ 
		VisWindow->requestUpdate();
		if(VisWindow->logmode) VisWindow->logAction(tag,ACTION_DELETE,(double *)NULL,0);
	}
}
Пример #5
0
/* function to release/destroy our resources and restoring the old desktop */
void Quit( int returnCode )
{

    KillFont( );
    /* clean up the window */
    SDL_Quit( );

    /* and exit appropriately */
    // exit( returnCode );
}
Пример #6
0
/***********************************************************
reload font texture
***********************************************************/
void TextWritter::ReloadTexture()
{
	KillFont();
	LoadGLTextures("Data/Font.png", _textTextureIdx);
	BuildFont(_textTextureIdx);
	_initialized = true;

	ConfigurationManager::GetInstance()->GetInt("Options.General.TextR", m_textR);
	ConfigurationManager::GetInstance()->GetInt("Options.General.TextG", m_textG);
	ConfigurationManager::GetInstance()->GetInt("Options.General.TextB", m_textB);
}
Пример #7
0
TScene::~TScene()
{
	delete Camera;
	delete Scaner;
	delete []Mesh;

	KillFont();
	if (hGLRC) 
	{
		wglMakeCurrent(NULL, NULL);
		wglDeleteContext(hGLRC);
	}
}
Пример #8
0
STDMETHODIMP CVisText::put_fontName(BSTR newVal)
{
	// fontName is ASCII, but COM sends BSTR (i.e. WCS or unicode string)
	wcstombs( fontName, newVal, wcslen(newVal)+1 );
	KillFont();	BuildFont();
	calcTextBox();

	// Ask VisWindow to Update
	if(VisWindow && Show){ 
		VisWindow->requestUpdate();
		if(VisWindow->logmode) VisWindow->logAction(tag,ACTION_FONT,(double *)NULL,0);
	}
	return S_OK;
}
Пример #9
0
GLvoid KillGLWindow(GLvoid)								// Properly kill the window
{
	// Release memory
	if (g_Sector.pTriangle)
	{
		delete[] g_Sector.pTriangle;
		g_Sector.pTriangle = NULL;
		g_Sector.uNumTriAngle = 0;
	}
	if (g_bFullscreen)									// Are we in fullscreen mode?
	{
		ChangeDisplaySettings(NULL, 0);					// If so switch back to the desktop
		ShowCursor(TRUE);								// Show mouse pointer
	}
	if (hRC)											// Do we have a rendering context
	{
		if (!wglMakeCurrent(NULL, NULL))				// Are we able to release the DC and RC contexts?
		{
			MessageBox(NULL, MSG_RELEASEDCRCFAILED,
				ERR_SHUTDOWN_ERROR, MB_OK | MB_ICONINFORMATION);
		}
		if (!wglDeleteContext(hRC))						// Are we able to delete the RC?
		{
			MessageBox(NULL, MSG_RELEASERCFAILED,
				ERR_SHUTDOWN_ERROR, MB_OK | MB_ICONINFORMATION);
		}
		hRC = NULL;										// Set RC to NULL
	}
	if (hDC && !ReleaseDC(hWnd, hDC))					// Are we able to release the DC
	{
		MessageBox(NULL, MSG_RELEASEDCFAILED,
			ERR_SHUTDOWN_ERROR, MB_OK | MB_ICONINFORMATION);
		hDC = NULL;										// Set DC to NULL
	}

	if (hWnd && !DestroyWindow(hWnd))					// Are We Able To Destroy The Window?
	{
		MessageBox(NULL, MSG_RELEASEHWNDFAILED,
			ERR_SHUTDOWN_ERROR, MB_OK | MB_ICONINFORMATION);
		hWnd = NULL;										// Set hWnd To NULL
	}

	if (!UnregisterClass(CLASSNAME, hInstance))			// Are We Able To Unregister Class
	{
		MessageBox(NULL, MSG_UNREGISTERCLASSFAILED,
			ERR_SHUTDOWN_ERROR, MB_OK | MB_ICONINFORMATION);
		hInstance = NULL;								// Set hInstance to NULL
	}
	KillFont();											// Destroy The Font
}
Пример #10
0
STDMETHODIMP CVisText::put_fill(double newVal)
{
	int redo=0;
	if( fabs(newVal)<.01 && Fill ){ Fill=FALSE; redo=1; }
	else if( fabs(newVal)>.01 && !Fill ){ Fill=TRUE; redo=1;}
	if(redo){
		KillFont();	BuildFont();
	}

	if(VisWindow && Show){ 
		VisWindow->requestUpdate();
		if(VisWindow->logmode) VisWindow->logAction(tag,ACTION_FILL,&newVal,1);
	}
	return S_OK;
}
Пример #11
0
STDMETHODIMP CVisText::put_fontWeight(double newVal)
{
	if((int)newVal!=fontWeight){
		fontWeight=(int)(floor(newVal/100)*100.);  // Weight is in set 100:100:900
		if( fontWeight<100 && fontWeight!=0)	fontWeight=100;
		if( fontWeight>900)						fontWeight=900;
	
		KillFont();	BuildFont();
		calcTextBox();
		if(VisWindow && Show){ 
			VisWindow->requestUpdate();
			if(VisWindow->logmode) VisWindow->logAction(tag,ACTION_WEIGHT,&newVal,1);
		}
	}
	return S_OK;
}
Пример #12
0
STDMETHODIMP CVisText::put_fontItalic(double newVal)
{
	int redo=0;
	if( fabs(newVal)<.01 && fontItalic ){ fontItalic=FALSE; redo=1; }
	else if( fabs(newVal)>.01 && !fontItalic ){ fontItalic=TRUE; redo=1; }
	if(redo){
		KillFont();	BuildFont();
		calcTextBox();
	}

	if(VisWindow && Show){ 
		VisWindow->requestUpdate();
		if(VisWindow->logmode) VisWindow->logAction(tag,ACTION_ITALIC,&newVal,1);
	}
	return S_OK;
}
Пример #13
0
//
// ShutdownGL
// - place all memory releases and stuff here
//
void ShutdownGL(void)
{
#if 1
	KillFont();		// kill the font 

	DeleteObjects();

	ShutdownBots();

	ShutdownFireAnts();

	nest.shutdown();

	trail_set.shutdown();
	garden.shutdown();



	ShutdownWorld();	// hope I got all these


	Delete_Wall_List();

	Delete_Col_List();

	// ShutdownLights();


	Destroy_ParticleSet();
	
	Super_KillText();

	// Try to place code below --
	Super_KillBots();
	Super_KillFires();

	// make sure thispretty close to last
	Super_KillGlobals();
	DestroyGlobals();

#if ENABLE_CONSOLE
	KillConsole();	// kill launched console screen
#endif

#endif

} // end of the function
Пример #14
0
GLvoid KillGLWindow(GLvoid)								// Properly Kill The Window
{
    if (fullscreen)										// Are We In Fullscreen Mode?
    {
        ChangeDisplaySettings(NULL,0);					// If So Switch Back To The Desktop
        ShowCursor(TRUE);								// Show Mouse Pointer
    }

    if (hRC)											// Do We Have A Rendering Context?
    {
        if (!wglMakeCurrent(NULL,NULL))					// Are We Able To Release The DC And RC Contexts?
        {
            MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
        }

        if (!wglDeleteContext(hRC))						// Are We Able To Delete The RC?
        {
            MessageBox(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
        }
        hRC=NULL;										// Set RC To NULL
    }

    if (hDC && !ReleaseDC(hWnd,hDC))					// Are We Able To Release The DC
    {
        MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
        hDC=NULL;										// Set DC To NULL
    }

    if (hWnd && !DestroyWindow(hWnd))					// Are We Able To Destroy The Window?
    {
        MessageBox(NULL,"Could Not Release hWnd.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
        hWnd=NULL;										// Set hWnd To NULL
    }

    if (!UnregisterClass("OpenGL",hInstance))			// Are We Able To Unregister Class
    {
        MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
        hInstance=NULL;									// Set hInstance To NULL
    }

    KillFont();
}
void Deinitialize(void)												// 在此处做退出前扫尾工作
{
	KillFont();			//删除字体
	tower3DS.Release();
	gundam3DS.Release();
}
Пример #16
0
/***********************************************************
Destructor
***********************************************************/
TextWritter::~TextWritter()
{
	KillFont();
}
Пример #17
0
LRESULT CALLBACK WndProc (HWND hWnd, UINT message,
                          WPARAM wParam, LPARAM lParam)
{

    switch (message)
    {
    case WM_CREATE:
        return 0;
    case WM_CLOSE:
         KillFont();
        PostQuitMessage (0);
        return 0;

    case WM_DESTROY:
        return 0;
  case WM_LBUTTONDOWN:

    return 0;
   case WM_MOUSEMOVE:

         mousex=GET_X_LPARAM(lParam);
         mousey=GET_Y_LPARAM(lParam);
       
         return 0;
    case WM_KEYDOWN:
        switch (wParam)
        {
        case VK_F1:
             return 0;
        case VK_F2:
             return 0;
        case VK_UP:
        return 0;
        case VK_DOWN:
        return 0;
        case 0x51:
        return 0;
        case 0x4B:
        return 0;
        case 0x4C:
        return 0;
        case 0x41://A
        return 0;
        case 0x42://B
        return 0;
        case 0x43://c
        return 0;
        case 0x46://F
        return 0;
        case 0x52://T
        return 0;
        case 0x47:
        glRotatef(45,0,1,0);
        return 0;
        case 0x53:
        return 0;
        case VK_ESCAPE:

            PostQuitMessage(0);
            return 0;
        }
        return 0;

    default:
        return DefWindowProc (hWnd, message, wParam, lParam);
    }
}
Пример #18
0
PFonts::~PFonts()
{
	KillFont();
}
Пример #19
0
CGraphCanvas::~CGraphCanvas()
{
	KillFont();
}
Пример #20
0
LRESULT CALLBACK
ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    RECT Screen;                            // Used Later On To Get The Size Of The Window
    GLuint PixelFormat;                     // Pixel Format Storage
    static PIXELFORMATDESCRIPTOR pfd=       // Pixel Format Descriptor
    {
        sizeof(PIXELFORMATDESCRIPTOR),      // Size Of This Pixel Format Descriptor
        1,                                  // Version Number (?)
        PFD_DRAW_TO_WINDOW |                // Format Must Support Window
        PFD_SUPPORT_OPENGL |                // Format Must Support OpenGL
        PFD_DOUBLEBUFFER,                   // Must Support Double Buffering
        PFD_TYPE_RGBA,                      // Request An RGBA Format
        16,                                 // Select A 16Bit Color Depth
        0, 0, 0, 0, 0, 0,                   // Color Bits Ignored (?)
        0,                                  // No Alpha Buffer
        0,                                  // Shift Bit Ignored (?)
        0,                                  // No Accumulation Buffer
        0, 0, 0, 0,                         // Accumulation Bits Ignored (?)
        16,                                 // 16Bit Z-Buffer (Depth Buffer)
        0,                                  // No Stencil Buffer
        0,                                  // No Auxiliary Buffer (?)
        PFD_MAIN_PLANE,                     // Main Drawing Layer
        0,                                  // Reserved (?)
        0, 0, 0                             // Layer Masks Ignored (?)
    };

    switch (message)
    {
        case WM_CREATE:
            LoadSettings();

            // Gets A Device Context For The Window
            hDC = GetDC(hWnd);

            // Finds The Closest Match To The Pixel Format We Set Above
            PixelFormat = ChoosePixelFormat(hDC, &pfd);

            // No Matching Pixel Format?
            if (!PixelFormat)
            {
                MessageBox(0, _TEXT("Can't Find A Suitable PixelFormat."), _TEXT("Error"),MB_OK | MB_ICONERROR);

                // This Sends A 'Message' Telling The Program To Quit
                PostQuitMessage(0);
                break;
            }

            // Can We Set The Pixel Mode?
            if (!SetPixelFormat(hDC, PixelFormat, &pfd))
            {
                MessageBox(0, _TEXT("Can't Set The PixelFormat."), _TEXT("Error"), MB_OK | MB_ICONERROR);

                // This Sends A 'Message' Telling The Program To Quit
                PostQuitMessage(0);
                break;
            }

            // Grab A Rendering Context
            hRC = wglCreateContext(hDC);

            // Did We Get One?
            if (!hRC)
            {
                MessageBox(0, _TEXT("Can't Create A GL Rendering Context."), _TEXT("Error"), MB_OK | MB_ICONERROR);

                // This Sends A 'Message' Telling The Program To Quit
                PostQuitMessage(0);
                break;
            }

            // Can We Make The RC Active?
            if (!wglMakeCurrent(hDC, hRC))
            {
                MessageBox(0, _TEXT("Can't Activate GLRC."), _TEXT("Error"), MB_OK | MB_ICONERROR);

                // This Sends A 'Message' Telling The Program To Quit
                PostQuitMessage(0);
                break;
            }

            // Grab Screen Info For The Current Window
            GetClientRect(hWnd, &Screen);

            // Initialize The GL Screen Using Screen Info
            InitGL(Screen.right, Screen.bottom);
            break;

        case WM_DESTROY:
            // Disable Fullscreen Mode
            ChangeDisplaySettings(NULL, 0);

            // Deletes The Font Display List
            KillFont();

            // Make The DC Current
            wglMakeCurrent(hDC, NULL);

            // Kill The RC
            wglDeleteContext(hRC);

            // Free The DC
            ReleaseDC(hWnd, hDC);
            break;

        case WM_PAINT:
            DrawGLScene();
            SwapBuffers(hDC);
            break;

        case WM_SIZE: // Resizing The Screen
            // Resize To The New Window Size
            ReSizeGLScene(LOWORD(lParam), HIWORD(lParam));
            break;

        default:
            // Pass Windows Messages to the default screensaver window procedure
            return DefScreenSaverProc(hWnd, message, wParam, lParam);
    }

    return 0;
}
Пример #21
0
int grf_stop(void)
{
  KillFont();
  return (1);
}
Пример #22
0
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
	MSG		msg;
	BOOL	done = FALSE;

	::hInst = hInst;

	if (!CreateGLWindow())
		return 0;

	ShowWindow(hWnd, SW_SHOW);
	ReSizeGLScene(WIDTH, HEIGHT);

	glewInit();
	
	/************* GL things ***************/
	if (!InitGL()) {
		MessageBox(0, "Fail to init GL", "ERROR", MB_OK);
		return FALSE;
	}
	
	/************* Game things ***************/
	InitClasses();

	LARGE_INTEGER _FREQ;
	QueryPerformanceFrequency(&_FREQ);
	tickFreq = (double)_FREQ.QuadPart;
	
	MersenneRandomInit((int)ReadTSC());

	// load textures
	s_Texture->LoadAllTextures();

	//************* Game preinit ***************/

	s_World->LoadWorld();

	m_Player->eyepos = float3(20, 20, 80);
	m_Player->theta = PI/2;
	m_Player->phi = PI/4;
	
	//************* Event loop ***************/

	ShowCursor(false);

	while (!done) {
		if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
			if (msg.message == WM_QUIT)
				done = TRUE;
			else {
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
		else {
			if (active && !DrawGLScene()) {
				done = TRUE;
			}
			else {
				SwapBuffers(hDC);
			}
		}
	}
	
	ShowCursor(true);

	DeInitClasses();

	wglMakeCurrent(0, 0);
	wglDeleteContext(hRC);
	ReleaseDC(hWnd, hDC);
	DestroyWindow(hWnd);
	UnregisterClass("OpenGL", hInst);

	KillFont();

	return 0;
}