239 lines
20 KiB
HTML
239 lines
20 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> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </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 {
|
|
00048
|
|
00049 <span class="keyword">private</span>:
|
|
00051 <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="l00053"></a><a class="code" href="classZE_1_1ZEngine.html#o0">00053</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o0">mWidth</a>;
|
|
<a name="l00055"></a><a class="code" href="classZE_1_1ZEngine.html#o1">00055</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o1">mHeight</a>;
|
|
<a name="l00057"></a><a class="code" href="classZE_1_1ZEngine.html#o2">00057</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o2">mBPP</a>;
|
|
<a name="l00059"></a><a class="code" href="classZE_1_1ZEngine.html#o3">00059</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o3">mFullscreen</a>;
|
|
<a name="l00061"></a><a class="code" href="classZE_1_1ZEngine.html#o4">00061</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o4">mInitialized</a>;
|
|
<a name="l00063"></a><a class="code" href="classZE_1_1ZEngine.html#o5">00063</a> SDL_Surface *<a class="code" href="classZE_1_1ZEngine.html#o5">mScreen</a>;
|
|
<a name="l00065"></a><a class="code" href="classZE_1_1ZEngine.html#o6">00065</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o6">mPaused</a>;
|
|
<a name="l00067"></a><a class="code" href="classZE_1_1ZEngine.html#o7">00067</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o7">mUnpauseOnActive</a>;
|
|
<a name="l00069"></a><a class="code" href="classZE_1_1ZEngine.html#o8">00069</a> Uint8 <a class="code" href="classZE_1_1ZEngine.html#o8">mDesiredFramerate</a>;
|
|
<a name="l00071"></a><a class="code" href="classZE_1_1ZEngine.html#o9">00071</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o9">mNextUpdate</a>;
|
|
<a name="l00073"></a><a class="code" href="classZE_1_1ZEngine.html#o10">00073</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o10">mLastPause</a>;
|
|
<a name="l00075"></a><a class="code" href="classZE_1_1ZEngine.html#o11">00075</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o11">mPausedTime</a>;
|
|
<a name="l00077"></a><a class="code" href="classZE_1_1ZEngine.html#o12">00077</a> Uint32 <a class="code" href="classZE_1_1ZEngine.html#o12">mLastTime</a>;
|
|
<a name="l00079"></a><a class="code" href="classZE_1_1ZEngine.html#o13">00079</a> <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#o13">mSecPerFrame</a>;
|
|
<a name="l00081"></a><a class="code" href="classZE_1_1ZEngine.html#o14">00081</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o14">mNeedReload</a>;
|
|
<a name="l00083"></a><a class="code" href="classZE_1_1ZEngine.html#o15">00083</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o15">mActive</a>;
|
|
<a name="l00085"></a><a class="code" href="classZE_1_1ZEngine.html#o16">00085</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o16">mQuit</a>;
|
|
<a name="l00087"></a><a class="code" href="classZE_1_1ZEngine.html#o17">00087</a> Uint8 *<a class="code" href="classZE_1_1ZEngine.html#o17">mKeyIsPressed</a>;
|
|
<a name="l00089"></a><a class="code" href="classZE_1_1ZEngine.html#o18">00089</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o18">mKeyPress</a>[SDLK_LAST];
|
|
<a name="l00091"></a><a class="code" href="classZE_1_1ZEngine.html#o19">00091</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o19">mMouseX</a>;
|
|
<a name="l00093"></a><a class="code" href="classZE_1_1ZEngine.html#o20">00093</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o20">mMouseY</a>;
|
|
<a name="l00095"></a><a class="code" href="classZE_1_1ZEngine.html#o21">00095</a> Uint8 <a class="code" href="classZE_1_1ZEngine.html#o21">mMouseB</a>;
|
|
<a name="l00097"></a><a class="code" href="classZE_1_1ZEngine.html#o22">00097</a> queue<ZError> <a class="code" href="classZE_1_1ZEngine.html#o22">mErrorQueue</a>;
|
|
<a name="l00099"></a><a class="code" href="classZE_1_1ZEngine.html#o23">00099</a> <a class="code" href="classZE_1_1ZError.html">ZError</a> <a class="code" href="classZE_1_1ZEngine.html#o23">mCurError</a>;
|
|
<a name="l00101"></a><a class="code" href="classZE_1_1ZEngine.html#o24">00101</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o24">mLogAllErrors</a>;
|
|
<a name="l00103"></a><a class="code" href="classZE_1_1ZEngine.html#o25">00103</a> FILE *<a class="code" href="classZE_1_1ZEngine.html#o25">mErrlog</a>;
|
|
00104
|
|
00105 <span class="preprocessor">#ifdef USE_SDL_MIXER </span>
|
|
00106 <span class="preprocessor"></span>
|
|
<a name="l00107"></a><a class="code" href="classZE_1_1ZEngine.html#o26">00107</a> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#o26">mRate</a>;
|
|
<a name="l00109"></a><a class="code" href="classZE_1_1ZEngine.html#o27">00109</a> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#o27">mStereo</a>;
|
|
00110 <span class="preprocessor">#endif </span>
|
|
00111 <span class="preprocessor"></span>
|
|
00113 <span class="comment">//Singleton + Memory Management//</span>
|
|
00115 <span class="comment"></span>
|
|
00116 <span class="keyword">private</span>:
|
|
00122 <a class="code" href="classZE_1_1ZEngine.html#c0">ZEngine</a>();
|
|
00123
|
|
00124 <span class="keyword">public</span>:
|
|
00125
|
|
00132 <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>();
|
|
00133
|
|
00139 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#d1">ReleaseInstance</a>();
|
|
00140
|
|
00147 <span class="keyword">static</span> string <a class="code" href="classZE_1_1ZEngine.html#d2">GetVersion</a>();
|
|
00148
|
|
00150 <span class="comment">//Initialization//</span>
|
|
00152 <span class="comment"></span>
|
|
00163 <span class="comment"></span> <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);
|
|
00164
|
|
00165 <span class="preprocessor">#ifdef USE_SDL_MIXER</span>
|
|
00166 <span class="preprocessor"></span>
|
|
00174 <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);
|
|
00175 <span class="preprocessor">#endif </span>
|
|
00176 <span class="preprocessor"></span>
|
|
00188 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a2">CreateDisplay</a>(string title, string icon=<span class="stringliteral">""</span>);
|
|
00189
|
|
00195 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a3">CloseDisplay</a>();
|
|
00196
|
|
00204 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a4">ToggleFullscreen</a>();
|
|
00205
|
|
00213 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a5">Initialized</a>();
|
|
00214
|
|
00216 <span class="comment">//Screen Access//</span>
|
|
00218 <span class="comment"></span>
|
|
00225 <span class="comment"></span> SDL_Surface *<a class="code" href="classZE_1_1ZEngine.html#a6">Display</a>();
|
|
00226
|
|
00233 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a7">Update</a>();
|
|
00234
|
|
00244 <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);
|
|
00245
|
|
00247 <span class="comment">//OpenGL Specific Functions//</span>
|
|
00249 <span class="comment"></span>
|
|
00256 <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a9">SetGL2D</a>();
|
|
00257
|
|
00259 <span class="comment">//Timer and Framerate Independent Movement//</span>
|
|
00261 <span class="comment"></span>
|
|
00268 <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a10">Delay</a>(Uint32 milliseconds);
|
|
00269
|
|
00276 Uint32 <a class="code" href="classZE_1_1ZEngine.html#a11">GetTime</a>();
|
|
00277
|
|
00283 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a12">PauseTimer</a>();
|
|
00284
|
|
00290 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a13">UnpauseTimer</a>();
|
|
00291
|
|
00298 <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#a14">GetFrameTime</a>();
|
|
00299
|
|
00307 <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#a15">GetFramerate</a>();
|
|
00308
|
|
00318 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a16">SetDesiredFramerate</a>(Uint8 rate);
|
|
00319
|
|
00327 Uint8 <a class="code" href="classZE_1_1ZEngine.html#a17">GetDesiredFramerate</a>();
|
|
00328
|
|
00335 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a18">IsPaused</a>();
|
|
00336
|
|
00338 <span class="comment">//Event and Input Handling//</span>
|
|
00340 <span class="comment"></span>
|
|
00347 <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a19">IsActive</a>();
|
|
00348
|
|
00355 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a20">RequestQuit</a>();
|
|
00356
|
|
00364 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a21">QuitRequested</a>();
|
|
00365
|
|
00370 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a22">SetReloadNeed</a>(<span class="keywordtype">bool</span> state);
|
|
00371
|
|
00379 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a23">ImagesNeedReload</a>();
|
|
00380
|
|
00389 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a24">SetKeyRepeatRate</a>(<span class="keywordtype">int</span> rate);
|
|
00390
|
|
00398 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a25">KeyIsPressed</a>(SDLKey key);
|
|
00399
|
|
00407 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a26">KeyPress</a>(SDLKey key);
|
|
00408
|
|
00414 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a27">HideCursor</a>();
|
|
00415
|
|
00421 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a28">ShowCursor</a>();
|
|
00422
|
|
00429 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a29">MouseX</a>();
|
|
00430
|
|
00437 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a30">MouseY</a>();
|
|
00438
|
|
00445 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a31">LButtonPressed</a>();
|
|
00446
|
|
00453 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a32">RButtonPressed</a>();
|
|
00454
|
|
00462 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a33">MouseInRect</a>(SDL_Rect *rect);
|
|
00463
|
|
00469 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a34">CheckEvents</a>();
|
|
00470
|
|
00481 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a35">SetEventFilter</a>(SDL_EventFilter filter);
|
|
00482
|
|
00483 <span class="preprocessor">#ifdef USE_PHYSFS</span>
|
|
00484 <span class="preprocessor"></span>
|
|
00485 <span class="comment">//Physfs Utilities//</span>
|
|
00487 <span class="comment"></span>
|
|
00493 <span class="comment"></span> <span class="keywordtype">void</span> InitPhysFS(string argv);
|
|
00494
|
|
00501 <span class="keywordtype">void</span> AddPhysFSDir(string dir);
|
|
00502
|
|
00503 <span class="preprocessor">#endif //USE_PHYSFS</span>
|
|
00504 <span class="preprocessor"></span>
|
|
00506 <span class="comment">//Error Logging//</span>
|
|
00508 <span class="comment"> private:</span>
|
|
00516 <span class="comment"></span> <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);
|
|
00517
|
|
00518 <span class="keyword">public</span>:
|
|
00529 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a36">SetErrorLog</a>(<span class="keywordtype">bool</span> logAll, string logFile=<span class="stringliteral">""</span>);
|
|
00530
|
|
00541 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a37">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);
|
|
00542
|
|
00550 <a class="code" href="namespaceZE.html#a20">ZErrorCode</a> <a class="code" href="classZE_1_1ZEngine.html#a38">GetLastError</a>();
|
|
00551
|
|
00559 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a39">WriteLog</a>(string str);
|
|
00560
|
|
00567 <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a40">FlushErrors</a>();
|
|
00568
|
|
00570 <span class="comment">//Random Number Generation//</span>
|
|
00572 <span class="comment"></span>
|
|
00580 <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="classZE_1_1ZEngine.html#a41">SeedRandom</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> seed);
|
|
00581
|
|
00590 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classZE_1_1ZEngine.html#a42">RandLong</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> max);
|
|
00591
|
|
00601 <span class="keywordtype">long</span> <a class="code" href="classZE_1_1ZEngine.html#a42">RandLong</a>(<span class="keywordtype">long</span> min, <span class="keywordtype">long</span> max);
|
|
00602
|
|
00610 <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#a44">RandDouble</a>();
|
|
00611
|
|
00621 <span class="keywordtype">double</span> <a class="code" href="classZE_1_1ZEngine.html#a44">RandDouble</a>(<span class="keywordtype">double</span> min, <span class="keywordtype">double</span> max);
|
|
00622
|
|
00624 <span class="comment">//Data Loading + Unloading//</span>
|
|
00626 <span class="comment"></span>
|
|
00633 <span class="comment"></span> SDL_Surface* <a class="code" href="classZE_1_1ZEngine.html#a46">LoadImage</a>(string filename);
|
|
00634
|
|
00635 <span class="preprocessor">#ifdef USE_SDL_MIXER</span>
|
|
00636 <span class="preprocessor"></span>
|
|
00643 Mix_Chunk* <a class="code" href="classZE_1_1ZEngine.html#a47">LoadSound</a>(string filename);
|
|
00644
|
|
00652 Mix_Music* <a class="code" href="classZE_1_1ZEngine.html#a48">LoadMusic</a>(string filename);
|
|
00653 <span class="preprocessor">#endif</span>
|
|
00654 <span class="preprocessor"></span>
|
|
00655 <span class="preprocessor">#ifdef USE_SDL_TTF</span>
|
|
00656 <span class="preprocessor"></span>
|
|
00664 TTF_Font* <a class="code" href="classZE_1_1ZEngine.html#a49">LoadFont</a>(string filename, <span class="keywordtype">int</span> size);
|
|
00665 <span class="preprocessor">#endif </span>
|
|
00666 <span class="preprocessor"></span>
|
|
00668 <span class="comment">//Accessors//</span>
|
|
00670 <span class="comment"></span>
|
|
00677 <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a50">Width</a>();
|
|
00678
|
|
00685 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a51">Height</a>();
|
|
00686
|
|
00693 <span class="keywordtype">int</span> <a class="code" href="classZE_1_1ZEngine.html#a52">BPP</a>();
|
|
00694
|
|
00701 <span class="keywordtype">bool</span> <a class="code" href="classZE_1_1ZEngine.html#a53">IsFullscreen</a>();
|
|
00702 };
|
|
00703
|
|
00704 }
|
|
00705
|
|
00706 <span class="preprocessor">#endif //__ze_zengine_h__</span>
|
|
</pre></div><hr><address style="align: right;"><small>Generated on Sun Apr 27 17:49:38 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>
|