commit 91d000ac4bd8f7310d9612158fbd3707da7da73c Author: Robin Hübner Date: Sat Nov 11 01:21:16 2017 +0100 initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac54e60 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# vim swapfiles +.*.s?? + +# user specific files +*.userprefs + +# build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ diff --git a/TestyMono.sln b/TestyMono.sln new file mode 100644 index 0000000..5d34c31 --- /dev/null +++ b/TestyMono.sln @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestyMono", "TestyMono\TestyMono.csproj", "{7D5F8921-B087-4A2B-8E70-1BF5805FC23E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7D5F8921-B087-4A2B-8E70-1BF5805FC23E}.Debug|x86.ActiveCfg = Debug|x86 + {7D5F8921-B087-4A2B-8E70-1BF5805FC23E}.Debug|x86.Build.0 = Debug|x86 + {7D5F8921-B087-4A2B-8E70-1BF5805FC23E}.Release|x86.ActiveCfg = Release|x86 + {7D5F8921-B087-4A2B-8E70-1BF5805FC23E}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + Policies = $0 + $0.TextStylePolicy = $1 + $1.FileWidth = 120 + $1.TabsToSpaces = False + $1.EolMarker = Unix + $1.inheritsSet = VisualStudio + $1.inheritsScope = text/plain + $1.scope = text/x-csharp + $0.CSharpFormattingPolicy = $2 + $2.IndentSwitchBody = True + $2.NamespaceBraceStyle = DoNotChange + $2.ClassBraceStyle = EndOfLine + $2.InterfaceBraceStyle = EndOfLine + $2.StructBraceStyle = EndOfLine + $2.EnumBraceStyle = EndOfLine + $2.MethodBraceStyle = EndOfLine + $2.ConstructorBraceStyle = EndOfLine + $2.DestructorBraceStyle = EndOfLine + $2.BeforeMethodDeclarationParentheses = False + $2.BeforeMethodCallParentheses = False + $2.BeforeConstructorDeclarationParentheses = False + $2.NewLineBeforeConstructorInitializerColon = NewLine + $2.NewLineAfterConstructorInitializerColon = SameLine + $2.BeforeDelegateDeclarationParentheses = False + $2.NewParentheses = False + $2.SpacesBeforeBrackets = False + $2.inheritsSet = Mono + $2.inheritsScope = text/x-csharp + $2.scope = text/x-csharp + EndGlobalSection +EndGlobal diff --git a/TestyMono/Content/Content.mgcb b/TestyMono/Content/Content.mgcb new file mode 100644 index 0000000..a14ef62 --- /dev/null +++ b/TestyMono/Content/Content.mgcb @@ -0,0 +1,12 @@ +#----------------------------- Global Properties ----------------------------# + +/outputDir:bin/$(Platform) +/intermediateDir:obj/$(Platform) +/config: +/profile:Reach +/compress:False + +#-------------------------------- References --------------------------------# + + +#---------------------------------- Content ---------------------------------# diff --git a/TestyMono/Game1.cs b/TestyMono/Game1.cs new file mode 100644 index 0000000..ce2c7a2 --- /dev/null +++ b/TestyMono/Game1.cs @@ -0,0 +1,164 @@ +using System; + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace TestyMono +{ + + class Cursor { + + static int CURSOR_SIZE = 8; + + Vector2 position; + static Texture2D texture; + Rectangle dimensions; + + public Cursor() { + position = new Vector2(0, 0); + dimensions = new Rectangle(0, 0, CURSOR_SIZE, CURSOR_SIZE); + } + + public static void LoadContent(GraphicsDeviceManager graphics) { + texture = new Texture2D(graphics.GraphicsDevice, 1, 1); + texture.SetData(new[] { Color.White }); + } + + public void Update(GameTime gameTime) { + var mousePos = Mouse.GetState().Position; + position.X = (float)mousePos.X; + position.Y = (float)mousePos.Y; + dimensions.X = (int)position.X; + dimensions.Y = (int)position.Y; + } + + public void Draw(GameTime gameTime, SpriteBatch batch) { + batch.Draw(texture, dimensions, Color.Gold); + } + + } + + class Player { + + const int MOVEMENT_SPEED = 128; // pixels per second i guess? + + Vector2 position; + Vector2 direction; + Rectangle dimensions; + static Texture2D texture; + + public Player() { + position = new Vector2(0, 0); + direction = new Vector2(0, 0); + dimensions = new Rectangle(0, 0, 32, 32); + } + + public static void LoadContent(GraphicsDeviceManager graphics) { + texture = new Texture2D(graphics.GraphicsDevice, 1, 1); + texture.SetData(new[] { Color.White }); + } + + public void Update(GameTime gameTime) { + var delta = new Vector2(0, 0); + var state = Keyboard.GetState(); + var deltaSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds; + if (state.IsKeyDown(Keys.W)) { + position.Y -= 1 * deltaSeconds * MOVEMENT_SPEED; + } else if (state.IsKeyDown(Keys.S)) { + position.Y += 1 * deltaSeconds * MOVEMENT_SPEED; + } + if (state.IsKeyDown(Keys.A)) { + position.X -= 1 * deltaSeconds * MOVEMENT_SPEED; + } else if (state.IsKeyDown(Keys.D)) { + position.X += 1 * deltaSeconds * MOVEMENT_SPEED; + } + dimensions.X = (int)position.X; + dimensions.Y = (int)position.Y; + } + + public void Draw(GameTime gameTime, SpriteBatch batch) { + batch.Draw(texture, dimensions, Color.Orange); + } + + } + // Player + + /// + /// This is the main type for your game. + /// + public class Game1 : Game { + GraphicsDeviceManager graphics; + SpriteBatch spriteBatch; + + // temp + Cursor cursor; + Player player; + + public Game1() { + graphics = new GraphicsDeviceManager(this); + Content.RootDirectory = "Content"; + player = new Player(); + cursor = new Cursor(); + } + + /// + /// Allows the game to perform any initialization it needs to before starting to run. + /// This is where it can query for any required services and load any non-graphic + /// related content. Calling base.Initialize will enumerate through any components + /// and initialize them as well. + /// + protected override void Initialize() { + // TODO: Add your initialization logic here + base.Initialize(); + } + + /// + /// LoadContent will be called once per game and is the place to load + /// all of your content. + /// + protected override void LoadContent() { + // Create a new SpriteBatch, which can be used to draw textures. + spriteBatch = new SpriteBatch(GraphicsDevice); + Player.LoadContent(graphics); + Cursor.LoadContent(graphics); + //TODO: use this.Content to load your game content here + } + + /// + /// Allows the game to run logic such as updating the world, + /// checking for collisions, gathering input, and playing audio. + /// + /// Provides a snapshot of timing values. + protected override void Update(GameTime gameTime) { + // For Mobile devices, this logic will close the Game when the Back button is pressed + // Exit() is obsolete on iOS +#if !__IOS__ && !__TVOS__ + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) + Exit(); +#endif + + // TODO: Add your update logic here + player.Update(gameTime); + cursor.Update(gameTime); + base.Update(gameTime); + } + + /// + /// This is called when the game should draw itself. + /// + /// Provides a snapshot of timing values. + protected override void Draw(GameTime gameTime) { + graphics.GraphicsDevice.Clear(Color.CornflowerBlue); + + //TODO: Add your drawing code here + + spriteBatch.Begin(); + player.Draw(gameTime, spriteBatch); + cursor.Draw(gameTime, spriteBatch); + spriteBatch.End(); + + base.Draw(gameTime); + } + } +} diff --git a/TestyMono/Icon.ico b/TestyMono/Icon.ico new file mode 100644 index 0000000..7d9dec1 Binary files /dev/null and b/TestyMono/Icon.ico differ diff --git a/TestyMono/Icon.png b/TestyMono/Icon.png new file mode 100644 index 0000000..ce7f8c4 Binary files /dev/null and b/TestyMono/Icon.png differ diff --git a/TestyMono/MonoGame.Framework.dll.config b/TestyMono/MonoGame.Framework.dll.config new file mode 100644 index 0000000..f8abd6e --- /dev/null +++ b/TestyMono/MonoGame.Framework.dll.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/TestyMono/Program.cs b/TestyMono/Program.cs new file mode 100644 index 0000000..b547e85 --- /dev/null +++ b/TestyMono/Program.cs @@ -0,0 +1,84 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using System.Linq; +#if MONOMAC +using MonoMac.AppKit; +using MonoMac.Foundation; +#elif __IOS__ || __TVOS__ +using Foundation; +using UIKit; +#endif +#endregion + +namespace TestyMono +{ +#if __IOS__ || __TVOS__ + [Register("AppDelegate")] + class Program : UIApplicationDelegate +#else + static class Program +#endif + { + private static Game1 game; + + internal static void RunGame() + { + game = new Game1(); + game.Run(); +#if !__IOS__ && !__TVOS__ + game.Dispose(); +#endif + } + + /// + /// The main entry point for the application. + /// +#if !MONOMAC && !__IOS__ && !__TVOS__ + [STAThread] +#endif + static void Main(string[] args) + { +#if MONOMAC + NSApplication.Init (); + + using (var p = new NSAutoreleasePool ()) { + NSApplication.SharedApplication.Delegate = new AppDelegate(); + NSApplication.Main(args); + } +#elif __IOS__ || __TVOS__ + UIApplication.Main(args, null, "AppDelegate"); +#else + RunGame(); +#endif + } + +#if __IOS__ || __TVOS__ + public override void FinishedLaunching(UIApplication app) + { + RunGame(); + } +#endif + } + +#if MONOMAC + class AppDelegate : NSApplicationDelegate + { + public override void FinishedLaunching (MonoMac.Foundation.NSObject notification) + { + AppDomain.CurrentDomain.AssemblyResolve += (object sender, ResolveEventArgs a) => { + if (a.Name.StartsWith("MonoMac")) { + return typeof(MonoMac.AppKit.AppKitFramework).Assembly; + } + return null; + }; + Program.RunGame(); + } + + public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender) + { + return true; + } + } +#endif +} diff --git a/TestyMono/Properties/AssemblyInfo.cs b/TestyMono/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5691c7e --- /dev/null +++ b/TestyMono/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +#if __ANDROID__ +using Android.App; +#endif + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("TestyMono")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("${AuthorCopyright}")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/TestyMono/TestyMono.csproj b/TestyMono/TestyMono.csproj new file mode 100644 index 0000000..61cef98 --- /dev/null +++ b/TestyMono/TestyMono.csproj @@ -0,0 +1,91 @@ + + + + + Debug + x86 + {7D5F8921-B087-4A2B-8E70-1BF5805FC23E} + Exe + TestyMono + TestyMono + v4.5 + DesktopGL + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + x86 + + + true + bin\Release + prompt + 4 + x86 + + + + + + + $(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + \ No newline at end of file diff --git a/TestyMono/app.manifest b/TestyMono/app.manifest new file mode 100644 index 0000000..cd315b2 --- /dev/null +++ b/TestyMono/app.manifest @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + true/pm + + + diff --git a/TestyMono/libSDL2-2.0.0.dylib b/TestyMono/libSDL2-2.0.0.dylib new file mode 100644 index 0000000..11f2993 Binary files /dev/null and b/TestyMono/libSDL2-2.0.0.dylib differ diff --git a/TestyMono/libopenal.1.dylib b/TestyMono/libopenal.1.dylib new file mode 100644 index 0000000..df9570d Binary files /dev/null and b/TestyMono/libopenal.1.dylib differ diff --git a/TestyMono/x64/SDL2.dll b/TestyMono/x64/SDL2.dll new file mode 100644 index 0000000..8e0c64c Binary files /dev/null and b/TestyMono/x64/SDL2.dll differ diff --git a/TestyMono/x64/libSDL2-2.0.so.0 b/TestyMono/x64/libSDL2-2.0.so.0 new file mode 100644 index 0000000..de244bc Binary files /dev/null and b/TestyMono/x64/libSDL2-2.0.so.0 differ diff --git a/TestyMono/x64/libopenal.so.1 b/TestyMono/x64/libopenal.so.1 new file mode 100644 index 0000000..af45fd0 Binary files /dev/null and b/TestyMono/x64/libopenal.so.1 differ diff --git a/TestyMono/x64/soft_oal.dll b/TestyMono/x64/soft_oal.dll new file mode 100644 index 0000000..e24538a Binary files /dev/null and b/TestyMono/x64/soft_oal.dll differ diff --git a/TestyMono/x86/SDL2.dll b/TestyMono/x86/SDL2.dll new file mode 100644 index 0000000..2b7e319 Binary files /dev/null and b/TestyMono/x86/SDL2.dll differ diff --git a/TestyMono/x86/libSDL2-2.0.so.0 b/TestyMono/x86/libSDL2-2.0.so.0 new file mode 100644 index 0000000..01aa197 Binary files /dev/null and b/TestyMono/x86/libSDL2-2.0.so.0 differ diff --git a/TestyMono/x86/libopenal.so.1 b/TestyMono/x86/libopenal.so.1 new file mode 100644 index 0000000..97a503b Binary files /dev/null and b/TestyMono/x86/libopenal.so.1 differ diff --git a/TestyMono/x86/soft_oal.dll b/TestyMono/x86/soft_oal.dll new file mode 100644 index 0000000..1e3bddd Binary files /dev/null and b/TestyMono/x86/soft_oal.dll differ