0.7.5
This commit is contained in:
parent
05297addba
commit
8da954fd7d
@ -1,11 +1,12 @@
|
|||||||
ZEngine Version Log for Version 0.7.4
|
ZEngine Version Log for Version 0.7.5
|
||||||
$Id: changelog.txt,v 1.1 2002/11/21 05:40:49 cozman Exp $
|
$Id: changelog.txt,v 1.2 2002/11/28 23:15:52 cozman Exp $
|
||||||
|
|
||||||
0.7.5
|
0.7.5
|
||||||
-Converted all tabs to spaces.
|
-Converted all tabs to spaces.
|
||||||
-Added CVS lines to files for date tracking.
|
-Added CVS lines to files for date tracking.
|
||||||
-Fixed file layout for CVS and reuploaded files to CVS.
|
-Fixed file layout for CVS and reuploaded files to CVS.
|
||||||
|
-Major API changes (removed "Get" before accessors and changed some functions in ZEngine)
|
||||||
|
-Added Beginnings of OpenGL Render targets
|
||||||
|
|
||||||
0.7.4
|
0.7.4
|
||||||
-Modified behavior of ZImage::Attach and changed ZImageTest to use it.
|
-Modified behavior of ZImage::Attach and changed ZImageTest to use it.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# General configuration options
|
# General configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
PROJECT_NAME = ZEngine
|
PROJECT_NAME = ZEngine
|
||||||
PROJECT_NUMBER = 0.7.0
|
PROJECT_NUMBER = 0.7.5
|
||||||
OUTPUT_DIRECTORY = /home/James/ZEngine-dev/doc
|
OUTPUT_DIRECTORY = /home/James/ZEngine-dev/doc
|
||||||
OUTPUT_LANGUAGE = English
|
OUTPUT_LANGUAGE = English
|
||||||
EXTRACT_ALL = NO
|
EXTRACT_ALL = NO
|
||||||
@ -19,6 +19,7 @@ REPEAT_BRIEF = NO
|
|||||||
ALWAYS_DETAILED_SEC = NO
|
ALWAYS_DETAILED_SEC = NO
|
||||||
INLINE_INHERITED_MEMB = NO
|
INLINE_INHERITED_MEMB = NO
|
||||||
FULL_PATH_NAMES = YES
|
FULL_PATH_NAMES = YES
|
||||||
|
STRIP_FROM_PATH =
|
||||||
INTERNAL_DOCS = NO
|
INTERNAL_DOCS = NO
|
||||||
STRIP_CODE_COMMENTS = YES
|
STRIP_CODE_COMMENTS = YES
|
||||||
CASE_SENSE_NAMES = YES
|
CASE_SENSE_NAMES = YES
|
||||||
@ -174,6 +175,7 @@ INCLUDE_GRAPH = NO
|
|||||||
INCLUDED_BY_GRAPH = NO
|
INCLUDED_BY_GRAPH = NO
|
||||||
GRAPHICAL_HIERARCHY = NO
|
GRAPHICAL_HIERARCHY = NO
|
||||||
DOT_IMAGE_FORMAT = png
|
DOT_IMAGE_FORMAT = png
|
||||||
|
DOT_PATH =
|
||||||
DOTFILE_DIRS =
|
DOTFILE_DIRS =
|
||||||
MAX_DOT_GRAPH_WIDTH = 1024
|
MAX_DOT_GRAPH_WIDTH = 1024
|
||||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# General configuration options
|
# General configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
PROJECT_NAME = ZEngine
|
PROJECT_NAME = ZEngine
|
||||||
PROJECT_NUMBER = 0.7.0
|
PROJECT_NUMBER = 0.7.5
|
||||||
OUTPUT_DIRECTORY = F:\libs\ZEngine-dev\doc\
|
OUTPUT_DIRECTORY = F:\libs\ZEngine-dev\doc\
|
||||||
OUTPUT_LANGUAGE = English
|
OUTPUT_LANGUAGE = English
|
||||||
EXTRACT_ALL = NO
|
EXTRACT_ALL = NO
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
File: ZE_Defines.h <br>
|
File: ZE_Defines.h <br>
|
||||||
Description: Defines header file for ZEngine class, where all #define statements to control compilation options are placed. <br>
|
Description: Defines header file for ZEngine class, where all #define statements to control compilation options are placed. <br>
|
||||||
Author(s): James Turk <br>
|
Author(s): James Turk <br>
|
||||||
$Id: ZE_Defines.h,v 1.1 2002/11/21 05:41:10 cozman Exp $<br>
|
$Id: ZE_Defines.h,v 1.2 2002/11/28 23:18:54 cozman Exp $<br>
|
||||||
|
|
||||||
\file ZE_Defines.h
|
\file ZE_Defines.h
|
||||||
\brief Define file for ZEngine.
|
\brief Define file for ZEngine.
|
||||||
@ -33,6 +33,8 @@ $Id: ZE_Defines.h,v 1.1 2002/11/21 05:41:10 cozman Exp $<br>
|
|||||||
#define USE_SDL_MIXER
|
#define USE_SDL_MIXER
|
||||||
//! Define to use the Physfs file system.
|
//! Define to use the Physfs file system.
|
||||||
//#define USE_PHYSFS
|
//#define USE_PHYSFS
|
||||||
|
//! Define to use OpenGL for 2D blits.
|
||||||
|
#define USE_OPENGL_2D
|
||||||
//! Undefine to disable debug streams for Error Handler.
|
//! Undefine to disable debug streams for Error Handler.
|
||||||
#define DEBUG_STREAM
|
#define DEBUG_STREAM
|
||||||
//! Version number.
|
//! Version number.
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
File: ZE_Includes.h <br>
|
File: ZE_Includes.h <br>
|
||||||
Description: Header file for ZEngine universal includes. <br>
|
Description: Header file for ZEngine universal includes. <br>
|
||||||
Author(s): James Turk <br>
|
Author(s): James Turk <br>
|
||||||
$Id: ZE_Includes.h,v 1.1 2002/11/21 05:41:10 cozman Exp $<br>
|
$Id: ZE_Includes.h,v 1.2 2002/11/28 23:18:54 cozman Exp $<br>
|
||||||
|
|
||||||
\file ZE_Includes.h
|
\file ZE_Includes.h
|
||||||
\brief Include file for SDL and C++ Includes that many ZEngine files need.
|
\brief Include file for SDL and C++ Includes that many ZEngine files need.
|
||||||
@ -28,6 +28,9 @@ $Id: ZE_Includes.h,v 1.1 2002/11/21 05:41:10 cozman Exp $<br>
|
|||||||
#include "ZE_Defines.h"
|
#include "ZE_Defines.h"
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
#ifdef USE_OPENGL_2D
|
||||||
|
#include "SDL_opengl.h"
|
||||||
|
#endif
|
||||||
#ifdef USE_SDL_IMAGE
|
#ifdef USE_SDL_IMAGE
|
||||||
#include "SDL_image.h"
|
#include "SDL_image.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
File: ZE_ZEngine.h <br>
|
File: ZE_ZEngine.h <br>
|
||||||
Description: Header file for ZEngine class, the core of the ZEngine. <br>
|
Description: Header file for ZEngine class, the core of the ZEngine. <br>
|
||||||
Author(s): James Turk <br>
|
Author(s): James Turk <br>
|
||||||
$Id: ZE_ZEngine.h,v 1.1 2002/11/21 05:41:10 cozman Exp $<br>
|
$Id: ZE_ZEngine.h,v 1.2 2002/11/28 23:18:54 cozman Exp $<br>
|
||||||
|
|
||||||
\file ZE_ZEngine.h
|
\file ZE_ZEngine.h
|
||||||
\brief Definition file for core ZEngine class.
|
\brief Definition file for core ZEngine class.
|
||||||
@ -135,7 +135,7 @@ class ZEngine
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Create Window with predefined settings.
|
\brief Create Display with predefined settings.
|
||||||
|
|
||||||
SetupDisplay and SetupSound should be called prior to this to change settings, settings from those do not go into effect
|
SetupDisplay and SetupSound should be called prior to this to change settings, settings from those do not go into effect
|
||||||
until this function is called. Specify no icon file to use default OS icon.
|
until this function is called. Specify no icon file to use default OS icon.
|
||||||
@ -143,14 +143,14 @@ class ZEngine
|
|||||||
\param title Window Title.
|
\param title Window Title.
|
||||||
\param icon Path to Icon File.
|
\param icon Path to Icon File.
|
||||||
**/
|
**/
|
||||||
void CreateWindow(string title, string icon="");
|
void CreateDisplay(string title, string icon="");
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Quit SDL and any Subsystems.
|
\brief Quit SDL and any Subsystems.
|
||||||
|
|
||||||
Shut down SDL (and SDL_ttf,SDL_mixer if necessary).
|
Shut down SDL (and SDL_ttf,SDL_mixer if necessary).
|
||||||
**/
|
**/
|
||||||
void CloseWindow();
|
void CloseDisplay();
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
//Screen Access//
|
//Screen Access//
|
||||||
@ -167,7 +167,7 @@ class ZEngine
|
|||||||
Get pointer to screen SDL_Surface, allowing direct screen manipulation using SDL.
|
Get pointer to screen SDL_Surface, allowing direct screen manipulation using SDL.
|
||||||
\return Pointer to Display Surface.
|
\return Pointer to Display Surface.
|
||||||
**/
|
**/
|
||||||
SDL_Surface *GetDisplay();
|
SDL_Surface *Display();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Update screen contents.
|
\brief Update screen contents.
|
||||||
@ -223,7 +223,7 @@ class ZEngine
|
|||||||
Freeze everything for given number of milliseconds.
|
Freeze everything for given number of milliseconds.
|
||||||
\param milliseconds Number of milliseconds to freeze.
|
\param milliseconds Number of milliseconds to freeze.
|
||||||
**/
|
**/
|
||||||
void Sleep(Uint32 milliseconds);
|
void Delay(Uint32 milliseconds);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Get Global ZEngine time.
|
\brief Get Global ZEngine time.
|
||||||
@ -310,7 +310,7 @@ class ZEngine
|
|||||||
/*!
|
/*!
|
||||||
\brief Find the state of a key.
|
\brief Find the state of a key.
|
||||||
|
|
||||||
Function returns true/false based on if key is pressed or not.
|
Function returns true/false based on if key is <u>currently</u> pressed or not.
|
||||||
\param key code of key to find status of.
|
\param key code of key to find status of.
|
||||||
\return bool state of requested key.
|
\return bool state of requested key.
|
||||||
**/
|
**/
|
||||||
@ -336,7 +336,7 @@ class ZEngine
|
|||||||
Find X Position of Mouse on screen.
|
Find X Position of Mouse on screen.
|
||||||
\return X Position of Mouse.
|
\return X Position of Mouse.
|
||||||
**/
|
**/
|
||||||
int GetMouseX();
|
int MouseX();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Get Y Position of Mouse.
|
\brief Get Y Position of Mouse.
|
||||||
@ -344,7 +344,7 @@ class ZEngine
|
|||||||
Find Y Position of Mouse on screen.
|
Find Y Position of Mouse on screen.
|
||||||
\return Y Position of Mouse.
|
\return Y Position of Mouse.
|
||||||
**/
|
**/
|
||||||
int GetMouseY();
|
int MouseY();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Get Status of Left Button.
|
\brief Get Status of Left Button.
|
||||||
@ -490,7 +490,7 @@ class ZEngine
|
|||||||
Get Width of Window or Fullscreen mode.
|
Get Width of Window or Fullscreen mode.
|
||||||
\return Width of Display.
|
\return Width of Display.
|
||||||
**/
|
**/
|
||||||
int GetWidth();
|
int Width();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Get Current Display Height.
|
\brief Get Current Display Height.
|
||||||
@ -498,7 +498,7 @@ class ZEngine
|
|||||||
Get Height of Window or Fullscreen mode.
|
Get Height of Window or Fullscreen mode.
|
||||||
\return Height of Display.
|
\return Height of Display.
|
||||||
**/
|
**/
|
||||||
int GetHeight();
|
int Height();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Get Current Display BPP.
|
\brief Get Current Display BPP.
|
||||||
@ -506,7 +506,7 @@ class ZEngine
|
|||||||
Get BPP of Window or Fullscreen mode.
|
Get BPP of Window or Fullscreen mode.
|
||||||
\return BPP of Display.
|
\return BPP of Display.
|
||||||
**/
|
**/
|
||||||
int GetBPP();
|
int BPP();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Get Fullscreen setting.
|
\brief Get Fullscreen setting.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
File: ZEngine.h <br>
|
File: ZEngine.h <br>
|
||||||
Description: Public Header File for ZEngine. <br>
|
Description: Public Header File for ZEngine. <br>
|
||||||
Author(s): James Turk <br>
|
Author(s): James Turk <br>
|
||||||
$Id: ZEngine.h,v 1.1 2002/11/21 05:41:10 cozman Exp $<br>
|
$Id: ZEngine.h,v 1.2 2002/11/28 23:18:54 cozman Exp $<br>
|
||||||
|
|
||||||
\file ZEngine.h
|
\file ZEngine.h
|
||||||
\brief Header file for ZEngine.
|
\brief Header file for ZEngine.
|
||||||
@ -17,7 +17,7 @@ $Id: ZEngine.h,v 1.1 2002/11/21 05:41:10 cozman Exp $<br>
|
|||||||
|
|
||||||
\author James Turk
|
\author James Turk
|
||||||
\version 0.7.5
|
\version 0.7.5
|
||||||
\date 21 November, 2002
|
\date 28 November, 2002
|
||||||
|
|
||||||
\section ZEngine About ZEngine
|
\section ZEngine About ZEngine
|
||||||
<br>
|
<br>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
File: ZE_ZEngine.cpp <br>
|
File: ZE_ZEngine.cpp <br>
|
||||||
Description: Implementation source file for ZEngine library main singleton class. <br>
|
Description: Implementation source file for ZEngine library main singleton class. <br>
|
||||||
Author(s): James Turk <br>
|
Author(s): James Turk <br>
|
||||||
$Id: ZE_ZEngine.cpp,v 1.1 2002/11/21 05:41:12 cozman Exp $<br>
|
$Id: ZE_ZEngine.cpp,v 1.2 2002/11/28 23:19:55 cozman Exp $<br>
|
||||||
|
|
||||||
\file ZE_ZEngine.cpp
|
\file ZE_ZEngine.cpp
|
||||||
\brief Central source file for ZEngine.
|
\brief Central source file for ZEngine.
|
||||||
@ -64,7 +64,7 @@ void ZEngine::ReleaseInstance()
|
|||||||
{
|
{
|
||||||
if(sInstance)
|
if(sInstance)
|
||||||
{
|
{
|
||||||
sInstance->CloseWindow();
|
sInstance->CloseDisplay();
|
||||||
delete sInstance;
|
delete sInstance;
|
||||||
}
|
}
|
||||||
sInstance = NULL;
|
sInstance = NULL;
|
||||||
@ -91,11 +91,10 @@ void ZEngine::SetupSound(int rate, bool stereo)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ZEngine::CreateWindow(string title, string icon)
|
void ZEngine::CreateDisplay(string title, string icon)
|
||||||
{
|
{
|
||||||
Uint32 flags = SDL_DOUBLEBUF|SDL_HWPALETTE;
|
Uint32 flags;
|
||||||
ImageData iconImg;
|
ImageData iconImg;
|
||||||
SDL_VideoInfo *videoInfo;
|
|
||||||
|
|
||||||
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_AUDIO) < 0)
|
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_AUDIO) < 0)
|
||||||
{
|
{
|
||||||
@ -107,8 +106,39 @@ void ZEngine::CreateWindow(string title, string icon)
|
|||||||
Mix_OpenAudio(mRate, AUDIO_S16SYS, mStereo?2:1, 4096); //Open Audio Stream (Stereo?2:1 is conditional for number of channels)
|
Mix_OpenAudio(mRate, AUDIO_S16SYS, mStereo?2:1, 4096); //Open Audio Stream (Stereo?2:1 is conditional for number of channels)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
videoInfo = const_cast<SDL_VideoInfo*>(SDL_GetVideoInfo());
|
#ifdef USE_OPENGL_2D
|
||||||
|
int rgb_size[3];
|
||||||
|
|
||||||
|
switch (mBPP)
|
||||||
|
{
|
||||||
|
case 8:
|
||||||
|
rgb_size[0] = 3;
|
||||||
|
rgb_size[1] = 3;
|
||||||
|
rgb_size[2] = 2;
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
case 16:
|
||||||
|
rgb_size[0] = 5;
|
||||||
|
rgb_size[1] = 5;
|
||||||
|
rgb_size[2] = 5;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rgb_size[0] = 8;
|
||||||
|
rgb_size[1] = 8;
|
||||||
|
rgb_size[2] = 8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, rgb_size[0] );
|
||||||
|
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, rgb_size[1] );
|
||||||
|
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, rgb_size[2] );
|
||||||
|
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
|
||||||
|
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
|
||||||
|
|
||||||
|
flags = SDL_OPENGL;
|
||||||
|
#else //!USE_OPENGL_2D
|
||||||
|
SDL_VideoInfo *videoInfo = const_cast<SDL_VideoInfo*>(SDL_GetVideoInfo());
|
||||||
|
|
||||||
|
flags = SDL_DOUBLEBUF|SDL_HWPALETTE;
|
||||||
//check capabilities and use what we can//
|
//check capabilities and use what we can//
|
||||||
if(videoInfo->hw_available)
|
if(videoInfo->hw_available)
|
||||||
flags |= SDL_HWSURFACE;
|
flags |= SDL_HWSURFACE;
|
||||||
@ -116,6 +146,7 @@ void ZEngine::CreateWindow(string title, string icon)
|
|||||||
flags |= SDL_SWSURFACE;
|
flags |= SDL_SWSURFACE;
|
||||||
if(videoInfo->blit_hw)
|
if(videoInfo->blit_hw)
|
||||||
flags |= SDL_HWACCEL;
|
flags |= SDL_HWACCEL;
|
||||||
|
#endif //USE_OPENGL_2D
|
||||||
|
|
||||||
//Window Manager settings//
|
//Window Manager settings//
|
||||||
if(!icon.length())
|
if(!icon.length())
|
||||||
@ -128,15 +159,49 @@ void ZEngine::CreateWindow(string title, string icon)
|
|||||||
FreeImage(iconImg);
|
FreeImage(iconImg);
|
||||||
}
|
}
|
||||||
|
|
||||||
//create SDL screen//
|
//create SDL screen and update settings based on returned screen//
|
||||||
if(mFullscreen)
|
if(mFullscreen)
|
||||||
flags |= SDL_FULLSCREEN;
|
flags |= SDL_FULLSCREEN;
|
||||||
mScreen = SDL_SetVideoMode(mWidth, mHeight, mBPP, flags);
|
mScreen = SDL_SetVideoMode(mWidth, mHeight, mBPP, flags);
|
||||||
|
|
||||||
|
mWidth = mScreen->w;
|
||||||
|
mHeight = mScreen->h;
|
||||||
|
mBPP = mScreen->format->BitsPerPixel;
|
||||||
|
|
||||||
|
#ifdef USE_OPENGL_2D
|
||||||
|
//OpenGL code from SDL project testgl.c//
|
||||||
|
glViewport(0,0,mWidth,mHeight);
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
glPushAttrib(GL_ENABLE_BIT);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
/* This allows alpha blending of 2D textures with the scene*/
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
glViewport(0, 0, mWidth, mHeight);
|
||||||
|
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
glOrtho(0.0, (GLdouble)mWidth, (GLdouble)mHeight, 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
||||||
|
#endif //USE_OPENGL_2D
|
||||||
|
|
||||||
if(!mScreen)
|
if(!mScreen)
|
||||||
{
|
{
|
||||||
LogError(FormatStr("Unable to set video mode %dx%d (%dBpp): %s",mWidth,mHeight,mBPP,SDL_GetError()));
|
LogError(FormatStr("Unable to set video mode %dx%d (%dBpp): %s",mWidth,mHeight,mBPP,SDL_GetError()));
|
||||||
CloseWindow();
|
CloseDisplay();
|
||||||
}
|
}
|
||||||
mKeyPressed = SDL_GetKeyState(NULL);
|
mKeyPressed = SDL_GetKeyState(NULL);
|
||||||
|
|
||||||
@ -148,7 +213,7 @@ void ZEngine::CreateWindow(string title, string icon)
|
|||||||
mActive = true;
|
mActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZEngine::CloseWindow()
|
void ZEngine::CloseDisplay()
|
||||||
{
|
{
|
||||||
#ifdef USE_SDL_TTF
|
#ifdef USE_SDL_TTF
|
||||||
TTF_Quit();
|
TTF_Quit();
|
||||||
@ -165,14 +230,18 @@ void ZEngine::CloseWindow()
|
|||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface *ZEngine::GetDisplay()
|
SDL_Surface *ZEngine::Display()
|
||||||
{
|
{
|
||||||
return mScreen;
|
return mScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZEngine::UpdateScreen()
|
void ZEngine::UpdateScreen()
|
||||||
{
|
{
|
||||||
|
#ifdef USE_OPENGL_2D
|
||||||
|
SDL_GL_SwapBuffers();
|
||||||
|
#else //!USE_OPENGL_2D
|
||||||
SDL_Flip(mScreen);
|
SDL_Flip(mScreen);
|
||||||
|
#endif //USE_OPENGL_2D
|
||||||
|
|
||||||
mSecPerFrame = (GetTime()-mLastTime)/1000.0;
|
mSecPerFrame = (GetTime()-mLastTime)/1000.0;
|
||||||
mLastTime = GetTime();
|
mLastTime = GetTime();
|
||||||
@ -188,7 +257,7 @@ void ZEngine::Clear(Uint32 color, SDL_Rect *rect)
|
|||||||
SDL_FillRect(mScreen,rect,color);
|
SDL_FillRect(mScreen,rect,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZEngine::Sleep(Uint32 milliseconds)
|
void ZEngine::Delay(Uint32 milliseconds)
|
||||||
{
|
{
|
||||||
SDL_Delay(milliseconds);
|
SDL_Delay(milliseconds);
|
||||||
}
|
}
|
||||||
@ -259,12 +328,12 @@ void ZEngine::ShowCursor()
|
|||||||
SDL_ShowCursor(SDL_ENABLE);
|
SDL_ShowCursor(SDL_ENABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEngine::GetMouseX()
|
int ZEngine::MouseX()
|
||||||
{
|
{
|
||||||
return mMouseX;
|
return mMouseX;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEngine::GetMouseY()
|
int ZEngine::MouseY()
|
||||||
{
|
{
|
||||||
return mMouseY;
|
return mMouseY;
|
||||||
}
|
}
|
||||||
@ -512,17 +581,17 @@ void ZEngine::FreeFont(FontData &font)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ZEngine::GetWidth()
|
int ZEngine::Width()
|
||||||
{
|
{
|
||||||
return mWidth;
|
return mWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEngine::GetHeight()
|
int ZEngine::Height()
|
||||||
{
|
{
|
||||||
return mHeight;
|
return mHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEngine::GetBPP()
|
int ZEngine::BPP()
|
||||||
{
|
{
|
||||||
return mBPP;
|
return mBPP;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
File: ZE_ZImage.cpp <br>
|
File: ZE_ZImage.cpp <br>
|
||||||
Description: Implementation source file for core ZEngine Image Object. <br>
|
Description: Implementation source file for core ZEngine Image Object. <br>
|
||||||
Author(s): James Turk <br>
|
Author(s): James Turk <br>
|
||||||
$Id: ZE_ZImage.cpp,v 1.1 2002/11/21 05:41:13 cozman Exp $<br>
|
$Id: ZE_ZImage.cpp,v 1.2 2002/11/28 23:19:55 cozman Exp $<br>
|
||||||
|
|
||||||
\file ZE_ZImage.cpp
|
\file ZE_ZImage.cpp
|
||||||
\brief Source file for ZImage.
|
\brief Source file for ZImage.
|
||||||
@ -59,7 +59,7 @@ void ZImage::Open(string filename)
|
|||||||
void ZImage::OpenFromImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h)
|
void ZImage::OpenFromImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h)
|
||||||
{
|
{
|
||||||
Uint32 flags;
|
Uint32 flags;
|
||||||
SDL_Surface *screen = rEngine->GetDisplay();
|
SDL_Surface *screen = rEngine->Display();
|
||||||
SDL_Rect rect;
|
SDL_Rect rect;
|
||||||
SDL_VideoInfo *videoInfo;
|
SDL_VideoInfo *videoInfo;
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ void ZImage::OpenFromImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint1
|
|||||||
if(!img)
|
if(!img)
|
||||||
LogError("Invalid Parameter to ZImage::OpenFromImage: img==NULL");
|
LogError("Invalid Parameter to ZImage::OpenFromImage: img==NULL");
|
||||||
|
|
||||||
rImage.image = SDL_CreateRGBSurface(flags, rect.w, rect.h, rEngine->GetBPP(),
|
rImage.image = SDL_CreateRGBSurface(flags, rect.w, rect.h, rEngine->BPP(),
|
||||||
screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
|
screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
|
||||||
|
|
||||||
if(!rImage.image)
|
if(!rImage.image)
|
||||||
@ -169,7 +169,7 @@ void ZImage::Draw(Sint16 x, Sint16 y)
|
|||||||
rect.y = y;
|
rect.y = y;
|
||||||
|
|
||||||
if(rImage.image)
|
if(rImage.image)
|
||||||
SDL_BlitSurface(rImage.image,NULL,rEngine->GetDisplay(),&rect);
|
SDL_BlitSurface(rImage.image,NULL,rEngine->Display(),&rect);
|
||||||
else
|
else
|
||||||
LogError("ZImage not initialized in ZImage::Draw.");
|
LogError("ZImage not initialized in ZImage::Draw.");
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ void Initialize()
|
|||||||
title = cfg.GetString("ZFontTest","title","ZFont Test");
|
title = cfg.GetString("ZFontTest","title","ZFont Test");
|
||||||
|
|
||||||
engine->SetupDisplay(w,h,bpp,fs);
|
engine->SetupDisplay(w,h,bpp,fs);
|
||||||
engine->CreateWindow(title);
|
engine->CreateDisplay(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test()
|
void Test()
|
||||||
@ -59,8 +59,8 @@ void Test()
|
|||||||
if(engine->KeyIsPressed(SDLK_s))
|
if(engine->KeyIsPressed(SDLK_s))
|
||||||
{
|
{
|
||||||
//code to toggle screen//
|
//code to toggle screen//
|
||||||
engine->SetupDisplay(engine->GetWidth(),engine->GetHeight(),engine->GetBPP(),!engine->IsFullscreen());
|
engine->SetupDisplay(engine->Width(),engine->Height(),engine->BPP(),!engine->IsFullscreen());
|
||||||
engine->CreateWindow("ZImage Test");
|
engine->CreateDisplay("ZImage Test");
|
||||||
}
|
}
|
||||||
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
||||||
engine->RequestQuit();
|
engine->RequestQuit();
|
||||||
|
@ -28,7 +28,7 @@ void Initialize()
|
|||||||
title = cfg.GetString("ZImageTest","title","ZImage Test");
|
title = cfg.GetString("ZImageTest","title","ZImage Test");
|
||||||
|
|
||||||
engine->SetupDisplay(w,h,bpp,fs);
|
engine->SetupDisplay(w,h,bpp,fs);
|
||||||
engine->CreateWindow(title);
|
engine->CreateDisplay(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test()
|
void Test()
|
||||||
@ -57,8 +57,8 @@ void Test()
|
|||||||
if(engine->KeyIsPressed(SDLK_s))
|
if(engine->KeyIsPressed(SDLK_s))
|
||||||
{
|
{
|
||||||
//code to toggle screen//
|
//code to toggle screen//
|
||||||
engine->SetupDisplay(engine->GetWidth(),engine->GetHeight(),engine->GetBPP(),!engine->IsFullscreen());
|
engine->SetupDisplay(engine->Width(),engine->Height(),engine->BPP(),!engine->IsFullscreen());
|
||||||
engine->CreateWindow("ZImage Test");
|
engine->CreateDisplay("ZImage Test");
|
||||||
}
|
}
|
||||||
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
||||||
engine->RequestQuit();
|
engine->RequestQuit();
|
||||||
|
@ -28,7 +28,7 @@ void Initialize()
|
|||||||
title = cfg.GetString("ZMouseTest","title","ZMouse Test");
|
title = cfg.GetString("ZMouseTest","title","ZMouse Test");
|
||||||
|
|
||||||
engine->SetupDisplay(w,h,bpp,fs);
|
engine->SetupDisplay(w,h,bpp,fs);
|
||||||
engine->CreateWindow(title);
|
engine->CreateDisplay(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test()
|
void Test()
|
||||||
@ -58,26 +58,26 @@ void Test()
|
|||||||
if(engine->KeyIsPressed(SDLK_s))
|
if(engine->KeyIsPressed(SDLK_s))
|
||||||
{
|
{
|
||||||
//code to toggle screen//
|
//code to toggle screen//
|
||||||
engine->SetupDisplay(engine->GetWidth(),engine->GetHeight(),engine->GetBPP(),!engine->IsFullscreen());
|
engine->SetupDisplay(engine->Width(),engine->Height(),engine->BPP(),!engine->IsFullscreen());
|
||||||
engine->CreateWindow("ZEngine Mouse Test");
|
engine->CreateDisplay("ZEngine Mouse Test");
|
||||||
}
|
}
|
||||||
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
||||||
engine->RequestQuit();
|
engine->RequestQuit();
|
||||||
|
|
||||||
//show where mouse is (clicked or not)//
|
//show where mouse is (clicked or not)//
|
||||||
if(engine->RButtonPressed())
|
if(engine->RButtonPressed())
|
||||||
font.DrawText(FormatStr("Right button clicked at %d,%d",engine->GetMouseX(),engine->GetMouseY()),text[2]);
|
font.DrawText(FormatStr("Right button clicked at %d,%d",engine->MouseX(),engine->MouseY()),text[2]);
|
||||||
else if(engine->LButtonPressed())
|
else if(engine->LButtonPressed())
|
||||||
font.DrawText(FormatStr("Left button clicked at %d,%d",engine->GetMouseX(),engine->GetMouseY()),text[2]);
|
font.DrawText(FormatStr("Left button clicked at %d,%d",engine->MouseX(),engine->MouseY()),text[2]);
|
||||||
else
|
else
|
||||||
font.DrawText(FormatStr("Mouse at %d,%d",engine->GetMouseX(),engine->GetMouseY()),text[2]);
|
font.DrawText(FormatStr("Mouse at %d,%d",engine->MouseX(),engine->MouseY()),text[2]);
|
||||||
|
|
||||||
|
|
||||||
engine->Clear(); //clear screen
|
engine->Clear(); //clear screen
|
||||||
//draw the images//
|
//draw the images//
|
||||||
text[engine->MouseInRect(&textRect)].Draw(100,100);
|
text[engine->MouseInRect(&textRect)].Draw(100,100);
|
||||||
text[2].Draw(0,0);
|
text[2].Draw(0,0);
|
||||||
cursor.Draw(engine->GetMouseX()-8,engine->GetMouseY()-8);
|
cursor.Draw(engine->MouseX()-8,engine->MouseY()-8);
|
||||||
|
|
||||||
engine->UpdateScreen(); //update the screen
|
engine->UpdateScreen(); //update the screen
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ void Initialize()
|
|||||||
title = cfg.GetString("ZMusicTest","title","ZMusic Test");
|
title = cfg.GetString("ZMusicTest","title","ZMusic Test");
|
||||||
|
|
||||||
engine->SetupDisplay(w,h,bpp,fs);
|
engine->SetupDisplay(w,h,bpp,fs);
|
||||||
engine->CreateWindow(title);
|
engine->CreateDisplay(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test()
|
void Test()
|
||||||
@ -42,7 +42,7 @@ void Test()
|
|||||||
if(!song.IsLoaded()) //this executes if there is no music.ogg file
|
if(!song.IsLoaded()) //this executes if there is no music.ogg file
|
||||||
{
|
{
|
||||||
engine->SetupDisplay(800,70,32,false);
|
engine->SetupDisplay(800,70,32,false);
|
||||||
engine->CreateWindow("ZMusic Test");
|
engine->CreateDisplay("ZMusic Test");
|
||||||
font.DrawText("Music.ogg does not exist, please read music.txt.",text[0]);
|
font.DrawText("Music.ogg does not exist, please read music.txt.",text[0]);
|
||||||
text[0].Draw(0,0);
|
text[0].Draw(0,0);
|
||||||
engine->UpdateScreen();
|
engine->UpdateScreen();
|
||||||
@ -65,8 +65,8 @@ void Test()
|
|||||||
if(engine->KeyIsPressed(SDLK_s))
|
if(engine->KeyIsPressed(SDLK_s))
|
||||||
{
|
{
|
||||||
//code to toggle screen//
|
//code to toggle screen//
|
||||||
engine->SetupDisplay(engine->GetWidth(),engine->GetHeight(),engine->GetBPP(),!engine->IsFullscreen());
|
engine->SetupDisplay(engine->Width(),engine->Height(),engine->BPP(),!engine->IsFullscreen());
|
||||||
engine->CreateWindow("ZMusic Test");
|
engine->CreateDisplay("ZMusic Test");
|
||||||
}
|
}
|
||||||
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
||||||
engine->RequestQuit();
|
engine->RequestQuit();
|
||||||
|
@ -28,7 +28,7 @@ void Initialize()
|
|||||||
title = cfg.GetString("ZRectTest","title","ZRect Test");
|
title = cfg.GetString("ZRectTest","title","ZRect Test");
|
||||||
|
|
||||||
engine->SetupDisplay(w,h,bpp,fs);
|
engine->SetupDisplay(w,h,bpp,fs);
|
||||||
engine->CreateWindow(title);
|
engine->CreateDisplay(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test()
|
void Test()
|
||||||
@ -43,8 +43,8 @@ void Test()
|
|||||||
if(engine->KeyIsPressed(SDLK_s))
|
if(engine->KeyIsPressed(SDLK_s))
|
||||||
{
|
{
|
||||||
//code to toggle screen//
|
//code to toggle screen//
|
||||||
engine->SetupDisplay(engine->GetWidth(),engine->GetHeight(),engine->GetBPP(),!engine->IsFullscreen());
|
engine->SetupDisplay(engine->Width(),engine->Height(),engine->BPP(),!engine->IsFullscreen());
|
||||||
engine->CreateWindow("ZRect Test");
|
engine->CreateDisplay("ZRect Test");
|
||||||
}
|
}
|
||||||
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
||||||
engine->RequestQuit();
|
engine->RequestQuit();
|
||||||
|
@ -28,7 +28,7 @@ void Initialize()
|
|||||||
title = cfg.GetString("ZSoundTest","title","ZSound Test");
|
title = cfg.GetString("ZSoundTest","title","ZSound Test");
|
||||||
|
|
||||||
engine->SetupDisplay(w,h,bpp,fs);
|
engine->SetupDisplay(w,h,bpp,fs);
|
||||||
engine->CreateWindow(title);
|
engine->CreateDisplay(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test()
|
void Test()
|
||||||
@ -55,8 +55,8 @@ void Test()
|
|||||||
if(engine->KeyIsPressed(SDLK_s))
|
if(engine->KeyIsPressed(SDLK_s))
|
||||||
{
|
{
|
||||||
//code to toggle screen//
|
//code to toggle screen//
|
||||||
engine->SetupDisplay(engine->GetWidth(),engine->GetHeight(),engine->GetBPP(),!engine->IsFullscreen());
|
engine->SetupDisplay(engine->Width(),engine->Height(),engine->BPP(),!engine->IsFullscreen());
|
||||||
engine->CreateWindow("ZSound Test");
|
engine->CreateDisplay("ZSound Test");
|
||||||
}
|
}
|
||||||
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
||||||
engine->RequestQuit();
|
engine->RequestQuit();
|
||||||
|
@ -28,7 +28,7 @@ void Initialize()
|
|||||||
title = cfg.GetString("ZTimerTest","title","ZTimer Test");
|
title = cfg.GetString("ZTimerTest","title","ZTimer Test");
|
||||||
|
|
||||||
engine->SetupDisplay(w,h,bpp,fs);
|
engine->SetupDisplay(w,h,bpp,fs);
|
||||||
engine->CreateWindow(title);
|
engine->CreateDisplay(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test()
|
void Test()
|
||||||
@ -53,8 +53,8 @@ void Test()
|
|||||||
if(engine->KeyIsPressed(SDLK_s))
|
if(engine->KeyIsPressed(SDLK_s))
|
||||||
{
|
{
|
||||||
//code to toggle screen//
|
//code to toggle screen//
|
||||||
engine->SetupDisplay(engine->GetWidth(),engine->GetHeight(),engine->GetBPP(),!engine->IsFullscreen());
|
engine->SetupDisplay(engine->Width(),engine->Height(),engine->BPP(),!engine->IsFullscreen());
|
||||||
engine->CreateWindow("ZImage Test");
|
engine->CreateDisplay("ZImage Test");
|
||||||
}
|
}
|
||||||
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
if(engine->KeyIsPressed(SDLK_ESCAPE))
|
||||||
engine->RequestQuit();
|
engine->RequestQuit();
|
||||||
@ -95,7 +95,7 @@ void Test()
|
|||||||
{
|
{
|
||||||
if(++curTimer > 2)
|
if(++curTimer > 2)
|
||||||
curTimer = 0;
|
curTimer = 0;
|
||||||
engine->Sleep(200);
|
engine->Delay(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Render all the fonts//
|
//Render all the fonts//
|
||||||
|
1
todo.txt
1
todo.txt
@ -1,5 +1,6 @@
|
|||||||
ZEngine Todo List
|
ZEngine Todo List
|
||||||
|
|
||||||
|
-Add OpenGL 2D support for drawing.
|
||||||
-Proofread, update, clarify documentation.
|
-Proofread, update, clarify documentation.
|
||||||
-Add Support for PhysicsFS with SDL_ttf and SDL_mixer music. (Waiting on other libraries.)
|
-Add Support for PhysicsFS with SDL_ttf and SDL_mixer music. (Waiting on other libraries.)
|
||||||
-Write simple games using the library as examples
|
-Write simple games using the library as examples
|
||||||
|
Loading…
Reference in New Issue
Block a user