axiosengine 

axiosengine Commit Details


Date:2012-03-20 21:44:43 (12 years 6 months ago)
Author:nathan@daedalus
Branch:master
Commit:0c2172e2b2686b33e283e562064d804972213175
Parents: 4755ff6b871df3d14245cc5427cacbe26626d41b
Message:Taking out hard coded debug statements Adding field to allow/disallow automated mouse joints

Changes:

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
29
28
3029
30
31
32
33
34
3135
3236
3337
......
157161
158162
159163
160
164
165
166
161167
162
163
168
169
164170
165
166
167
168
171
172
173
169174
170175
176
171177
172178
173179
174180
175181
176
182
177183
178
179
184
185
180186
181
182
183
184
185
187
188
186189
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);
HasCursor = true;
#if DEBUG
EnableCameraControl = true;
HasCursor = 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))
#endif
if (_userAgent != null)
{
if (this.ScreenState == SamplesFramework.ScreenState.Active && this.TransitionPosition == 0 && this.TransitionAlpha == 1)
{ //Give the screens a chance to transition
HandleUserAgent(input);
}
CleanUp();
ExitScreen();
}
if (EnableCameraControl)
{
HandleCamera(input, gameTime);
}
if (HasCursor)
{
HandleCursor(input);
}
if (_userAgent != null)
if (input.IsNewButtonPress(Buttons.Back) || input.IsNewKeyPress(Keys.Escape))
{
HandleUserAgent(input);
}
if (this.ScreenState == SamplesFramework.ScreenState.Active && this.TransitionPosition == 0 && this.TransitionAlpha == 1)
{ //Give the screens a chance to transition
if (EnableCameraControl)
{
HandleCamera(input, gameTime);
}
#endif
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

Branches

Number of commits:
Page rendered in 0.06998s using 13 queries.