initial commit.
This commit is contained in:
commit
91d000ac4b
|
@ -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/
|
|
@ -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
|
|
@ -0,0 +1,12 @@
|
|||
#----------------------------- Global Properties ----------------------------#
|
||||
|
||||
/outputDir:bin/$(Platform)
|
||||
/intermediateDir:obj/$(Platform)
|
||||
/config:
|
||||
/profile:Reach
|
||||
/compress:False
|
||||
|
||||
#-------------------------------- References --------------------------------#
|
||||
|
||||
|
||||
#---------------------------------- Content ---------------------------------#
|
|
@ -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
|
||||
|
||||
/// <summary>
|
||||
/// This is the main type for your game.
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
protected override void Initialize() {
|
||||
// TODO: Add your initialization logic here
|
||||
base.Initialize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// LoadContent will be called once per game and is the place to load
|
||||
/// all of your content.
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows the game to run logic such as updating the world,
|
||||
/// checking for collisions, gathering input, and playing audio.
|
||||
/// </summary>
|
||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is called when the game should draw itself.
|
||||
/// </summary>
|
||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 144 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<dllmap dll="SDL2.dll" os="osx" target="libSDL2-2.0.0.dylib" />
|
||||
<dllmap dll="soft_oal.dll" os="osx" target="libopenal.1.dylib" />
|
||||
<dllmap dll="SDL2.dll" os="linux" cpu="x86" target="./x86/libSDL2-2.0.so.0" />
|
||||
<dllmap dll="soft_oal.dll" os="linux" cpu="x86" target="./x86/libopenal.so.1" />
|
||||
<dllmap dll="SDL2.dll" os="linux" cpu="x86-64" target="./x64/libSDL2-2.0.so.0" />
|
||||
<dllmap dll="soft_oal.dll" os="linux" cpu="x86-64" target="./x64/libopenal.so.1" />
|
||||
</configuration>
|
|
@ -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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
#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
|
||||
}
|
|
@ -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("")]
|
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProjectGuid>{7D5F8921-B087-4A2B-8E70-1BF5805FC23E}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>TestyMono</RootNamespace>
|
||||
<AssemblyName>TestyMono</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<MonoGamePlatform>DesktopGL</MonoGamePlatform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="MonoGame.Framework">
|
||||
<HintPath>$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Game1.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.manifest" />
|
||||
<None Include="Icon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Icon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MonoGameContentReference Include="Content\Content.mgcb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="x64\libopenal.so.1">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="x64\soft_oal.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="x64\libSDL2-2.0.so.0">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="x64\SDL2.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="x86\libopenal.so.1">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="x86\soft_oal.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="x86\libSDL2-2.0.so.0">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="x86\SDL2.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="MonoGame.Framework.dll.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="libopenal.1.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="libSDL2-2.0.0.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="TestyMono" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on and is
|
||||
is designed to work with. Uncomment the appropriate elements and Windows will
|
||||
automatically selected the most compatible environment. -->
|
||||
<!-- Windows Vista -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
</assembly>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue