zengine/doc/html/ZE__ZEngine_8h-source.html

236 lines
18 KiB
HTML
Raw Normal View History

2003-01-18 22:54:50 +00:00
<!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__Defines_8h.html">ZE_Defines.h</a>"</span>
00028 <span class="preprocessor">#include "<a class="code" href="ZE__Utility_8h.html">ZE_Utility.h</a>"</span>
00029 <span class="preprocessor">#include "<a class="code" href="ZE__Includes_8h.html">ZE_Includes.h</a>"</span>
00030 <span class="preprocessor">#include "<a class="code" href="ZE__ZError_8h.html">ZE_ZError.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>
00148 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a2">CreateDisplay</a>(string title, string icon=<span class="stringliteral">""</span>);
00149
00155 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a3">CloseDisplay</a>();
00156
00158 <span class="comment">//Screen Access//</span>
00160 <span class="comment"></span>
00161 <span class="keyword">private</span>:
<a name="l00163"></a><a class="code" href="classZE_1_1ZEngine.html#o6">00163</a> SDL_Surface *<a class="code" href="classZE_1_1ZEngine.html#o6">mScreen</a>;
00164
00165 <span class="keyword">public</span>:
00172 SDL_Surface *<a class="code" href="classZE_1_1ZEngine.html#a4">Display</a>();
00173
00180 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a5">Update</a>();
00181
00191 <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);
00192
00194 <span class="comment">//OpenGL Specific Functions//</span>
00196 <span class="comment"> public:</span>
00197
00204 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a7">SetGL2D</a>();
00205
00207 <span class="comment">//Timer and Framerate Independent Movement//</span>
00209 <span class="comment"> </span>
00210 <span class="keyword">private</span>:
<a name="l00212"></a><a class="code" href="classZE_1_1ZEngine.html#o7">00212</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o7">mPaused</a>;
<a name="l00214"></a><a class="code" href="classZE_1_1ZEngine.html#o8">00214</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o8">mUnpauseOnActive</a>;
<a name="l00216"></a><a class="code" href="classZE_1_1ZEngine.html#o9">00216</a> Uint8 <a class="code" href="classZE_1_1ZEngine.html#o9">mDesiredFramerate</a>;
<a name="l00218"></a><a class="code" href="classZE_1_1ZEngine.html#o10">00218</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o10">mNextUpdate</a>;
<a name="l00220"></a><a class="code" href="classZE_1_1ZEngine.html#o11">00220</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o11">mLastPause</a>;
<a name="l00222"></a><a class="code" href="classZE_1_1ZEngine.html#o12">00222</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o12">mPausedTime</a>;
<a name="l00224"></a><a class="code" href="classZE_1_1ZEngine.html#o13">00224</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o13">mLastTime</a>;
<a name="l00226"></a><a class="code" href="classZE_1_1ZEngine.html#o14">00226</a> <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#o14">mSecPerFrame</a>;
00227
00228 <span class="keyword">public</span>:
00235 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a8">Delay</a>(Uint32 milliseconds);
00236
00243 Uint32 <a class="code" href="classZE_1_1ZEngine.html#a9">GetTime</a>();
00244
00250 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a10">PauseTimer</a>();
00251
00257 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a11">UnpauseTimer</a>();
00258
00265 <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#a12">GetFrameTime</a>();
00266
00274 <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#a13">GetFramerate</a>();
00275
00285 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a14">SetDesiredFramerate</a>(Uint8 rate);
00286
00294 Uint8 <a class="code" href="classZE_1_1ZEngine.html#a15">GetDesiredFramerate</a>();
00295
00302 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a16">IsPaused</a>();
00303
00305 <span class="comment">//Event and Input Handling//</span>
00307 <span class="comment"> private:</span>
<a name="l00309"></a><a class="code" href="classZE_1_1ZEngine.html#o15">00309</a> <span class="comment"> bool mNeedReload;</span>
<a name="l00311"></a><a class="code" href="classZE_1_1ZEngine.html#o16">00311</a> <span class="comment"> bool mActive;</span>
<a name="l00313"></a><a class="code" href="classZE_1_1ZEngine.html#o17">00313</a> <span class="comment"> bool mQuit;</span>
<a name="l00315"></a><a class="code" href="classZE_1_1ZEngine.html#o18">00315</a> <span class="comment"> Uint8 *mKeyIsPressed;</span>
<a name="l00317"></a><a class="code" href="classZE_1_1ZEngine.html#o19">00317</a> <span class="comment"> bool mKeyPress[SDLK_LAST];</span>
<a name="l00319"></a><a class="code" href="classZE_1_1ZEngine.html#o20">00319</a> <span class="comment"> int mMouseX;</span>
<a name="l00321"></a><a class="code" href="classZE_1_1ZEngine.html#o21">00321</a> <span class="comment"> int mMouseY;</span>
<a name="l00323"></a><a class="code" href="classZE_1_1ZEngine.html#o22">00323</a> <span class="comment"> Uint8 mMouseB;</span>
00324
00325 <span class="keyword">public</span>:
00332 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a17">IsActive</a>();
00333
00340 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a18">RequestQuit</a>();
00341
00349 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a19">QuitRequested</a>();
00350
00355 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a20">SetReloadNeed</a>(<span class="keywordtype">bool</span> state);
00356
00364 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a21">ImagesNeedReload</a>();
00365
00375 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a22">SetKeyRepeatRate</a>(<span class="keywordtype">int</span> rate);
00376
00384 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a23">KeyIsPressed</a>(SDLKey key);
00385
00393 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a24">KeyPress</a>(SDLKey key);
00394
00400 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a25">HideCursor</a>();
00401
00407 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a26">ShowCursor</a>();
00408
00415 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a27">MouseX</a>();
00416
00423 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a28">MouseY</a>();
00424
00431 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a29">LButtonPressed</a>();
00432
00439 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a30">RButtonPressed</a>();
00440
00448 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a31">MouseInRect</a>(SDL_Rect *rect);
00449
00455 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a32">CheckEvents</a>();
00456
00457 <span class="preprocessor">#ifdef USE_PHYSFS</span>
00458 <span class="preprocessor"></span>
00459 <span class="comment">//Physfs Utilities//</span>
00461 <span class="comment"> public:</span>
00468 <span class="comment"></span> <span class="keywordtype">void</span> InitPhysFS(string argv);
00469
00476 <span class="keywordtype">void</span> AddPhysFSDir(string dir);
00477
00478 <span class="preprocessor">#endif //USE_PHYSFS</span>
00479 <span class="preprocessor"></span>
00481 <span class="comment">//Error Logging//</span>
00483 <span class="comment"> private:</span>
<a name="l00485"></a><a class="code" href="classZE_1_1ZEngine.html#o23">00485</a> <span class="comment"> queue&lt;ZError&gt; mErrorQueue;</span>
<a name="l00487"></a><a class="code" href="classZE_1_1ZEngine.html#o24">00487</a> <span class="comment"> ZError mCurError;</span>
<a name="l00489"></a><a class="code" href="classZE_1_1ZEngine.html#o25">00489</a> <span class="comment"> bool mLogAllErrors;</span>
<a name="l00491"></a><a class="code" href="classZE_1_1ZEngine.html#o26">00491</a> <span class="comment"> FILE *mErrlog;</span>
00492
00500 <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);
00501
00502 <span class="keyword">public</span>:
00513 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a33">SetErrorLog</a>(<span class="keywordtype">bool</span> logAll, string logFile=<span class="stringliteral">""</span>);
00514
00525 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a34">ReportError</a>(ZErrorCode code, string desc=<span class="stringliteral">""</span>, string file=<span class="stringliteral">""</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> line=0);
00526
00534 <a class="code" href="namespaceZE.html#a16">ZErrorCode</a> <a class="code" href="classZE_1_1ZEngine.html#a35">GetLastError</a>();
00535
00543 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a36">WriteLog</a>(string str);
00544
00551 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a37">FlushErrors</a>();
00552
00553
00555 <span class="comment">//Data Loading + Unloading//</span>
00557 <span class="comment"> public:</span>
00565 <span class="comment"></span> SDL_Surface* <a class="code" href="classZE_1_1ZEngine.html#a38">LoadImage</a>(string filename);
00566
00567 <span class="preprocessor">#ifdef USE_SDL_MIXER</span>
00568 <span class="preprocessor"></span>
00575 Mix_Chunk* <a class="code" href="classZE_1_1ZEngine.html#a39">LoadSound</a>(string filename);
00576
00584 Mix_Music* <a class="code" href="classZE_1_1ZEngine.html#a40">LoadMusic</a>(string filename);
00585 <span class="preprocessor">#endif</span>
00586 <span class="preprocessor"></span>
00587 <span class="preprocessor">#ifdef USE_SDL_TTF</span>
00588 <span class="preprocessor"></span>
00596 TTF_Font* <a class="code" href="classZE_1_1ZEngine.html#a41">LoadFont</a>(string filename, <span class="keywordtype">int</span> size);
00597 <span class="preprocessor">#endif </span>
00598 <span class="preprocessor"></span>
00600 <span class="comment">//Accessors//</span>
00602 <span class="comment"></span>
00603 <span class="keyword">public</span>:
00610 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a42">Width</a>();
00611
00618 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a43">Height</a>();
00619
00626 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a44">BPP</a>();
00627
00634 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a45">IsFullscreen</a>();
00635 };
00636
00637 }
00638
00639 <span class="preprocessor">#endif //__ze_zengine_h__</span>
</pre></div><hr><address style="align: right;"><small>Generated on Sat Jan 18 17:53:20 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-rc2 </small></address>
</body>
</html>