www.pudn.com > migongchengxu.rar > OpenGLCom.h


/******************************************************** 
模块名 OpenGLCom.h 
 
  方便OpenGL应用程序的编写: 
 
  作者: 
        潘李亮  XheartBlue@etang.com 
		        XheartBlue@chinaren.com 
				XheartBlue.home.chinaren.com 
                2002-4-1; 
                2002-5-1日重新整理 
********************************************************/ 
 
#include  
#include  
#include  
 
#include "stdio.h" 
#ifndef APPCOM_H 
#define APPCOM_H 
typedef int (*PUPDATEFRAME)(LONG); 
//============Golable Var================== 
extern GLuint g_font_list; 
extern HGLRC   g_hrc; 
typedef struct struct_AppData 
{ 
 int			xWindow;       //窗口的宽度 
 int			yWindow;       //窗口的高度 
 TCHAR*			szClassName;   //窗口的类名 
 TCHAR*			szAppTitle;    //窗口的标题 
 HWND			hWnd;          //窗口的句柄 
 HDC			hdc;           //窗口的DC 
 HINSTANCE		hApp;          //程序的实例句柄 
 HACCEL         hAccel;        //快捷键 
 BOOL           bIsActive;     //游戏是否激活 
 int			xLine;         //水平分辨率 
 int			yLine;         //垂直分辨率 
 int			colorBit;      //色深 
 BOOL           bIsExc;        //是否为独占模式 
 int            fps;		   // 
}APPDATA,*LPAPPDATA; 
extern APPDATA g_AppData; 
//============================================ 
extern TCHAR szClassName[]; 
extern TCHAR szAppTitle[]; 
//==========Golable Function================== 
extern RunApp(LPSTR ,int); 
extern LRESULT CALLBACK	WndProc(HWND, UINT, WPARAM, LPARAM); 
//============================================ 
//============================================ 
//Function Name :  CreateExcApp  
//Description:     创建一个独占模式的应用 
//============================================ 
BOOL CreateExcApp(int nCmdShow=SW_SHOW); 
//================================================================ 
//  Function Name:    CreateNormalApp   
//  Description:       创建一个普通模式的应用 
//================================================================ 
BOOL CreateNormalApp(int nCmdShow=SW_SHOW,int posx=0,int posy=0,int width=0,int height=0,ULONG  uStyle=WS_OVERLAPPEDWINDOW); 
//================================ 
//  Function Name:  SetFullScreen 
//  Description  :   
//================================ 
BOOL SetFullScreen(); 
//=================================================== 
//  Function Name : Del/SetWindowStyle 
//  Description   : Delete or Set A window Style 
//=================================================== 
LONG  DelWindowStyle(HWND hWnd,LONG newstyle); 
//-------------------------------------------------- 
LONG  SetWindowStyle(HWND hWnd,LONG newstyle); 
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
//=============================================================== 
// Function Name:  ExitFullScreen 
// Descrition:      
//================================================================ 
BOOL ExitFullScreen(); 
//===================================================== 
//Function Name: WinMain 
//Description 
int APIENTRY WinMain(HINSTANCE hInstance, 
                     HINSTANCE hPrevInstance, 
                     LPSTR     lpCmdLine, 
                     int       nCmdShow); 
//++++++++++++++++++++++++++++++++++++++++++++++++++++ 
 
//================================================================ 
// Function name: MainLoop 
// Description  : the Main message loop 
//=============================================================== 
int MainLoop( PUPDATEFRAME pfUpdateFrame=NULL ); 
//++++++++++++++++++++++++++++++++++++++++++++ 
 
//================================================================ 
//Function Name :   LoadBmpFromFile 
//Description   :   Load a Bitmap bits from a dot bmp file 
//filename:  the file contait the bitmap data 
//pData   :  the buffer for keep the datas 
//info    :  Infomation of the bitmap  
//================================================================= 
BOOL LoadBmpFromeFile(char* filename,GLubyte* &pData,BITMAPINFOHEADER& info); 
//======================================= 
//Init the OpenGL 
//======================================= 
BOOL InitOpenGL(); 
//======================================= 
//Release OpenGL 
//======================================= 
void ReleaseGL(); 
GLuint CreateFont(); 
void RenderFont(char*,int,int); 
void SetForceFps(int fps); 
#endif