AxiosEngine-old 

AxiosEngine-old Commit Details


Date:2012-03-20 21:44:00 (12 years 9 months ago)
Author:nathan@daedalus
Branch:default
Commit:295db41d9790
Parents: 007bf2a6fc8b
Message:Taking out hard coded debug statements

Adding field to allow/disallow automated mouse joints
Changes:
Maxios/Engine/SimpleAxiosGameObject.cs (1 diff)
Maxios/ScreenSystem/PhysicsGameScreen.cs (8 diffs)

File differences

axios/Engine/SimpleAxiosGameObject.cs
1818
1919
2020
21
22
23
24
25
26
27
2128
2229
2330
public bool ApplyConstantVelocity = false;
public Vector2 ConstantVelocity;
private bool _allowmousejoint = false;
public bool AllowAutomaticMouseJoint
{
get { return _allowmousejoint; }
set { _allowmousejoint = value; }
}
public SimpleAxiosGameObject()
{
AxiosLog.Instance.AddLine("[Axios Engine] - Creating SimpleAxiosGameObject " + Name, LoggingFlag.DEBUG);
axios/ScreenSystem/PhysicsGameScreen.cs
66
77
88
9
910
1011
1112
......
1718
1819
1920
20
2121
22
2322
2423
2524
2625
2726
2827
28
29
2930
30
31
32
33
34
3135
3236
3337
......
157161
158162
159163
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
164
175165
176166
177167
......
182172
183173
184174
185
186175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
187192
188193
189194
190195
191196
192
193197
194198
195199
......
197201
198202
199203
200
204
201205
202206
203207
......
219223
220224
221225
222
226
223227
224228
225229
226230
227231
228232
229
233
230234
231235
232236
......
259263
260264
261265
262
266
263267
264268
265269
266270
267
271
268272
269273
270274
......
304308
305309
306310
307
311
308312
309313
310314
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Input;
using Axios.Engine;
namespace FarseerPhysics.SamplesFramework
{
private float _agentForce;
private float _agentTorque;
#if DEBUG
private FixedMouseJoint _fixedMouseJoint;
#endif
private Body _userAgent;
protected PhysicsGameScreen()
{
TransitionOnTime = TimeSpan.FromSeconds(0.75);
TransitionOffTime = TimeSpan.FromSeconds(0.75);
#if DEBUG
EnableCameraControl = true;
HasCursor = true;
EnableCameraControl = true;
#else
EnableCameraControl = false;
HasCursor = false;
#endif
_userAgent = null;
World = null;
Camera = null;
EnableOrDisableFlag(DebugViewFlags.AABB);
}
if (input.IsNewButtonPress(Buttons.Back) || input.IsNewKeyPress(Keys.Escape))
{
if (this.ScreenState == SamplesFramework.ScreenState.Active && this.TransitionPosition == 0 && this.TransitionAlpha == 1)
{ //Give the screens a chance to transition
CleanUp();
ExitScreen();
}
}
if (HasCursor)
{
HandleCursor(input);
}
#endif
if (_userAgent != null)
{
{
HandleCamera(input, gameTime);
}
#endif
if (HasCursor)
{
HandleCursor(input);
}
if (input.IsNewButtonPress(Buttons.Back) || input.IsNewKeyPress(Keys.Escape))
{
if (this.ScreenState == SamplesFramework.ScreenState.Active && this.TransitionPosition == 0 && this.TransitionAlpha == 1)
{ //Give the screens a chance to transition
CleanUp();
ExitScreen();
}
}
base.HandleInput(input, gameTime);
}
public virtual void HandleCursor(InputHelper input)
{
#if DEBUG
Vector2 position = Camera.ConvertScreenToWorld(input.Cursor);
if ((input.IsNewButtonPress(Buttons.A) ||
_fixedMouseJoint == null)
{
Fixture savedFixture = World.TestPoint(position);
if (savedFixture != null)
if (savedFixture != null && savedFixture.UserData is SimpleAxiosGameObject && ((SimpleAxiosGameObject)(savedFixture.UserData)).AllowAutomaticMouseJoint)
{
Body body = savedFixture.Body;
_fixedMouseJoint = new FixedMouseJoint(body, position);
{
_fixedMouseJoint.WorldAnchorB = position;
}
#endif
}
private void HandleCamera(InputHelper input, GameTime gameTime)
{
Vector2 camMove = Vector2.Zero;
#if DEBUG
if (input.KeyboardState.IsKeyDown(Keys.Up))
{
camMove.Y -= 10f * (float)gameTime.ElapsedGameTime.TotalSeconds;
{
Camera.ResetCamera();
}
#endif
}
private void HandleUserAgent(InputHelper input)
{
#if DEBUG
Vector2 force = _agentForce * new Vector2(input.GamePadState.ThumbSticks.Right.X,
-input.GamePadState.ThumbSticks.Right.Y);
float torque = _agentTorque * (input.GamePadState.Triggers.Right - input.GamePadState.Triggers.Left);
_userAgent.ApplyForce(force);
_userAgent.ApplyTorque(torque);
#endif
}
private void EnableOrDisableFlag(DebugViewFlags flag)

Archive Download the corresponding diff file

Page rendered in 0.41369s using 13 queries.