Skip to content

Commit

Permalink
Fixed up lots of Android by replacing "MONODROID" with "ANDROID"
Browse files Browse the repository at this point in the history
Removed lots of dead code for old platforms.
  • Loading branch information
vchelaru committed Apr 6, 2024
1 parent 72e9992 commit 87ea9cc
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 74 deletions.
21 changes: 2 additions & 19 deletions Engines/FlatRedBallXNA/FlatRedBall/Audio/AudioManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static float? MasterSongVolume
static SongPlaylist Playlist;

static int playlistIndex = 0;
#if MONODROID
#if ANDROID
//This is for a performance issue with SoundPool
private static SoundEffect _droidLoop;
private static DateTime _lastPlay = DateTime.Now;
Expand Down Expand Up @@ -623,7 +623,7 @@ public static void Play(SoundEffect soundEffect, float volume, float pitch = 0,

if (shouldPlay)
{
#if MONODROID
#if ANDROID
_lastPlay = DateTime.Now;
#endif

Expand Down Expand Up @@ -765,23 +765,6 @@ public static void Update()
TimeManager.LastSecondDifference);
}
#endif

// TODO [msmith] Get this working again once we add the data into the asset folder.
/* TODO MDS_TEMP
#if MONODROID
if ((DateTime.Now - _lastPlay).Milliseconds > 200)
{
if (_droidLoop != null)
{
_droidLoop.Play(0, 0, 0);
_lastPlay = DateTime.Now;
}else
{
_droidLoop = FlatRedBallServices.Load<SoundEffect>(@"performanceloop");
}
}
#endif
*/
}


Expand Down
2 changes: 0 additions & 2 deletions Engines/FlatRedBallXNA/FlatRedBall/Content/Saves/TextSave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ public Text ToText(string contentManagerName)

text.CursorSelectable = CursorSelectable;

#if !SILVERLIGHT

#if !MONODROID
if (this.mFontTextureInstance != null)
Expand Down Expand Up @@ -175,7 +174,6 @@ public Text ToText(string contentManagerName)
{
text.Font = TextManager.DefaultFont;
}
#endif


//sprite.Alpha = (255 - Fade) / valueToDivideBy;
Expand Down
11 changes: 3 additions & 8 deletions Engines/FlatRedBallXNA/FlatRedBall/Content/Scene/SpriteSave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ private static int AsInt(System.Xml.Linq.XElement subElement)

#region Fields

#if !MONODROID
[ExternalInstance]
internal Texture2D mTextureInstance;

[ExternalInstance]
internal AnimationChainList mAnimationChainListInstance;
#endif


