zengine/doc/html/ZE__ZEngine_8h-source.html
2002-12-29 07:24:06 +00:00

208 lines
15 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>/include/ZE_ZEngine.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3-rc2 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
<hr><h1>/include/ZE_ZEngine.h</h1><a href="ZE__ZEngine_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*******************************************************************************</span>
00002 <span class="comment"> This file is Part of the ZEngine Library for 2D game development.</span>
00003 <span class="comment"> Copyright (C) 2002, 2003 James Turk</span>
00004 <span class="comment"></span>
00005 <span class="comment"> Licensed under a BSD-style license.</span>
00006 <span class="comment"></span>
00007 <span class="comment"> The maintainer of this library is James Turk (james@conceptofzero.net) </span>
00008 <span class="comment"> and the home of this Library is http://www.zengine.sourceforge.net</span>
00009 <span class="comment">*******************************************************************************/</span>
00010
00024 <span class="preprocessor">#ifndef __ze_zengine_h__</span>
00025 <span class="preprocessor"></span><span class="preprocessor">#define __ze_zengine_h__</span>
00026 <span class="preprocessor"></span>
00027 <span class="preprocessor">#include "<a class="code" href="ZE__Error_8h.html">ZE_Error.h</a>"</span>
00028 <span class="preprocessor">#include "<a class="code" href="ZE__Defines_8h.html">ZE_Defines.h</a>"</span>
00029 <span class="preprocessor">#include "<a class="code" href="ZE__Macros_8h.html">ZE_Macros.h</a>"</span>
00030 <span class="preprocessor">#include "<a class="code" href="ZE__Includes_8h.html">ZE_Includes.h</a>"</span>
00031
00037 <span class="keyword">namespace </span>ZE
00038 {
00039
<a name="l00046"></a><a class="code" href="classZE_1_1ZEngine.html">00046</a> <span class="keyword">class </span><a class="code" href="classZE_1_1ZEngine.html">ZEngine</a>
00047 {
00049 <span class="comment">//Singleton + Memory Management//</span>
00051 <span class="comment"></span>
00052 <span class="keyword">private</span>:
00054 <span class="keyword">static</span> <a class="code" href="classZE_1_1ZEngine.html">ZEngine</a> *<a class="code" href="classZE_1_1ZEngine.html#r0">sInstance</a>;
00055
00061 <a class="code" href="classZE_1_1ZEngine.html#c0">ZEngine</a>();
00062
00063 <span class="keyword">public</span>:
00064
00071 <span class="keyword">static</span> <a class="code" href="classZE_1_1ZEngine.html">ZEngine</a>* <a class="code" href="classZE_1_1ZEngine.html#d0">GetInstance</a>();
00072
00078 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#d1">ReleaseInstance</a>();
00079
00086 <span class="keyword">static</span> string <a class="code" href="classZE_1_1ZEngine.html#d2">GetVersion</a>();
00087
00089 <span class="comment">//Initialization//</span>
00091 <span class="comment"></span>
00092 <span class="keyword">private</span>:
<a name="l00094"></a><a class="code" href="classZE_1_1ZEngine.html#o0">00094</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o0">mWidth</a>;
<a name="l00096"></a><a class="code" href="classZE_1_1ZEngine.html#o1">00096</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o1">mHeight</a>;
<a name="l00098"></a><a class="code" href="classZE_1_1ZEngine.html#o2">00098</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o2">mBPP</a>;
<a name="l00100"></a><a class="code" href="classZE_1_1ZEngine.html#o3">00100</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o3">mFullscreen</a>;
00101
00102 <span class="preprocessor">#ifdef USE_SDL_MIXER </span>
00103 <span class="preprocessor"></span>
<a name="l00104"></a><a class="code" href="classZE_1_1ZEngine.html#o4">00104</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o4">mRate</a>;
<a name="l00106"></a><a class="code" href="classZE_1_1ZEngine.html#o5">00106</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o5">mStereo</a>;
00107 <span class="preprocessor">#endif </span>
00108 <span class="preprocessor"></span>
00109
00110 <span class="keyword">public</span>:
00111 <span class="comment">//add initialization</span>
00112
00123 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a0">SetupDisplay</a>(<span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height, <span class="keywordtype">int</span> bpp, <span class="keywordtype">bool</span> fullscreen);
00124
00125 <span class="preprocessor">#ifdef USE_SDL_MIXER</span>
00126 <span class="preprocessor"></span>
00134 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a1">SetupSound</a>(<span class="keywordtype">int</span> rate, <span class="keywordtype">bool</span> stereo);
00135 <span class="preprocessor">#endif </span>
00136 <span class="preprocessor"></span>
00146 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a2">CreateDisplay</a>(string title, string icon=<span class="stringliteral">""</span>);
00147
00153 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a3">CloseDisplay</a>();
00154
00156 <span class="comment">//Screen Access//</span>
00158 <span class="comment"></span>
00159 <span class="keyword">private</span>:
<a name="l00161"></a><a class="code" href="classZE_1_1ZEngine.html#o6">00161</a> SDL_Surface *<a class="code" href="classZE_1_1ZEngine.html#o6">mScreen</a>;
00162
00163 <span class="keyword">public</span>:
00170 SDL_Surface *<a class="code" href="classZE_1_1ZEngine.html#a4">Display</a>();
00171
00177 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a5">Update</a>();
00178
00188 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a6">Clear</a>(<span class="keywordtype">float</span> red=0.0f, <span class="keywordtype">float</span> green=0.0f, <span class="keywordtype">float</span> blue=0.0f, <span class="keywordtype">float</span> alpha=1.0f);
00189
00191 <span class="comment">//OpenGL Specific Functions//</span>
00193 <span class="comment"> public:</span>
00194
00201 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a7">SetGL2D</a>();
00202
00204 <span class="comment">//Timer and Framerate Independent Movement//</span>
00206 <span class="comment"> </span>
00207 <span class="keyword">private</span>:
<a name="l00209"></a><a class="code" href="classZE_1_1ZEngine.html#o7">00209</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o7">mPaused</a>;
<a name="l00211"></a><a class="code" href="classZE_1_1ZEngine.html#o8">00211</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o8">mUnpauseOnActive</a>;
<a name="l00213"></a><a class="code" href="classZE_1_1ZEngine.html#o9">00213</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o9">mLastPause</a>;
<a name="l00215"></a><a class="code" href="classZE_1_1ZEngine.html#o10">00215</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o10">mPausedTime</a>;
<a name="l00217"></a><a class="code" href="classZE_1_1ZEngine.html#o11">00217</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o11">mLastTime</a>;
<a name="l00219"></a><a class="code" href="classZE_1_1ZEngine.html#o12">00219</a> <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#o12">mSecPerFrame</a>;
00220
00221 <span class="keyword">public</span>:
00228 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a8">Delay</a>(Uint32 milliseconds);
00229
00236 Uint32 <a class="code" href="classZE_1_1ZEngine.html#a9">GetTime</a>();
00237
00243 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a10">PauseTimer</a>();
00244
00250 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a11">UnpauseTimer</a>();
00251
00258 <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#a12">GetFrameTime</a>();
00259
00266 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a13">IsPaused</a>();
00267
00269 <span class="comment">//Event and Input Handling//</span>
00271 <span class="comment"> private:</span>
<a name="l00273"></a><a class="code" href="classZE_1_1ZEngine.html#o13">00273</a> <span class="comment"> bool mNeedReload;</span>
<a name="l00275"></a><a class="code" href="classZE_1_1ZEngine.html#o14">00275</a> <span class="comment"> bool mActive;</span>
<a name="l00277"></a><a class="code" href="classZE_1_1ZEngine.html#o15">00277</a> <span class="comment"> bool mQuit;</span>
<a name="l00279"></a><a class="code" href="classZE_1_1ZEngine.html#o16">00279</a> <span class="comment"> Uint8 *mKeyIsPressed;</span>
<a name="l00281"></a><a class="code" href="classZE_1_1ZEngine.html#o17">00281</a> <span class="comment"> bool mKeyPress[SDLK_LAST];</span>
<a name="l00283"></a><a class="code" href="classZE_1_1ZEngine.html#o18">00283</a> <span class="comment"> int mMouseX;</span>
<a name="l00285"></a><a class="code" href="classZE_1_1ZEngine.html#o19">00285</a> <span class="comment"> int mMouseY;</span>
<a name="l00287"></a><a class="code" href="classZE_1_1ZEngine.html#o20">00287</a> <span class="comment"> Uint8 mMouseB;</span>
00288
00289 <span class="keyword">public</span>:
00296 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a14">IsActive</a>();
00297
00304 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a15">RequestQuit</a>();
00305
00313 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a16">QuitRequested</a>();
00314
00319 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a17">SetReloadNeed</a>(<span class="keywordtype">bool</span> state);
00320
00328 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a18">ImagesNeedReload</a>();
00329
00339 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a19">SetKeyRepeatRate</a>(<span class="keywordtype">int</span> rate);
00340
00348 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a20">KeyIsPressed</a>(SDLKey key);
00349
00357 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a21">KeyPress</a>(SDLKey key);
00358
00364 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a22">HideCursor</a>();
00365
00371 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a23">ShowCursor</a>();
00372
00379 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a24">MouseX</a>();
00380
00387 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a25">MouseY</a>();
00388
00395 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a26">LButtonPressed</a>();
00396
00403 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a27">RButtonPressed</a>();
00404
00412 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a28">MouseInRect</a>(SDL_Rect *rect);
00413
00419 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a29">CheckEvents</a>();
00420
00421 <span class="preprocessor">#ifdef USE_PHYSFS</span>
00422 <span class="preprocessor"></span>
00423 <span class="comment">//Physfs Utilities//</span>
00425 <span class="comment"> public:</span>
00432 <span class="comment"></span> <span class="keywordtype">void</span> InitPhysFS(string argv);
00433
00440 <span class="keywordtype">void</span> AddPhysFSDir(string dir);
00441
00442 <span class="preprocessor">#endif //USE_PHYSFS</span>
00443 <span class="preprocessor"></span>
00444
00446 <span class="comment">//Data Loading + Unloading//</span>
00448 <span class="comment"> public:</span>
00456 <span class="comment"></span> SDL_Surface* <a class="code" href="classZE_1_1ZEngine.html#a30">LoadImage</a>(string filename);
00457
00458 <span class="preprocessor">#ifdef USE_SDL_MIXER</span>
00459 <span class="preprocessor"></span>
00466 Mix_Chunk* <a class="code" href="classZE_1_1ZEngine.html#a31">LoadSound</a>(string filename);
00467
00475 Mix_Music* <a class="code" href="classZE_1_1ZEngine.html#a32">LoadMusic</a>(string filename);
00476 <span class="preprocessor">#endif</span>
00477 <span class="preprocessor"></span>
00478 <span class="preprocessor">#ifdef USE_SDL_TTF</span>
00479 <span class="preprocessor"></span>
00487 TTF_Font* <a class="code" href="classZE_1_1ZEngine.html#a33">LoadFont</a>(string filename, <span class="keywordtype">int</span> size);
00488 <span class="preprocessor">#endif </span>
00489 <span class="preprocessor"></span>
00491 <span class="comment">//Accessors//</span>
00493 <span class="comment"></span>
00494 <span class="keyword">public</span>:
00501 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a34">Width</a>();
00502
00509 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a35">Height</a>();
00510
00517 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a36">BPP</a>();
00518
00525 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a37">IsFullscreen</a>();
00526 };
00527
00528 }
00529
00530 <span class="preprocessor">#endif //__ze_zengine_h__</span>
</pre></div><hr><address style="align: right;"><small>Generated on Sun Dec 29 02:21:35 2002 for ZEngine by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.3-rc2 </small></address>
</body>
</html>