Mercurial > projects > openmelee
comparison melee.d @ 2:a40d066ebbd1
implemented zoom
author | Zzzzrrr <mason.green@gmail.com> |
---|---|
date | Fri, 20 Mar 2009 11:03:51 -0400 |
parents | c10bc63824e7 |
children | 8d7c50415269 |
comparison
equal
deleted
inserted
replaced
1:8ee020a019e0 | 2:a40d066ebbd1 |
---|---|
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | 25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 module melee.melee; | 30 module openmelee.melee; |
31 | 31 |
32 import Integer = tango.text.convert.Integer; | 32 import Integer = tango.text.convert.Integer; |
33 import tango.math.Math; | 33 import tango.math.Math; |
34 import tango.math.random.Kiss; | 34 import tango.math.random.Kiss; |
35 | 35 |
37 import xf.input.KeySym; | 37 import xf.input.KeySym; |
38 import xf.omg.core.LinearAlgebra; | 38 import xf.omg.core.LinearAlgebra; |
39 | 39 |
40 public import blaze.all; | 40 public import blaze.all; |
41 | 41 |
42 import melee.boundaryListener; | 42 import openmelee.boundaryListener; |
43 import melee.contactListener; | 43 import openmelee.contactListener; |
44 import melee.ship; | 44 import openmelee.ship; |
45 import melee.urQuan; | 45 import openmelee.urQuan; |
46 import melee.orz; | 46 import openmelee.orz; |
47 | 47 |
48 // Cursor scale factor | 48 // Cursor scale factor |
49 const CURSORSIZE = 0.05f; | 49 const CURSORSIZE = 0.05f; |
50 | 50 |
51 const INIT_SPAWN_SIZE = 0.5f; | 51 const INIT_SPAWN_SIZE = 0.5f; |
86 ContactState state; | 86 ContactState state; |
87 } | 87 } |
88 | 88 |
89 // Melee settings. Some can be controlled in the GUI. | 89 // Melee settings. Some can be controlled in the GUI. |
90 struct Settings { | 90 struct Settings { |
91 float hz = 60; | 91 float hz = 120; |
92 int velocityIterations = 8; | 92 int velocityIterations = 8; |
93 int positionIterations = 2; | 93 int positionIterations = 2; |
94 bool drawShapes = true; | 94 bool drawShapes = true; |
95 bool drawJoints = true; | 95 bool drawJoints = true; |
96 bool drawControllers; | 96 bool drawControllers; |
97 bool drawCoreShapes; | 97 bool drawCoreShapes; |
98 bool drawAABBs; | 98 bool drawAABBs = true; |
99 bool drawOBBs; | 99 bool drawOBBs; |
100 bool drawPairs; | 100 bool drawPairs; |
101 bool drawContactPoints; | 101 bool drawContactPoints; |
102 bool drawContactNormals; | 102 bool drawContactNormals; |
103 bool drawContactForces; | 103 bool drawContactForces; |
166 m_contactListener = new ContactListener(this); | 166 m_contactListener = new ContactListener(this); |
167 } | 167 } |
168 | 168 |
169 void init() { | 169 void init() { |
170 // Define world boundaries | 170 // Define world boundaries |
171 bzAABB worldAABB; | 171 worldAABB.lowerBound.set(-75.0f, -75.0f); |
172 worldAABB.lowerBound.set(-200.0f, -100.0f); | 172 worldAABB.upperBound.set(75.0f, 75.0f); |
173 worldAABB.upperBound.set(200.0f, 200.0f); | |
174 world = new bzWorld(worldAABB, gravity, allowSleep); | 173 world = new bzWorld(worldAABB, gravity, allowSleep); |
175 world.boundaryListener = m_boundaryListener; | 174 world.boundaryListener = m_boundaryListener; |
176 world.contactListener = m_contactListener; | 175 world.contactListener = m_contactListener; |
177 viewCenter = vec2(10, 10); | 176 viewCenter = vec2(10, 10); |
178 ship1 = new Orz(world); | 177 ship1 = new Orz(world); |
266 } | 265 } |
267 | 266 |
268 void boundaryViolated(bzBody rBody) | 267 void boundaryViolated(bzBody rBody) |
269 { | 268 { |
270 uint key = rBody.toHash(); | 269 uint key = rBody.toHash(); |
271 killList[key] = rBody; | 270 wrapList[key] = rBody; |
272 } | 271 } |
273 | 272 |
274 bool quit; | 273 bool quit; |
275 | 274 |
276 // Ortho view zoom | 275 // Ortho view zoom |
277 float zoom = 40; | 276 float zoom = 40; |
278 int pointCount; | 277 int pointCount; |
279 vec2 viewCenter; | 278 vec2 viewCenter; |
280 bzBody[uint] killList; | 279 bzBody[uint] wrapList; |
281 | 280 |
282 bzWorld world; | 281 bzWorld world; |
283 Settings *settings; | 282 Settings *settings; |
284 | 283 |
285 // bzWorld boundary listener. Destroy bodies that leave world bzAABB | 284 // bzWorld boundary listener. Destroy bodies that leave world bzAABB |
287 bzContactListener m_contactListener; | 286 bzContactListener m_contactListener; |
288 ContactPoint[k_maxContactPoints] points; | 287 ContactPoint[k_maxContactPoints] points; |
289 | 288 |
290 ConfigChange!(vec2) editChange; | 289 ConfigChange!(vec2) editChange; |
291 bool thrust; | 290 bool thrust; |
292 | 291 bzAABB worldAABB; |
292 | |
293 Ship ship1; | 293 Ship ship1; |
294 Ship ship2; | 294 Ship ship2; |
295 } | 295 } |
296 | 296 |
297 // Utility functions | 297 // Utility functions |