Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

globals.h

00001 // $Id: globals.h,v 1.2 2003/07/11 21:36:59 sjcomp Exp $
00002 // Copyright (c) 2003, Alexander Shyrokov aka SJ
00003 // E-mail: sjcomp[@]users.sourceforge.com
00004 // Web:    http://sjgui.sourceforge.net
00005 //
00006 // This code is under BSD license agreement.
00007 //
00008 // Alexander Shyrokov makes no representations about the suitability of this software 
00009 // for any purpose. It is provided "AS IS" without express or implied warranty.
00010 
00011 #if !defined(SJGLUTWINDOW_H_INCLUDED)
00012 #define SJGLUTWINDOW_H_INCLUDED
00013 
00014 // String support
00015 #pragma warning(disable:4786)
00016 #include <string>
00017 // Base class
00018 #include "wnd.h"
00019 
00020 // glut is default, if one wants not to use it,
00021 // then something else must be used
00022 #ifdef SJGUI_USE_WIN32_API
00023     #include <windows.h>
00024     #include <GL\gl.h>
00025     #include <GL\glu.h>
00026     // no need in their macroses
00027     #undef min
00028     #undef max
00029 // so they still could be used
00030 using sjgui::min;
00031 using sjgui::max;
00032 
00033 #else // SJGUI_USE_WIN32_API
00034     #include <GL/glut.h>
00035     
00036     #ifndef SJGUI_USE_GLUT
00037         #define SJGUI_USE_GLUT
00038     #endif
00039 #endif // SJGUI_USE_WIN32_API
00040 
00046 #define SET_GL_FOR_GUI_DRAW_WITH_SIZE(x,y,width,height) \
00047     glMatrixMode(GL_PROJECTION); \
00048     glLoadIdentity(); \
00049     glViewport(x,y,width,height); \
00050     gluOrtho2D(x,width, height,y); \
00051     glMatrixMode(GL_MODELVIEW); \
00052     glLoadIdentity(); \
00053     glDisable(GL_DEPTH_TEST); \
00054     glDisable(GL_TEXTURE_2D); \
00055     glDisable(GL_BLEND);
00056 
00061 #define SET_GL_FOR_GUI_DRAW  \
00062     SET_GL_FOR_GUI_DRAW_WITH_SIZE(0,0,CWnd::GetScreenWidth(),CWnd::GetScreenHeight())
00063     
00068 #define SET_GL_FOR_PROSPECTIVE(angle,near_cut_off,far_cut_off) \
00069     glEnable(GL_DEPTH_TEST); \
00070     glDepthFunc(GL_LEQUAL); \
00071     glMatrixMode(GL_PROJECTION); \
00072     glLoadIdentity(); \
00073     glViewport(GetAbsPos().GetX(),GetAbsPos().GetY(),GetAbsPos().GetWidth(),GetAbsPos().GetHeight()); \
00074     gluPerspective(angle,(GLfloat)GetWidth()/(GLfloat)GetHeight(),near_cut_off,far_cut_off); \
00075     glMatrixMode(GL_MODELVIEW); \
00076     glLoadIdentity(); 
00077 
00078 
00079 // glViewport(0,0,CWnd::GetScreenWidth(),CWnd::GetScreenHeight());
00084 #define SET_GL_SIMPLE_PROSPECTIVE SET_GL_FOR_PROSPECTIVE(45.0f,1.0f,1000.0f);
00085 
00086 namespace sjgui{
00087 
00097 int Create(const char* pcCaption,CWnd* pWnd,int iBits=16,bool yFullScreen=false);
00103 void SetMode(unsigned int uiMode);
00107 void SetPos(int iX,int iY);
00112 void SetScreenSize(int iW,int iH);
00113 
00118 void GlobalMainLoop();
00124 void IgnoreRepeates(bool b=true);
00125 
00130 void SwitchFullScreen(int iW,int iH,int iBits);
00132 bool IsFullScreen();
00134 void SetClearColor(GLfloat* fC);
00135 
00143 
00144 
00157 void OnResizeEvent(CWnd* pWnd, int iWidth, int iHeight);
00162 int OnInitEvent(CWnd* pWnd);
00166 void OnKeyDownEvent(CWnd* pWnd,int iKey);
00170 void OnKeyUpEvent(CWnd* pWnd,int iKey);
00174 void OnMouseMoveEvent(CWnd* pWnd,int iX, int iY);
00176 } // namespace sjgui
00177 
00178 #endif // !defined(SJGLUTWINDOW_H_INCLUDED)
sjgui logo
Quick Links:

 News
 Description
 Screen Shots
 Projects
 Downloads
 Source Code
 Help/FAQ
 Want to help?
 Credits
 Disclaimer


Documentation:

 Documentation
 Reference
 Lessons


Useful links:

sjcomp logo
sjcomp

opengl logo

nehe logo

SourceForge.net Logo

Last modified:


Started by Alexander Shyrokov. Generated at Wed Apr 28 12:31:04 2004 for the sjgui by doxygen 1.3.1. SourceForge.net Logo