[XmlIgnore]
public AnimationChainListSave AnimationChains;
Expand Down Expand Up @@ -464,14 +463,12 @@ public void SetSprite(string contentManagerName, Sprite sprite, bool setTextures
// overrides it if it's different.
if (setTextures)
{
#if !MONODROID
if (mTextureInstance != null)
{
sprite.Texture = mTextureInstance;
}

else
#endif
// Sprites can have NULL textures as of April 18, 2009
if (!string.IsNullOrEmpty(Texture))
{
Expand Down Expand Up @@ -522,11 +519,9 @@ public void SetSprite(string contentManagerName, Sprite sprite, bool setTextures
if (setTextures)
{
SetRuntimeAnimationChain(contentManagerName, sprite,
#if !MONODROID

mAnimationChainListInstance,
#else
null,
#endif

CurrentChain,
AnimationChains, AnimationChainsFile

Expand Down
7 changes: 1 addition & 6 deletions Engines/FlatRedBallXNA/FlatRedBall/FlatRedBallServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ private static void PreInitialization(Game game, GraphicsDeviceManager graphics)

}
}
#if !MONODROID
public static void InitializeCommandLine()
{
InitializeCommandLine(null);
Expand All @@ -440,11 +439,8 @@ public static void InitializeCommandLine()
#endregion
public static void InitializeCommandLine(Game game)
{
#if UWP
mPrimaryThreadId = Environment.CurrentManagedThreadId;
#else

mPrimaryThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;
#endif


mIsCommandLine = true;
Expand Down Expand Up @@ -478,7 +474,6 @@ public static void InitializeCommandLine(Game game)

mIsInitialized = true;
}
#endif

#region XML Docs
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public GraphicsOptions(Game game, GraphicsDeviceManager graphics)
if (game != null)
{

#if IOS || UWP || DESKTOP_GL
#if IOS || DESKTOP_GL
// For UWP and WindowsGL projects the game.Window.ClientBounds is not accurate until after initialize, as explained here:
// http://community.monogame.net/t/graphicsdevice-viewport-doesnt-return-the-real-size-of-uwp-game-window/7314/5
ResolutionWidth = graphics.PreferredBackBufferWidth;
Expand Down
8 changes: 1 addition & 7 deletions Engines/FlatRedBallXNA/FlatRedBall/Graphics/Renderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#if MONODROID
using OpenTK.Graphics.ES11;
#endif

using ShapeManager = FlatRedBall.Math.Geometry.ShapeManager;
using FlatRedBall.Math;
using FlatRedBall.Graphics;
Expand All @@ -29,11 +27,7 @@
using FlatRedBall.Math.Geometry;
using FlatRedBall.Performance.Measurement;

#if UWP
using Windows.System.Threading;
#else

#endif


namespace FlatRedBall.Graphics
Expand Down
4 changes: 4 additions & 0 deletions Engines/FlatRedBallXNA/FlatRedBall/Gui/Cursor.TouchScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ private bool TryHandleCursorPositionSetByTouchScreen()

private void GetPushDownClickFromTouchScreen()
{
if(InputManager.TouchScreen.ScreenDown)
{
int m = 3;
}
PrimaryClick |= InputManager.TouchScreen.ScreenReleased && ignoreNextFrameInput == false;
PrimaryPush |= InputManager.TouchScreen.ScreenPushed;

Expand Down
12 changes: 5 additions & 7 deletions Engines/FlatRedBallXNA/FlatRedBall/Gui/Cursor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ public IStaticPositionable ObjectGrabbed
/// <param name="cameraToUse">The camera that the cursor will belong to.</param>
public Cursor(Camera cameraToUse)
{
#if MONODROID || IOS
#if ANDROID || IOS
SupportedInputDevices = Gui.InputDevice.TouchScreen;
#else
SupportedInputDevices = Gui.InputDevice.Mouse;
Expand Down Expand Up @@ -1792,7 +1792,6 @@ public bool IsOn3D(ShapeCollection shapeCollection, Layer layer)

#endregion

#if !SILVERLIGHT

#region XML Docs
/// <summary>
Expand All @@ -1806,7 +1805,7 @@ public bool IsInWindow()
}


#if !MONODROID && !MONOGAME && !FNA
#if !MONOGAME && !FNA
public bool IsInWindow(System.Windows.Forms.Control control)
{
if (!mUsingWindowsCursor)
Expand Down Expand Up @@ -1961,7 +1960,6 @@ public void UpdateObjectGrabbedPosition(Layer layer, int xOffset = 0, int yOffse

}

#endif
/// <summary>
/// Returns the X world coordinate of the cursor at the argument Z position.
/// This method requires a Z value to properly work with perspective cameras.
Expand Down Expand Up @@ -2056,7 +2054,7 @@ public float WorldXChangeAt(float zPosition, Layer layer)

float WorldXChangeAt(float zPosition, bool orthogonal, float orthogonalWidth)
{
#if MONODROID || IOS
#if ANDROID || IOS
if(PrimaryPush || InputManager.TouchScreen.NumberOfTouchesChanged)
{
return 0;
Expand Down Expand Up @@ -2142,7 +2140,7 @@ public float WorldYChangeAt(float zPosition, Layer layer)

float WorldYChangeAt(float zPosition, bool orthogonal, float orthogonalHeight)
{
#if MONODROID || IOS
#if ANDROID || IOS
if (PrimaryPush || InputManager.TouchScreen.NumberOfTouchesChanged)
{
return 0;
Expand Down Expand Up @@ -2522,7 +2520,7 @@ public bool UpdateValuesFromMouse()
{
UpdatePositionToMouse();

#if MONODROID || IOS
#if ANDROID || IOS
float xVelocity;
float yVelocity;
MathFunctions.ScreenToAbsoluteDistance(
Expand Down
2 changes: 0 additions & 2 deletions Engines/FlatRedBallXNA/FlatRedBall/Gui/GuiManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -489,15 +489,13 @@ static public void ElementActivity()
}
}

#if !MONODROID
static public Cursor GetCursorNum(int index)
{
if (index > -1 && index < mCursors.Count)
return mCursors[index];
else
return null;
}
#endif


[Obsolete("Use AddDominantWindow instead, even if the window has already been added. This method will go away soon")]
Expand Down
4 changes: 2 additions & 2 deletions Engines/FlatRedBallXNA/FlatRedBall/IO/Csv/CsvReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using System.Collections;
using System.Collections.Generic;

#if !WINDOWS_PHONE && !XBOX360 && !MONODROID && !MONOGAME
#if !MONOGAME
using System.Data;

#endif
Expand All @@ -34,7 +34,7 @@
using System.IO;


#if !MONODROID && !MONOGAME
#if !MONOGAME
using System.Data.Common;
#endif

Expand Down
17 changes: 5 additions & 12 deletions Engines/FlatRedBallXNA/FlatRedBall/IO/FileManager.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#if WINDOWS_8 || MONODROID || UWP
#if ANDROID || IOS
#define USE_ISOLATED_STORAGE
#endif

#if MONODROID || IOS || UWP || ANDROID
#if IOS || ANDROID
#define USES_DOT_SLASH_ABOLUTE_FILES
#endif

Expand Down Expand Up @@ -470,7 +470,7 @@ public static bool FileExists(string fileName)
{
stream = TitleContainer.OpenStream(fileName);
}
#if MONODROID || ANDROID
#if ANDROID
catch (Java.IO.FileNotFoundException)
{
return false;
Expand Down Expand Up @@ -1363,14 +1363,9 @@ public static void ThrowExceptionIfFileDoesntExist(string fileName)
}
else
{
#if MONODROID

throw new FileNotFoundException("Could not find the " +
"file " + fileName + " or the directory " + directory);
#else
throw new FileNotFoundException("Could not find the " +
"file " + fileName + " or the directory " + directory, fileName);
#endif
}

#endif
Expand Down Expand Up @@ -1618,19 +1613,17 @@ public static string Standardize(string fileNameToFix, string relativePath, bool
//#endif
}

#if !XBOX360
fileNameToFix = RemoveDotDotSlash(fileNameToFix);

if (fileNameToFix.StartsWith("..") && makeAbsolute)
{
throw new InvalidOperationException("Tried to remove all ../ but ended up with this: " + fileNameToFix);
}

#endif
// It's possible that there will be double forward slashes.
fileNameToFix = fileNameToFix.Replace("//", "/");

#if !MONODROID && !IOS
#if !ANDROID && !IOS
if (!PreserveCase)
{
fileNameToFix = fileNameToFix.ToLowerInvariant();
Expand Down Expand Up @@ -1743,7 +1736,7 @@ public static T XmlDeserialize<T>(string fileName)
{
T objectToReturn = default(T);

#if MONODROID
#if ANDROID || IOS
if (fileName.Contains(FileManager.IsolatedStoragePrefix) && mHasUserFolderBeenInitialized == false)
{
throw new InvalidOperationException("The user folder hasn't been initialized. Call FileManager.InitializeUserFolder first");
Expand Down
4 changes: 2 additions & 2 deletions Engines/FlatRedBallXNA/FlatRedBall/Input/InputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public static void CheckControllerConnectionChange()
{
int padNumber;

#if !MONODROID
#if !ANDROID
padNumber = 4;
#else
padNumber = 1;
Expand Down Expand Up @@ -480,7 +480,7 @@ private static void PerformGamePadUpdate()
#if SUPPORTS_XBOX_GAMEPADS

mXbox360GamePads[0].Update();
#if !MONODROID
#if !ANDROID
mXbox360GamePads[1].Update();
mXbox360GamePads[2].Update();
mXbox360GamePads[3].Update();
Expand Down
Loading

0 comments on commit 87ea9cc

Please sign in to comment.