00001 /*--License: 00002 Kyra Sprite Engine 00003 Copyright Lee Thomason (Grinning Lizard Software) 2001-2002 00004 www.grinninglizard.com/kyra 00005 www.sourceforge.net/projects/kyra 00006 00007 Kyra is provided under 2 licenses: 00008 00009 - The GPL, with no additional restrictions. 00010 - The LGPL, provided you display the Kyra splash screen, described below. 00011 00012 00013 --- GPL License -- 00014 This program is free software; you can redistribute it and/or 00015 modify it under the terms of the GNU General Public License 00016 as published by the Free Software Foundation; either version 2 00017 of the License, or (at your option) any later version. 00018 00019 This program is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 GNU General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License 00025 along with this program; if not, write to the Free Software 00026 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00027 00028 The full text of the license can be found in license.txt 00029 00030 00031 --- LGPL License -- 00032 **Provided you kindly display the Kyra splash screen (details below), 00033 you may use the LGPL license:** 00034 00035 This library is free software; you can redistribute it and/or 00036 modify it under the terms of the GNU Lesser General Public 00037 License as published by the Free Software Foundation; either 00038 version 2.1 of the License, or (at your option) any later version. 00039 00040 This library is distributed in the hope that it will be useful, 00041 but WITHOUT ANY WARRANTY; without even the implied warranty of 00042 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00043 Lesser General Public License for more details. 00044 00045 You should have received a copy of the GNU Lesser General Public 00046 License along with this library; if not, write to the Free Software 00047 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00048 00049 The full text of the license can be found in lgpl.txt 00050 00051 00052 --- Kyra Splash Screen. 00053 00054 It would be appreciate if you display the Kyra splash screen when using 00055 either license, however it is only required for the LGPL. All the 00056 resources for the splash are compiled into the library, and it can be 00057 accessed through the following API: 00058 00059 KrEngine::StartSplash 00060 KrEngine::UpdateSplash 00061 KrEngine::EndSplash 00062 00063 Full documentation is provided with the KrEngine class. The splash screen 00064 should be displayed for 2 seconds. 00065 00066 Thank you. 00067 */ 00068 00069 #ifndef ISOMATH_INCLUDED 00070 #define ISOMATH_INCLUDED 00071 00072 #include "gldebug.h" 00073 00074 /* 00075 "Front" View, screen 00076 00077 00078 ViewY 00079 offset | 00080 +----------------> ScreenX 00081 | | | 00082 | | | 00083 | | | 00084 |---------------- 00085 v | 00086 SceenY | 00087 | 00088 ---------+------------> ViewX 00089 Oview 00090 00091 The offset (screen offset) is measured in view coordinates 00092 from the view origin to the offset point. 00093 00094 00095 "Side" View, word 00096 00097 WorldZ 00098 | 00099 | 00100 | ViewY 00101 | / 00102 | / 00103 | / 00104 | / 00105 | / 00106 |/ 00107 +---------------------WorldY 00108 |\_ 00109 | \_ 00110 | \_ ViewZ 00111 00112 00113 "Top" View, Map (Should be right angles) 00114 00115 WorldY 00116 /|\ 00117 / | \ 00118 / | \ 00119 MapY \ | /Mapx 00120 \ | / 00121 \|/ 00122 ---------------------- WorldX 00123 */ 00124 00125 #include "gltypes.h" 00126 #include "glfixed.h" 00127 00128 00154 class GlIsoMath 00155 { 00156 public: 00159 static void TileToScreen( GlFixed tileX, GlFixed tileY, GlFixed tileZ, 00160 int tileWidth, int tileHeight, 00161 int screenOffsetX, int screenOffsetY, 00162 GlFixed* screenX, GlFixed* screenY ); 00163 00167 static void ScreenToFlatTile( GlFixed screenX, GlFixed screenY, GlFixed tileZ, 00168 int tileWidth, int tileHeight, 00169 int screenOffsetX, int screenOffsetY, 00170 GlFixed* tileX, GlFixed* tileY ); 00171 00175 static void TileToWorld( GlFixed tileX, GlFixed tileY, GlFixed tileZ, 00176 GlFixed* worldX, GlFixed* worldY, GlFixed* worldZ ); 00177 00178 // /** Tile to view. 00179 // */ 00180 // static void TileToView( GlFixed tileX, GlFixed tileY, GlFixed tileZ, 00181 // int tileWidth, int tileHeight, 00182 // int* viewX, int* viewY, int* viewZ ); 00183 // 00184 00188 GlIsoMath( int tileWidth, int tileHeight ); 00189 00193 void SetScreenBaseToOrigin( int screenW, int screenH ); 00194 00196 void SetScreenCenterToTile( int screenW, int screenH, 00197 int tileX, int tileY, int tileZ ); 00198 00200 void SetScreenToTile( int screenX, int screenY, 00201 int tileX, int tileY, int tileZ ); 00202 00204 void TileToScreen( GlFixed tileX, GlFixed tileY, GlFixed tileZ, 00205 int* screenX, int* screenY ) const; 00206 00210 void ScreenToFlatTile( int screenX, int screenY, GlFixed tileZ, 00211 GlFixed* tileX, GlFixed* tileY ) const; 00212 00213 private: 00214 int tileWidth, tileHeight; 00215 int screenOffsetX, screenOffsetY; 00216 }; 00217 00218 #endif