zengine/doc/html/ZE__ZEngine_8h-source.html
2003-07-05 00:40:44 +00:00

251 lines
21 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 -->
<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="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
00020 <span class="comment">//revision on this is so high.. can this be lowered?</span>
00021
00022 <span class="preprocessor">#ifndef __ze_zengine_h__</span>
00023 <span class="preprocessor"></span><span class="preprocessor">#define __ze_zengine_h__</span>
00024 <span class="preprocessor"></span>
00025 <span class="preprocessor">#include "<a class="code" href="ZE__Defines_8h.html">ZE_Defines.h</a>"</span>
00026 <span class="preprocessor">#include "<a class="code" href="ZE__Utility_8h.html">ZE_Utility.h</a>"</span>
00027 <span class="preprocessor">#include "<a class="code" href="ZE__Includes_8h.html">ZE_Includes.h</a>"</span>
00028 <span class="preprocessor">#include "<a class="code" href="ZE__ZError_8h.html">ZE_ZError.h</a>"</span>
00029 <span class="preprocessor">#include "<a class="code" href="ZE__ZRandGen_8h.html">ZE_ZRandGen.h</a>"</span>
00030 <span class="preprocessor">#include "<a class="code" href="VersionInfo_8h.html">VersionInfo.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 {
00048 <span class="keyword">public</span>:
00050 <span class="keyword">static</span> <a class="code" href="classVersionInfo.html">VersionInfo</a> <a class="code" href="classZE_1_1ZEngine.html#p0">Version</a>;
00051
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>;
<a name="l00056"></a><a class="code" href="classZE_1_1ZEngine.html#o0">00056</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o0">mWidth</a>;
<a name="l00058"></a><a class="code" href="classZE_1_1ZEngine.html#o1">00058</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o1">mHeight</a>;
<a name="l00060"></a><a class="code" href="classZE_1_1ZEngine.html#o2">00060</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o2">mBPP</a>;
<a name="l00062"></a><a class="code" href="classZE_1_1ZEngine.html#o3">00062</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o3">mFullscreen</a>;
<a name="l00064"></a><a class="code" href="classZE_1_1ZEngine.html#o4">00064</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o4">mInitialized</a>;
<a name="l00066"></a><a class="code" href="classZE_1_1ZEngine.html#o5">00066</a> SDL_Surface *<a class="code" href="classZE_1_1ZEngine.html#o5">mScreen</a>;
<a name="l00068"></a><a class="code" href="classZE_1_1ZEngine.html#o6">00068</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o6">mPaused</a>;
<a name="l00070"></a><a class="code" href="classZE_1_1ZEngine.html#o7">00070</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o7">mUnpauseOnActive</a>;
<a name="l00072"></a><a class="code" href="classZE_1_1ZEngine.html#o8">00072</a> Uint8 <a class="code" href="classZE_1_1ZEngine.html#o8">mDesiredFramerate</a>;
<a name="l00074"></a><a class="code" href="classZE_1_1ZEngine.html#o9">00074</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o9">mNextUpdate</a>;
<a name="l00076"></a><a class="code" href="classZE_1_1ZEngine.html#o10">00076</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o10">mLastPause</a>;
<a name="l00078"></a><a class="code" href="classZE_1_1ZEngine.html#o11">00078</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o11">mPausedTime</a>;
<a name="l00080"></a><a class="code" href="classZE_1_1ZEngine.html#o12">00080</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o12">mLastTime</a>;
<a name="l00082"></a><a class="code" href="classZE_1_1ZEngine.html#o13">00082</a> <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#o13">mSecPerFrame</a>;
<a name="l00084"></a><a class="code" href="classZE_1_1ZEngine.html#o14">00084</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o14">mNeedReload</a>;
<a name="l00086"></a><a class="code" href="classZE_1_1ZEngine.html#o15">00086</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o15">mActive</a>;
<a name="l00088"></a><a class="code" href="classZE_1_1ZEngine.html#o16">00088</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o16">mQuit</a>;
<a name="l00090"></a><a class="code" href="classZE_1_1ZEngine.html#o17">00090</a> Uint8 *<a class="code" href="classZE_1_1ZEngine.html#o17">mKeyIsPressed</a>;
<a name="l00092"></a><a class="code" href="classZE_1_1ZEngine.html#o18">00092</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o18">mKeyPress</a>[SDLK_LAST];
<a name="l00094"></a><a class="code" href="classZE_1_1ZEngine.html#o19">00094</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o19">mMouseX</a>;
<a name="l00096"></a><a class="code" href="classZE_1_1ZEngine.html#o20">00096</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o20">mMouseY</a>;
<a name="l00098"></a><a class="code" href="classZE_1_1ZEngine.html#o21">00098</a> Uint8 <a class="code" href="classZE_1_1ZEngine.html#o21">mMouseB</a>;
<a name="l00100"></a><a class="code" href="classZE_1_1ZEngine.html#o22">00100</a> std::queue&lt;ZError&gt; <a class="code" href="classZE_1_1ZEngine.html#o22">mErrorQueue</a>;
<a name="l00102"></a><a class="code" href="classZE_1_1ZEngine.html#o23">00102</a> <a class="code" href="classZE_1_1ZError.html">ZError</a> <a class="code" href="classZE_1_1ZEngine.html#o23">mCurError</a>;
<a name="l00104"></a><a class="code" href="classZE_1_1ZEngine.html#o24">00104</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o24">mLogAllErrors</a>;
<a name="l00106"></a><a class="code" href="classZE_1_1ZEngine.html#o25">00106</a> std::FILE *<a class="code" href="classZE_1_1ZEngine.html#o25">mErrlog</a>;
<a name="l00108"></a><a class="code" href="classZE_1_1ZEngine.html#o26">00108</a> SDL_EventFilter <a class="code" href="classZE_1_1ZEngine.html#o26">mEventFilter</a>;
<a name="l00110"></a><a class="code" href="classZE_1_1ZEngine.html#o27">00110</a> <a class="code" href="classZE_1_1ZRandGen.html">ZRandGen</a> <a class="code" href="classZE_1_1ZEngine.html#o27">mRandGen</a>;
00111
00112 <span class="preprocessor">#ifdef USE_SDL_MIXER </span>
00113 <span class="preprocessor"></span>
<a name="l00114"></a><a class="code" href="classZE_1_1ZEngine.html#o28">00114</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o28">mRate</a>;
<a name="l00116"></a><a class="code" href="classZE_1_1ZEngine.html#o29">00116</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o29">mStereo</a>;
00117 <span class="preprocessor">#endif </span>
00118 <span class="preprocessor"></span>
00120 <span class="comment">//Singleton + Memory Management//</span>
00122 <span class="comment"></span>
00123 <span class="keyword">private</span>:
00129 <a class="code" href="classZE_1_1ZEngine.html#c0">ZEngine</a>();
00130
00131 <span class="keyword">public</span>:
00132
00139 <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>();
00140
00146 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#d1">ReleaseInstance</a>();
00147
00149 <span class="comment">//Initialization//</span>
00151 <span class="comment"></span>
00162 <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);
00163
00164 <span class="preprocessor">#ifdef USE_SDL_MIXER</span>
00165 <span class="preprocessor"></span>
00173 <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);
00174 <span class="preprocessor">#endif </span>
00175 <span class="preprocessor"></span>
00187 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a2">CreateDisplay</a>(std::string title, std::string icon=<span class="stringliteral">""</span>);
00188
00194 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a3">CloseDisplay</a>();
00195
00203 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a4">ToggleFullscreen</a>();
00204
00212 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a5">Initialized</a>();
00213
00215 <span class="comment">//Screen Access//</span>
00217 <span class="comment"></span>
00224 SDL_Surface *<a class="code" href="classZE_1_1ZEngine.html#a6">Display</a>();
00225
00232 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a7">Update</a>();
00233
00243 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a8">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);
00244
00246 <span class="comment">//OpenGL Specific Functions//</span>
00248 <span class="comment"></span>
00255 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a9">SetGL2D</a>();
00256
00258 <span class="comment">//Timer and Framerate Independent Movement//</span>
00260 <span class="comment"></span>
00267 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a10">Delay</a>(Uint32 milliseconds);
00268
00275 Uint32 <a class="code" href="classZE_1_1ZEngine.html#a11">GetTime</a>();
00276
00282 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a12">PauseTimer</a>();
00283
00289 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a13">UnpauseTimer</a>();
00290
00297 <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#a14">GetFrameTime</a>();
00298
00306 <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#a15">GetFramerate</a>();
00307
00317 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a16">SetDesiredFramerate</a>(Uint8 rate);
00318
00326 Uint8 <a class="code" href="classZE_1_1ZEngine.html#a17">GetDesiredFramerate</a>();
00327
00334 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a18">IsPaused</a>();
00335
00337 <span class="comment">//Event and Input Handling//</span>
00339 <span class="comment"></span>
00346 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a19">IsActive</a>();
00347
00354 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a20">RequestQuit</a>();
00355
00363 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a21">QuitRequested</a>();
00364
00369 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a22">SetReloadNeed</a>(<span class="keywordtype">bool</span> state);
00370
00378 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a23">ImagesNeedReload</a>();
00379
00388 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a24">SetKeyRepeatRate</a>(<span class="keywordtype">int</span> rate);
00389
00397 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a25">KeyIsPressed</a>(SDLKey key);
00398
00406 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a26">KeyPress</a>(SDLKey key);
00407
00413 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a27">HideCursor</a>();
00414
00420 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a28">ShowCursor</a>();
00421
00428 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a29">MouseX</a>();
00429
00436 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a30">MouseY</a>();
00437
00444 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a31">LButtonPressed</a>();
00445
00452 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a32">RButtonPressed</a>();
00453
00461 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a33">MouseInRect</a>(SDL_Rect *rect);
00462
00468 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a34">CheckEvents</a>();
00469
00482 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a35">SetEventFilter</a>(SDL_EventFilter filter);
00483
00484 <span class="preprocessor">#ifdef USE_PHYSFS</span>
00485 <span class="preprocessor"></span>
00486 <span class="comment">//Physfs Utilities//</span>
00488 <span class="comment"></span>
00494 <span class="keywordtype">void</span> InitPhysFS(std::string argv);
00495
00502 <span class="keywordtype">void</span> AddPhysFSDir(std::string dir);
00503
00504 <span class="preprocessor">#endif //USE_PHYSFS</span>
00505 <span class="preprocessor"></span>
00507 <span class="comment">//Error Logging//</span>
00509 <span class="comment"></span> <span class="keyword">private</span>:
00517 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#c1">LogError</a>(<a class="code" href="classZE_1_1ZError.html">ZError</a> error);
00518
00519 <span class="keyword">public</span>:
00530 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a36">SetErrorLog</a>(<span class="keywordtype">bool</span> logAll, std::string logFile=<span class="stringliteral">""</span>);
00531
00542 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a37">ReportError</a>(ZErrorCode code, std::string desc=<span class="stringliteral">""</span>, std::string file=<span class="stringliteral">""</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> line=0);
00543
00551 <a class="code" href="namespaceZE.html#a24">ZErrorCode</a> <a class="code" href="classZE_1_1ZEngine.html#a38">GetLastError</a>();
00552
00560 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a39">WriteLog</a>(std::string str);
00561
00568 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a40">FlushErrors</a>();
00569
00571 <span class="comment">//Random Number Generation//</span>
00573 <span class="comment"></span>
00579 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a41">SeedRandGen</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> seed);
00580
00588 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a42">Rand</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> max);
00589
00597 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classZE_1_1ZEngine.html#a42">Rand</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> max);
00598
00607 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a42">Rand</a>(<span class="keywordtype">int</span> min, <span class="keywordtype">int</span> max);
00608
00617 <span class="keywordtype">long</span> <a class="code" href="classZE_1_1ZEngine.html#a42">Rand</a>(<span class="keywordtype">long</span> min, <span class="keywordtype">long</span> max);
00618
00627 <span class="keywordtype">float</span> <a class="code" href="classZE_1_1ZEngine.html#a42">Rand</a>(<span class="keywordtype">float</span> min, <span class="keywordtype">float</span> max);
00628
00637 <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#a42">Rand</a>(<span class="keywordtype">double</span> min, <span class="keywordtype">double</span> max);
00638
00645 <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#a48">RandDouble</a>();
00646
00648 <span class="comment">//Data Loading + Unloading//</span>
00650 <span class="comment"></span>
00657 SDL_Surface* <a class="code" href="classZE_1_1ZEngine.html#a49">LoadImage</a>(std::string filename);
00658
00659 <span class="preprocessor">#ifdef USE_SDL_MIXER</span>
00660 <span class="preprocessor"></span>
00667 Mix_Chunk* <a class="code" href="classZE_1_1ZEngine.html#a50">LoadSound</a>(std::string filename);
00668
00676 Mix_Music* <a class="code" href="classZE_1_1ZEngine.html#a51">LoadMusic</a>(std::string filename);
00677 <span class="preprocessor">#endif</span>
00678 <span class="preprocessor"></span>
00679 <span class="preprocessor">#ifdef USE_SDL_TTF</span>
00680 <span class="preprocessor"></span>
00688 TTF_Font* <a class="code" href="classZE_1_1ZEngine.html#a52">LoadFont</a>(std::string filename, <span class="keywordtype">int</span> size);
00689 <span class="preprocessor">#endif </span>
00690 <span class="preprocessor"></span>
00692 <span class="comment">//Accessors//</span>
00694 <span class="comment"></span>
00701 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a53">Width</a>();
00702
00709 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a54">Height</a>();
00710
00717 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a55">BPP</a>();
00718
00725 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a56">IsFullscreen</a>();
00726 };
00727
00728 }
00729
00730 <span class="preprocessor">#endif //__ze_zengine_h__</span>
</pre></div><hr><address style="align: right;"><small>Generated on Sun Jun 29 14:13:51 2003 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 </small></address>
</body>
</html>