# HG changeset patch # User zzzzrrr@zzzzrrr-desktop # Date 1238449494 14400 # Node ID 55eb66672c031bb00b6f91de84fcef74390c1cdb # Parent 1cd0d4c7258eee455140e24e770f4ea723df5dc8 added ldc build file diff -r 1cd0d4c7258e -r 55eb66672c03 build-dmd.sh --- a/build-dmd.sh Mon Mar 30 16:16:58 2009 -0400 +++ b/build-dmd.sh Mon Mar 30 17:44:54 2009 -0400 @@ -1,3 +1,3 @@ #!/bin/bash clear -rebuild -I.. -I../blaze/ -I../xf/ext -L-lz -inline -O -release main.d +rebuild -I.. -I../blaze/ -I../xf/ext -L-lz -inline -O -release openmelee.d diff -r 1cd0d4c7258e -r 55eb66672c03 build-ldc.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build-ldc.sh Mon Mar 30 17:44:54 2009 -0400 @@ -0,0 +1,3 @@ +#!/bin/bash +clear +rebuild -dc=ldc-posix-tango -I.. -I../blaze/ -L-lz -inline -O -release openmelee.d diff -r 1cd0d4c7258e -r 55eb66672c03 melee/contactListener.d --- a/melee/contactListener.d Mon Mar 30 16:16:58 2009 -0400 +++ b/melee/contactListener.d Mon Mar 30 17:44:54 2009 -0400 @@ -1,7 +1,7 @@ /* * Copyright (c) 2009, Mason Green (zzzzrrr) * Based on Box2D by Erin Catto, http://www.box2d.org - * + * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -43,8 +43,8 @@ e_contactAdded, e_contactPersisted, e_contactRemoved -} -*/ +} +*/ // bzWorld contact callback class ContactListener : bzContactListener diff -r 1cd0d4c7258e -r 55eb66672c03 melee/melee.d --- a/melee/melee.d Mon Mar 30 16:16:58 2009 -0400 +++ b/melee/melee.d Mon Mar 30 17:44:54 2009 -0400 @@ -1,7 +1,7 @@ /* * Copyright (c) 2009, Mason Green (zzzzrrr) * http://www.dsource.org/projects/openmelee - * + * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -41,12 +41,17 @@ import blaze.common.bzMath : bzVec2; import blaze.bzWorld : bzWorld; import blaze.collision.bzCollision : bzAABB; +import blaze.collision.shapes.bzShape : bzShape; +import blaze.dynamics.bzBody : bzBody; +import blaze.dynamics.contact.bzContact : bzContactPoint; +import blaze.collision.bzCollision : bzContactID; -import openmelee.melee.boundaryListener; -import openmelee.melee.contactListener; +import openmelee.melee.boundaryListener : BoundaryListener; +import openmelee.melee.contactListener : ContactListener; import openmelee.render.render; import openmelee.ai.ai : AI; import openmelee.ai.human : Human; +import openmelee.ships.ship : Ship; import openmelee.ships.urQuan : UrQuan; import openmelee.ships.orz : Orz; import openmelee.ships.planet : Planet; @@ -91,76 +96,76 @@ } class Melee { - + ObjectList objectList; Settings settings; float timeStep; const bzVec2 gravity = bzVec2(0.0f, 0.0f); bool allowSleep; Render render; - + AI ai; Human human; - + Ship ship1; Ship ship2; Ship planet; - + bool running; - + StopWatch timer; bzAABB worldAABB; bzWorld world; - bzBoundaryListener m_boundaryListener; - bzContactListener m_contactListener; + BoundaryListener m_boundaryListener; + ContactListener m_contactListener; ContactPoint[k_maxContactPoints] points; int pointCount; - + this() { timeStep = settings.hz > 0.0f ? 1.0f / settings.hz : 0.0f; objectList = new ObjectList; m_boundaryListener = new BoundaryListener(this); - - + + initWorld(); running = true; - + human = new Human(ship1, this); ai = new AI(ship2, objectList); - + render = new Render(world, ship1, ship2, human, settings); - + objectList.add(planet); objectList.add(ship1); objectList.add(ship2); } - + void run() { // Main game loop while (running && !human.quit && render.running) { - + float delta = timer.stop; timer.start; - + // Update AI ai.move(ship1); // Update Physics world.step(timeStep, settings.velocityIterations, settings.positionIterations); // Update screen render.update(); - + // Limit velocities foreach(o; objectList) { o.limitVelocity(); o.updateState(); } - + // Apply thrust if(human.thrust && ship1) { ship1.thrust(); } } - + delete render; } @@ -179,11 +184,11 @@ objectList.add(asteroid); } } - + void boundaryViolated(bzBody rBody) { float x,y; - + if(rBody.position.x > worldAABB.upperBound.x) { x = worldAABB.lowerBound.x + 5; rBody.position = bzVec2(x, rBody.position.y); @@ -196,6 +201,6 @@ } else if(rBody.position.y < worldAABB.lowerBound.y) { y = worldAABB.upperBound.y - 5; rBody.position = bzVec2(rBody.position.x, y); - } + } } }