diff --git a/Barotrauma/BarotraumaClient/ClientCode.projitems b/Barotrauma/BarotraumaClient/ClientCode.projitems index 26cd574b9..dddac413d 100644 --- a/Barotrauma/BarotraumaClient/ClientCode.projitems +++ b/Barotrauma/BarotraumaClient/ClientCode.projitems @@ -221,6 +221,7 @@ + diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj index a96474014..a4375f0b3 100644 --- a/Barotrauma/BarotraumaClient/LinuxClient.csproj +++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj @@ -83,8 +83,9 @@ ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\GameAnalytics.Mono.dll - - ..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\lib\net45\MonoGame.Framework.dll + + False + ..\..\Libraries\MonoGame.Framework\DesktopGL\MonoGame.Framework.dll ..\..\Libraries\NuGet\NLog.4.3.8\lib\net45\NLog.dll @@ -354,9 +355,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + diff --git a/Libraries/MonoGame.Framework/Src/Documentation/UWP.md b/Libraries/MonoGame.Framework/Src/Documentation/UWP.md new file mode 100644 index 000000000..6402ae880 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/UWP.md @@ -0,0 +1,43 @@ +# Game class constructor +Due to some UWP implementation details, MonoGame has to construct your `Game` derived class by itself, using a static initializer `MonoGame.Framework.XamlGame.Create(...)`. + +In this situation, you have two main possibilities to create a `Game` derived class: + +1. Let `XamlGame` initialize your `Game` derived class using the default constructor +2. Let `XamlGame` initialize your `Game` derived class using a custom constructor. + +#### 1. XamlGame uses the default constructor + +With this logic, it isn't possible to inject dependencies through the constructor since the default constructor is called: + `var game = new T();` + + + +#### 2. XamlGame uses a custom constructor + +Why may you need this constructor? + +Consider `Game1` needs some dependencies such as an `ISettingsRepository` to get some values from each *platform* settings store. You would then implement an `AndroidSettingsRepository` and a `UwpSettingsRepository`, but you cannot construct those dependencies in `Game1` itself, **because they are platform dependent**, so you'll have to inject them into its constructor. + +For example, in a `MainActivity` on Android you would do: + +```csharp +_game = new Game1( + new AndroidTextFileImporter(Assets), + new AndroidSettingsRepository(this)); +``` + +With the UWP implementation using `XamlGame` static initializer, you could do this: + +```csharp +_game = MonoGame.Framework.XamlGame.Create( + launchArguments, + Window.Current.CoreWindow, + swapChainPanel, + () => new Game1( + new UwpTextFileImporter(Assets), + new UwpSettingsRepository(this))); +``` + +In this way, you tell the static initializer **how** you'd like to construct `Game1`. + diff --git a/Libraries/MonoGame.Framework/Src/Documentation/adding_ttf_fonts.md b/Libraries/MonoGame.Framework/Src/Documentation/adding_ttf_fonts.md new file mode 100644 index 000000000..d78fb05f0 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/adding_ttf_fonts.md @@ -0,0 +1,43 @@ +MonoGame supports more than one method of using fonts, the following is an explanation of how to use TrueType fonts. + +#### Using TrueType Fonts with MonoGame +To be able to use a truetype font, MonoGame requires the truetype font file and a .spritefont file. +Truetype fonts may be installed on the system, or added to the project manually using your IDE in the same directory as the .spritefont file. + +1. Create the .spritefont file. + +

+ +

+ +

+ +

+ +2- Open the newly created .spritefont file in your text editor of choice, find this line and change it to your selected .ttf font. +If the font is installed on the system, just type the name of the font. +```xml +Arial +``` + +#### Usage Example +Make a class variable of type Spritefont +```csharp +SpriteFont font; +``` +Load the font in the LoadContent function +```csharp +font = myGame.Content.Load("Fonts/myFont") +``` +Draw any text in the Draw function +```csharp +spriteBatch.Begin(); +// Finds the center of the string in coordinates inside the text rectangle +Vector2 textMiddlePoint = font.MeasureString(text) / 2; +// Places text in center of the screen +Vector2 position = new Vector2(myGame.Window.ClientBounds.Width / 2, myGame.Window.ClientBounds.Height / 2); +spriteBatch.DrawString(font, "MonoGame Font Test", position, Color.White, 0, textMiddlePoint, 1.0f, SpriteEffects.None, 0.5f) +spriteBatch.End(); +``` + +If you want to know more, please refer to the [API Documentation]() diff --git a/Libraries/MonoGame.Framework/Src/Documentation/android.md b/Libraries/MonoGame.Framework/Src/Documentation/android.md new file mode 100644 index 000000000..503f20835 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/android.md @@ -0,0 +1,60 @@ +# + +## Target Frameworks +Specifying the target Android versions can be confusing. MonoGame is built to target Android 4.2 (API Level 17), but can run on lower Android versions. If you build MonoGame from source, you will need the SDK Platform for API Level 17 installed in the Android SDK Manager. + +Since MonoGame targets Android 4.2, the Target Framework in your Android project must be set to 4.2 or higher. To allow your game to run on lower Android versions, set the Minimum Android version to the desired version in the project properties. + +### Visual Studio +There are three settings in the Application tab of the project properties to set the target Android versions. + +`Compile using Android version` must be set to a minimum of `Android 4.2`. If you are using APIs available only in later Android versions, this must be set to the Android version that API became available or higher. + +`Minimum Android to target` is set to the lowest Android version that you wish to support. + +`Target Android version` is usually set to `Use Compile using SDK version`. This means to use the same value that we set the app to be built with. There is usually no reason to set this to any other value. + +This is an example of a project set to build with the 4.4 SDK and target 4.0 as a minimum Android version. + +

+ +

+ +### Xamarin Studio + +Xamarin Studio has the same settings in the project options dialog. They are just in different places. + +`Target framework` on the `General` page is the equivalent of Visual Studio's `Compile using Android version`. + +

+ +

+ +On the `Android Application` page, you will find `Minimum Android version` (Visual Studio's `Minimum Android to target`) and `Target Android version` (same as Visual Studio). + +

+ +

+ + +## Android Manifest Requirements + +### OpenGL ES 2.0 Support + +MonoGame uses OpenGL ES 2.0. Google requires the following to be added to AndroidManifest.xml in order for the Market to hide the game from devices that do not have support for OpenGL ES 2.0. + + +``` + + +``` + +### Texture Compression + +The Market can also filter games by the types of texture compression they support. Add a ``` + ``` node for each type of texture compression used in your game. See the [Android documentation](http://developer.android.com/guide/topics/manifest/supports-gl-texture-element.html) for further details on this node. + +## References + +[Such Android API Levels, Much Confuse. Wow.](http://redth.codes/such-android-api-levels-much-confuse-wow/) is a blog post by Redth going into more detail about setting the Android versions in a Xamarin project. + diff --git a/Libraries/MonoGame.Framework/Src/Documentation/config.xml b/Libraries/MonoGame.Framework/Src/Documentation/config.xml new file mode 100644 index 000000000..957c9c0cc --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/config.xml @@ -0,0 +1,117 @@ + + + + + MonoGame Documentation + + + Output + + + + + + images + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ..\MonoGame.Framework\bin\Windows\AnyCPU\Release\MonoGame.Framework.dll + ..\MonoGame.Framework.Content.Pipeline\bin\Windows\AnyCPU\Release\MonoGame.Framework.Content.Pipeline.dll + + + + + ..\MonoGame.Framework\bin\Linux\AnyCPU\Release\MonoGame.Framework.dll + ..\MonoGame.Framework.Content.Pipeline\bin\Linux\AnyCPU\Release\MonoGame.Framework.Content.Pipeline.dll + + + + + + + + ..\MonoGame.Framework\bin\WindowsGL\AnyCPU\Release\MonoGame.Framework.dll + + + + + ..\MonoGame.Framework\bin\Web\AnyCPU\Release\MonoGame.Framework.dll + + + + + + + + + diff --git a/Libraries/MonoGame.Framework/Src/Documentation/content_intro.md b/Libraries/MonoGame.Framework/Src/Documentation/content_intro.md new file mode 100644 index 000000000..dce6e3377 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/content_intro.md @@ -0,0 +1,12 @@ +A big part of your game is your content. This includes standard files like textures, sound effects, music, videos, and custom effects as well as custom content like level and enemy files. + +MonoGame implements its own content pipeline for transforming your unoptimized assets into platform optimized content. This is critical in building a game which runs as fast as possible under tight resource constraints. + +This section will cover the following topics: + + - What is Game Content + - [Using The Pipeline Tool](using_pipeline_tool.md) + - [Using TrueType Fonts](adding_ttf_fonts.md) + - [Custom Effects](custom_effects.md) + - Custom Content Types + diff --git a/Libraries/MonoGame.Framework/Src/Documentation/custom_effects.md b/Libraries/MonoGame.Framework/Src/Documentation/custom_effects.md new file mode 100644 index 000000000..fcbc3de91 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/custom_effects.md @@ -0,0 +1,75 @@ +A core element of Microsoft XNA is the effect system which is used for all rendering. + +For MonoGame we have the burden of supporting stock and custom effects for desktop GLSL, mobile GLSL, DirectX HLSL, and custom formats like that of the PlayStation Mobile. There currently is no effect system or shader language that supports all the platforms we require, forcing us to build a new custom effect system. + +# MGFX +MGFX is MonoGame's own "FX" runtime and tools which with the following core goals: + +* Support a similar technique, passes, shaders structure as Microsoft FX files. +* Have a textual format for ease of editing. +* Have a compiled and optimized binary format for runtime use. +* Be cross-platform and support multiple shader languages and bytecodes. +* Easy to extend for future platforms and features. + +# Stock Effects +MonoGame has the following effects built-in and fully supported on current platforms: + +* SpriteEffect +* BasicEffect +* AlphaTestEffect +* DualTextureEffect +* EnvironmentMapEffect +* SkinnedEffect + +Under the hood these effects use the same system and tools as one would for a custom Effect. The source and pre-compiled versions of these effects can be found in the ['MonoGame.Framework\Graphics\Effect\Resources'](https://github.com/MonoGame/MonoGame/tree/develop/MonoGame.Framework/Graphics/Effect/Resources) folder. + +If your game requires an extra little bit of performance you can easily hand edit the existing effects to remove unnecessary features or optimize for specific hardware and rebuild them with the MGFX tool. + +# Custom Effects +To use a custom effect with MonoGame you must do one of the following (not both): +* Run the effect file through the [MonoGame Effect content processor](mgcb.md) for loading via the `ContentManager` (Recommended). +* Process your effect file with the [2MGFX tool](2mgfx.md) and load them yourself at runtime. + + +### Effect Writing Tips +These are some tips for writing or converting effects for use with MonoGame. + +* The supported shader models when targeting DX are the following: + * `vs_4_0_level_9_1` and `ps_4_0_level_9_1` + * `vs_4_0_level_9_3` and `ps_4_0_level_9_3` + * `vs_4_0` and `ps_4_0` (requires `HiDef` `GraphicsProfile` at runtime) + * `vs_4_1` and `ps_4_1` (requires `HiDef` `GraphicsProfile` at runtime) + * `vs_5_0` and `ps_5_0` (requires `HiDef` `GraphicsProfile` at runtime) +* When targeting GL platforms we automatically translate FX files to GLSL using a library called [MojoShader](http://icculus.org/mojoshader/). The supported feature levels are the following: + * `vs_2_0` and `ps_2_0` + * `vs_3_0` and `ps_3_0` +* You can use preprocessor checks to add conditional code or compilation depending on defined symbols. MonoGame defines the following symbols when compiling effects: + * `2MGFX` + * `HLSL` and `SM4` for DirectX + * `OpenGL` and `GLSL` for OpenGL + + As an example, you can conditionally set shader models depending on the platform with the following code: + ``` + #if OPENGL + #define VS_SHADERMODEL vs_3_0 + #define PS_SHADERMODEL ps_3_0 + #else + #define VS_SHADERMODEL vs_4_0_level_9_1 + #define PS_SHADERMODEL ps_4_0_level_9_1 + #endif + + technique + { + pass + { + VertexShader = compile VS_SHADERMODEL MainVS(); + PixelShader = compile PS_SHADERMODEL MainPS(); + } + }; + ``` + Custom symbols can be defined from the [Pipeline Tool](pipeline.md) or via [2MGFX](2mgfx.md). +* Make sure the pixel shaders inputs **exactly match** the vertex shader outputs so the parameters are passed in the correct registers. The parameters need to have the same size and order. Omitting parameters might not break compilation, but can cause unexpected results. +* Note that on GL platforms default values on Effect parameters do not work. Either set the parameter from code or use a real constant like a #define. +* The effect compiler is aggressive about removing unused parameters, be sure the parameters you are setting are actually used. +* Preshaders are not supported. +* If you think you've found a bug porting a shader [please let us know](https://github.com/MonoGame/MonoGame/issues). diff --git a/Libraries/MonoGame.Framework/Src/Documentation/getting_started/1_creating_a_new_project.md b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/1_creating_a_new_project.md new file mode 100644 index 000000000..a58e91ed4 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/1_creating_a_new_project.md @@ -0,0 +1,3 @@ +This tutorial assumes that you have configured MonoGame correctly on your system, if you haven't, please read the [Setting Up MonoGame](setting_up_monogame.md). + +Depending on the software you plan on using please follow either [Visual Studio](getting_started/1_creating_a_new_project_vs.md), or [VS for Mac / MonoDevelop](getting_started/1_creating_a_new_project_md.md) guide. diff --git a/Libraries/MonoGame.Framework/Src/Documentation/getting_started/1_creating_a_new_project_md.md b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/1_creating_a_new_project_md.md new file mode 100644 index 000000000..7ed195515 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/1_creating_a_new_project_md.md @@ -0,0 +1,21 @@ +Start up MonoDevelop / Xamarin Studio and select **New...** in the upper left corner. + +![New Solution](images/getting_started/1_new_soulution_md.png) + +Now you should see a "New Project" dialog pop up. From here select **MonoGame > App** category, then select **MonoGame Cross Platform Desktop Project** and click **Next**. + +![New Template](images/getting_started/1_template_dialog_md.png) + +On the following dialog, type in the name that you wish to give your project. Do note that you should not use space character for it. For this tutorial, it will be named **ExampleGame**. After you've entered the name, click on the **Browse** button next to location text field, and select where you wish to save your project. Finally click **Create** to create a new project. + +![New Project](images/getting_started/1_project_dialog_md.png) + +If everything went correctly, you should see an **ExampleGame** project open up like in the picture bellow. To run your game simply press the big **Play Button** in the upper left corner or press **F5**. + +![Run Game](images/getting_started/1_run_game_md.png) + +You should now see your game window running. + +![Game](images/getting_started/1_game_md.png) + +Currently it's just clearing the surface with blue color. For further information on creating your game, please look at the [Understanding the Code](getting_started/2_understanding_the_code.md). diff --git a/Libraries/MonoGame.Framework/Src/Documentation/getting_started/1_creating_a_new_project_vs.md b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/1_creating_a_new_project_vs.md new file mode 100644 index 000000000..f0519ee00 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/1_creating_a_new_project_vs.md @@ -0,0 +1,17 @@ +Start up Visual Studio and select **New Project...** in the upper left corner. + +![New Solution](images/getting_started/1_new_soulution_vs.png) + +Now you should see a "New Project" dialog pop up, from here select **Templates > Visual C# > MonoGame** category, and then select **MonoGame Cross Platform Desktop Project**. Next type in the name that you wish to give your project, for this tutorial let's just use **ExampleGame** (do note that you should not use space character for it). After you've entered the name, click on the **Browse** button next to the location text field, and select where you wish to save your project. Finally click **OK** to create a new project. + +![New Template](images/getting_started/1_template_dialog_vs.png) + +If everything went correctly, you should see an **ExampleGame** project open up like in the picture bellow. To run your game simply press the big **Play Button** in the toolbar or press **F5**. + +![Run Game](images/getting_started/1_run_game_vs.png) + +You should now see your game window running. + +![Game](images/getting_started/1_game_vs.png) + +Currently it's just clearing the surface with blue color. For further information on creating your game, please look at the [Understanding the Code](getting_started/2_understanding_the_code.md). diff --git a/Libraries/MonoGame.Framework/Src/Documentation/getting_started/2_understanding_the_code.md b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/2_understanding_the_code.md new file mode 100644 index 000000000..a986e657e --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/2_understanding_the_code.md @@ -0,0 +1,103 @@ + +This file will go over the code that is getting created when you start a blank project. For help on creating a project please look at [Creating a New Project](getting_started/1_creating_a_new_project.md) + +**Using Statements** + +```csharp +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Storage; +using Microsoft.Xna.Framework.Input; +``` + +These using statements are required in order to use the code that MonoGame has to offer. + +The reason why they start with Microsoft.Xna.Framework is because MonoGame is an open source implementation of Microsoft Xna framework, and in order to maintain compatibility with the XNA code, it is using the same namespaces. + +**The Game1 Class** + +```csharp +public class Game1 : Game +``` + +The main Game1 class is inheriting from the Game class, which provides all the core methods for your game (ie. Load/Unload Content, Update, Draw etc.). You usually have only one Game class per game so its name isn't that important. + +**Instanced Variables** + +```csharp +GraphicsDeviceManager graphics; +SpriteBatch spriteBatch; +``` + +The two default variables that the blank template starts with are GraphicsDeviceManager and SpriteBatch. Both of these variables are used for drawing stuff as you will see in a later tutorial. + +**Constructor** + +```csharp +public Game1() +{ + graphics = new GraphicsDeviceManager(this); + Content.RootDirectory = "Content"; +} +``` +The main game constructor is used to initialize the starting variables. In this case we are creating a new GraphicsDeviceManager from our game, and are setting the folder which the game will search for content. + +**Initialize Method** + +```csharp +protected override void Initialize() +{ + // TODO: Add your initialization logic here + + base.Initialize(); +} +``` + +This method is called after the constructor, but before the main game loop(Update/Draw). This is where you can query any required services and load any non-graphic related content. + +**LoadContent Method** + +```csharp +protected override void LoadContent() +{ + // Create a new SpriteBatch, which can be used to draw textures. + spriteBatch = new SpriteBatch(GraphicsDevice); + + // TODO: use this.Content to load your game content here +} +``` + +This method is used to load your game content. It is called only once per game, after Initialize method, but before the main game loop methods. + +**Update Method** + +```csharp +protected override void Update(GameTime gameTime) +{ + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) + Exit(); + + // TODO: Add your update logic here + + base.Update(gameTime); +} +``` + +This method is called multiple times per second, and is used to update your game state (checking for collisions, gathering input, playing audio, etc.). + +**Draw Method** + +```csharp +protected override void Draw(GameTime gameTime) +{ + graphics.GraphicsDevice.Clear(Color.CornflowerBlue); + + // TODO: Add your drawing code here + + base.Draw(gameTime); +} +``` + +Similar to the Update method, it is also called multiple times per second. + +For the next part, look at [Adding Content](getting_started/3_adding_content.md) page. diff --git a/Libraries/MonoGame.Framework/Src/Documentation/getting_started/3_adding_content.md b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/3_adding_content.md new file mode 100644 index 000000000..55b525f7d --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/3_adding_content.md @@ -0,0 +1,78 @@ +This file will go over adding content to your game. For help on creating a project please look at [Creating a New Project](getting_started/1_creating_a_new_project.md) + +First of all you are gonna need some content for your game. For this tutorial use the following image of a ball: + +![Open Content](images/getting_started/ball.png) + +Do **right-click > Save Image As** and save it somewhere with the name "ball.png". + +Now open up your game project and look at the left. You should see a solution explorer window. Expand the **Content** folder and open up **Content.mgcb** file by double clicking on it. + +![Open Content](images/getting_started/3_open_content.png) + +You should now see a MonoGame Pipeline Tool window open up. In case it didn't get opened, you can right-click on **Content.mgcb**, select **open with** and then select **MonoGame Pipeline**. + +![MonoGame Pipeline Tool](images/getting_started/3_pipeline_tool.png) + +Your game content is managed from this external tool. You can add content to your game in one of the following ways: + +- **Add Existing Item** toolbar button +- **Edit > Add > Existing Item...** menu button +- **right-click > Add > Existing Item...** context menu + +In our case let's use the **Add Existing Item** toolbar button. + +![Add Content](images/getting_started/3_add_content.png) + +You should now be prompted to select a file. Select the "ball.png" that you have downloaded a moment ago. After that you will be asked on what action you want to do for adding the file. Just leave the it to default and click **OK**. + +![Copy Content](images/getting_started/3_copy_content.png) + +Now simply click **Save** toolbar button and close the tool. + +![Save Content](images/getting_started/3_save_content.png) + +Now that we have added the content, it's time to load it. First declare a new variable so we can load the ball image into memory. + +```csharp +public class Game1 : Game +{ + Texture2D textureBall; + + GraphicsDeviceManager graphics; +``` + +Next find the Load Content method and use it to initialize the ball private variable: + +```csharp +protected override void LoadContent() +{ + // Create a new SpriteBatch, which can be used to draw textures. + spriteBatch = new SpriteBatch(GraphicsDevice); + + // TODO: use this.Content to load your game content here + textureBall = Content.Load("ball"); +} +``` + +And finally, find the Draw method, and let's draw the ball onto the screen: + +```csharp +protected override void Draw(GameTime gameTime) +{ + graphics.GraphicsDevice.Clear(Color.CornflowerBlue); + + // TODO: Add your drawing code here + spriteBatch.Begin(); + spriteBatch.Draw(textureBall, new Vector2(0, 0), Color.White); + spriteBatch.End(); + + base.Draw(gameTime); +} +``` + +Now run the game and you should get the following: + +![Game](images/getting_started/3_game.png) + +For the next part, look at [Adding Basic Code](getting_started/4_adding_basic_code.md) page. diff --git a/Libraries/MonoGame.Framework/Src/Documentation/getting_started/4_adding_basic_code.md b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/4_adding_basic_code.md new file mode 100644 index 000000000..41accabaf --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/4_adding_basic_code.md @@ -0,0 +1,111 @@ +This file will go over adding basic logic to your game. Do note that this file continues where [Adding Content](getting_started/3_adding_content.md) tutorial left off. + +First of all we need to add few new variables, one for position, and one for speed. + +```csharp +public class Game1 : Game +{ + Texture2D ballTexture; + Vector2 ballPosition; + float ballSpeed; +``` + +Next let's initialize them. Find the **Initialize** method and add the following lines. + +```csharp +// TODO: Add your initialization logic here +ballPosition = new Vector2(graphics.PreferredBackBufferWidth / 2, + graphics.PreferredBackBufferHeight / 2); +ballSpeed = 100f; + +base.Initialize(); +``` + +With this we are putting our ball starting position to the center of the screen. Last thing we need to do is modify the position that the ball is getting drawn to. Find **Draw** method and modify the Draw call to: + +```csharp +spriteBatch.Draw(ballTexture, ballPosition, Color.White); +``` + +Now run the game. + +![Draw Ball 1](images/getting_started/4_ball_not_center.png) + +As you can see the ball doesn't seem quite centered yet. This is happening because MonoGame uses (0, 0) as the origin point for drawing by default. We can modify this by doing the following: + +```csharp +spriteBatch.Draw( + ballTexture, + ballPosition, + null, + Color.White, + 0f, + new Vector2(ballTexture.Width / 2, ballTexture.Height / 2), + Vector2.One, + SpriteEffects.None, + 0f +); +``` + +With this we are setting the origin to the center of the image. Now the image will get drawn to the center of the screen. + +![Draw Ball 2](images/getting_started/4_ball_center.png) + +Next let's setup some movement. Find the **Update** method and add: + +```csharp +// TODO: Add your update logic here +var kstate = Keyboard.GetState(); + +if (kstate.IsKeyDown(Keys.Up)) + ballPosition.Y -= ballSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; + +if(kstate.IsKeyDown(Keys.Down)) + ballPosition.Y += ballSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; + +if (kstate.IsKeyDown(Keys.Left)) + ballPosition.X -= ballSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; + +if(kstate.IsKeyDown(Keys.Right)) + ballPosition.X += ballSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; + +base.Update(gameTime); +``` + +Let's discuss the code a bit. + +With this we are getting the current keyboard state and just putting it into a variable. + +```csharp +var kstate = Keyboard.GetState(); +``` + +Next is just a simple check to see if the Up arrow key is pressed. + +```csharp +if (kstate.IsKeyDown(Keys.Up)) +``` + +And last is a simple code for moving the ball by **ballSpeed**. The reason why **ballSpeed** is getting multiplied by **gameTime.ElapsedGameTime.TotalSeconds** is because Update is not usually fixed, that is the time between update calls is not the same, so in order to get smooth movement we multiple speed by the time since the last update method was called. + +```csharp + ballPosition.Y -= ballSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; +``` + +The last 2 code parts repeat for Down, Left and Right arrow keys. + +Run the game and you should be able to move the ball with the arrow keys. You will probably notice that you can get out of the window, so let's make it so that the ball can't escape the window. We will do this by setting bounds onto the ballPosition after it has already been moved. + +```csharp +if(kstate.IsKeyDown(Keys.Right)) + ballPosition.X += ballSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; + +ballPosition.X = Math.Min(Math.Max(ballTexture.Width / 2, ballPosition.X), graphics.PreferredBackBufferWidth - ballTexture.Width / 2); +ballPosition.Y = Math.Min(Math.Max(ballTexture.Height / 2, ballPosition.Y), graphics.PreferredBackBufferHeight - ballTexture.Height / 2); + +base.Update(gameTime); +``` + +Now run the game and the ball won't be able to escape window bounds anymore. + +Happy Coding ^^ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/getting_started/getting_started.md b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/getting_started.md new file mode 100644 index 000000000..65203616d --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/getting_started/getting_started.md @@ -0,0 +1,8 @@ +This section walks you through the basics of MonoGame and help you create your first game. + +- [Creating a New Project](getting_started/1_creating_a_new_project.md) + - [Visual Studio](getting_started/1_creating_a_new_project_vs.md) + - [MonoDevelop / Xamarin Studio](getting_started/1_creating_a_new_project_md.md) +- [Understanding the Code](getting_started/2_understanding_the_code.md) +- [Adding Content](getting_started/3_adding_content.md) +- [Adding Basic Code](getting_started/4_adding_basic_code.md) diff --git a/Libraries/MonoGame.Framework/Src/Documentation/help_and_support.md b/Libraries/MonoGame.Framework/Src/Documentation/help_and_support.md new file mode 100644 index 000000000..a97c32b81 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/help_and_support.md @@ -0,0 +1,9 @@ +This section will provide help and support for MonoGame. + +## Help + +If you wish to learn how to use MonoGame, please checkout our [Tutorials page](tutorials.md). If you want to find an answer to a more specific problem, you can ask it on our [Community page](http://community.monogame.net/). + +## Bugs and New Feature Requests + +If you find a bug or have a feature request, [please open a new issue](https://github.com/mono/monogame/issues). Before opening any issue, please search for existing issues and read the [Issue Guidelines](https://github.com/necolas/issue-guidelines). diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/add_as_link.png b/Libraries/MonoGame.Framework/Src/Documentation/images/add_as_link.png new file mode 100644 index 000000000..41f3f75b2 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/add_as_link.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/adding_ttf_fonts_step_1.PNG b/Libraries/MonoGame.Framework/Src/Documentation/images/adding_ttf_fonts_step_1.PNG new file mode 100644 index 000000000..b5fc82fd0 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/adding_ttf_fonts_step_1.PNG differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/adding_ttf_fonts_step_2.PNG b/Libraries/MonoGame.Framework/Src/Documentation/images/adding_ttf_fonts_step_2.PNG new file mode 100644 index 000000000..da27b1e9a Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/adding_ttf_fonts_step_2.PNG differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/android_vs_target_frameworks.png b/Libraries/MonoGame.Framework/Src/Documentation/images/android_vs_target_frameworks.png new file mode 100644 index 000000000..7318a484f Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/android_vs_target_frameworks.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/android_xs_minimum_framework.png b/Libraries/MonoGame.Framework/Src/Documentation/images/android_xs_minimum_framework.png new file mode 100644 index 000000000..769b11339 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/android_xs_minimum_framework.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/android_xs_target_framework.png b/Libraries/MonoGame.Framework/Src/Documentation/images/android_xs_target_framework.png new file mode 100644 index 000000000..11e20ed2b Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/android_xs_target_framework.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/copy_if_newer.png b/Libraries/MonoGame.Framework/Src/Documentation/images/copy_if_newer.png new file mode 100644 index 000000000..aba59496d Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/copy_if_newer.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/existing_item.png b/Libraries/MonoGame.Framework/Src/Documentation/images/existing_item.png new file mode 100644 index 000000000..9157f0b8f Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/existing_item.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_game_md.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_game_md.png new file mode 100644 index 000000000..39f85507e Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_game_md.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_game_vs.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_game_vs.png new file mode 100644 index 000000000..18ea8b6ab Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_game_vs.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_new_soulution_md.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_new_soulution_md.png new file mode 100644 index 000000000..2b8a5b855 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_new_soulution_md.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_new_soulution_vs.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_new_soulution_vs.png new file mode 100644 index 000000000..a5ffc8e32 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_new_soulution_vs.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_project_dialog_md.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_project_dialog_md.png new file mode 100644 index 000000000..d360a7469 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_project_dialog_md.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_run_game_md.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_run_game_md.png new file mode 100644 index 000000000..a8c023017 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_run_game_md.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_run_game_vs.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_run_game_vs.png new file mode 100644 index 000000000..cc97ec672 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_run_game_vs.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_template_dialog_md.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_template_dialog_md.png new file mode 100644 index 000000000..9d5786543 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_template_dialog_md.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_template_dialog_vs.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_template_dialog_vs.png new file mode 100644 index 000000000..e52aa3b47 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/1_template_dialog_vs.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_add_content.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_add_content.png new file mode 100644 index 000000000..84be90c3c Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_add_content.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_copy_content.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_copy_content.png new file mode 100644 index 000000000..f328bd3ef Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_copy_content.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_game.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_game.png new file mode 100644 index 000000000..e62602c8f Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_game.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_open_content.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_open_content.png new file mode 100644 index 000000000..574c8c89c Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_open_content.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_pipeline_tool.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_pipeline_tool.png new file mode 100644 index 000000000..3ab18d091 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_pipeline_tool.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_save_content.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_save_content.png new file mode 100644 index 000000000..b71afe030 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/3_save_content.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/4_ball_center.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/4_ball_center.png new file mode 100644 index 000000000..0e55a0110 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/4_ball_center.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/4_ball_not_center.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/4_ball_not_center.png new file mode 100644 index 000000000..c35888c29 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/4_ball_not_center.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/ball.png b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/ball.png new file mode 100644 index 000000000..f23ff6104 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/getting_started/ball.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline.png b/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline.png new file mode 100644 index 000000000..c3b6130b2 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline_import.png b/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline_import.png new file mode 100644 index 000000000..2d62d544a Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline_import.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline_items.png b/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline_items.png new file mode 100644 index 000000000..fc05d60d0 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline_items.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline_newitem.png b/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline_newitem.png new file mode 100644 index 000000000..631bcae18 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline_newitem.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline_project.png b/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline_project.png new file mode 100644 index 000000000..f735bb872 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/Documentation/images/pipeline_project.png differ diff --git a/Libraries/MonoGame.Framework/Src/Documentation/introduction.md b/Libraries/MonoGame.Framework/Src/Documentation/introduction.md new file mode 100644 index 000000000..d79aa363f --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/introduction.md @@ -0,0 +1,10 @@ +This section will give you an overview of MonoGame including, what it contains, development requirements, setup instructions, and additional links for help and support. + +This section will cover the following topics: + + - [What is MonoGame](what_is_monogame.md) + - [System Requirements](system_requirements.md) + - [Setting Up MonoGame](setting_up_monogame.md) + - [Getting Started](getting_started/getting_started.md) + - [MonoGame FAQ](monogame_faq.md) + - [Help and Support](help_and_support.md) diff --git a/Libraries/MonoGame.Framework/Src/Documentation/links.md b/Libraries/MonoGame.Framework/Src/Documentation/links.md new file mode 100644 index 000000000..0c5999249 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/links.md @@ -0,0 +1,9 @@ +Links to several useful reference sites related to MonoGame. + + - [Microsoft XNA Documentation](http://msdn.microsoft.com/en-us/library/bb203940.aspx) + - [OpenGL 4.3 Reference Card](http://www.khronos.org/files/opengl43-quick-reference-card.pdf) + - [OpenGL ES 2.0 Reference Card](http://www.khronos.org/opengles/sdk/docs/reference_cards/OpenGL-ES-2_0-Reference-card.pdf) + - [WebGL Reference Card](http://www.khronos.org/files/webgl/webgl-reference-card-1_0.pdf) + - [Collada Specification](http://www.khronos.org/collada/) + - [Valve's Guide to Porting to Linux](https://developer.nvidia.com/sites/default/files/akamai/gamedev/docs/Porting%20Source%20to%20Linux.pdf) + diff --git a/Libraries/MonoGame.Framework/Src/Documentation/localization.md b/Libraries/MonoGame.Framework/Src/Documentation/localization.md new file mode 100644 index 000000000..b529ac514 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/localization.md @@ -0,0 +1,150 @@ +Localization is an important part of any game. While it can be possible to design a +game that is region independent, its quite hard. At some point you will need to +produce localized text and graphics. + +MonoGame has a simple localization system built in. If you want to develop your own +system you are still able to do so. But the default system should be good enough for +most use cases. + +# Creating resx files. + +MonoGame runs on .net/Mono on most platforms. Localization is handled by those platforms +via the use of resx files. There are walkthroughs on [MSDN](https://msdn.microsoft.com/en-us/library/aa992030(v=vs.100).aspx) +which walk you through the process. A simplified version is presented here. + +Create a .resx file in the IDE e.g Foo.resx and add it to your game project. Note this needs to be added to the +main app projects. The Foo.resx file should have an Action of EmbeddedResouce and a Generator value of ResXFileCodeGenerator. +There is a snippet from the .csproj + +```xml + + ResXFileCodeGenerator + Foo.Designer.cs + +``` + +Add any string resources to that file. These are in the form of a Key/Value pair. You can use the built in editor +or manually edit the .resx file by hand. Its an xml file so you can view the contents easily. + +```xml + + Wall Style : {0} + +``` + +What happens when the resx is processed by the generator and produces a Foo.Designer.cs file which is then +included in your project. You can then access the "string" value by using code as follows + +```csharp + var s = MyProject.Foo.Wall_Style; +``` + +Note in the example we have a place holder ({0}) for additional text. You can still use te property of Foo.Wall_Style with +things like string.Format. + +```csharp + int i = 1; + var s = string.Format (MyProject.Foo.Wall_Style, i); +``` + +All this means you dont need to hard the string directly. When accessing MyProject.Foo.Wall_Style the code will lookup the value from +the embedded resx file. + +You can add support for a new language by adding a new resx file which uses the language/region code e.g Foo.de-DE.resx. +This new file will contain the translations for that language/region. In the example we are targetting German. + +## Universal Windows Platform (UWP) considerations. + +Unfortunately UWP does not support resx files anymore. They have a new file called resw. The format is similar but +incompatible. As a result you will need to duplicate the data into a set of resw files to get the to work on UWP. The +process is like the standrd resx process. + +# Upgrading your SpriteFont files + +By default the SpriteFont processor uses a limited set of characters to generate the font. While this is fine for english +languages it would probably not include special characters needed for other languages (French, Arabic, Korean etc). + +As a result MonoGame has a LocalizedFontProcessor which does something slightly different. The process looks at the resx +files you provide it with and generates an optimized spritefont which only contains the characters your game uses. + +To make use of this functionality you ned to tell the spritefont which resx files to use. Open the .spritefont with a +xml/text editor and add lines like this inside the Asset node + +```xml + + ..\Foo.resx + ..\Foo.de-DE.resx + +``` + +Note the paths are relative to the .spritefont directory. In the example above the resx files are in the directory +above the .spritefont. + +You should end up with a .spritefont file like this + +```xml + + + + Verdana + 14 + 1 + + + + + + + + + ..\Foo.resx + ..\Foo.de-DE.resx + + + +``` + +Once that is done you then need to change the .mgcb file so that the SpriteFontProcessor is replaced with +the LocalizedFontProcessor. This can be done by editing the .mgcb file or using the Pipeline tool. After +that you can just compile your content as normal. If the processor has any trouble resolving or reading the +resx files you will get an error. + +# Loading the Font + +Loading the font can be done in the normal way. The end result of the process is a .xnb file containing a normal +SpriteFont. + +```csharp + var font = Content.Load("Foo"); +``` + +# Other Localized assets + +Not all localized assets will be fonts. In certain situtions you might need to swap out an entire texture or spritesheet. +For these cases a new method has been added to the ContentManager, LoadLocalized. The idea behind this method is that it will +look for localized files BEFORE loading the default one. + +So for example say you have an asset, MyCharacter. You have a MyCharacter.xnb file which contains the data for that item. You +can also has a MyCharacter.de-DE.xnb file which contains the German version of that asset. This asset could be a Texture, Audio +or any other game asset. You can then use LoadLocalized to load the localized version of the asset. + +```csharp +var myCharacter = Content.LoadLocalized("MyCharacter"); +``` + +The decision on which localized asset to load is made by looking for a file with the following patterns + +```xml +. +. +``` + +These values are retrieved from + +```csharp + CultureInfo.CurrentCulture.Name // eg. "en-US" + CultureInfo.CurrentCulture.TwoLetterISOLanguageName // eg. "en" +``` + +which are part of the System.Globalization namespace. On a side note you can also use the `LoadLocalized` to load language +specific SpriteFonts. They just need to be named in the same way as we have described above. diff --git a/Libraries/MonoGame.Framework/Src/Documentation/mgcb.md b/Libraries/MonoGame.Framework/Src/Documentation/mgcb.md new file mode 100644 index 000000000..27c5cfc8c --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/mgcb.md @@ -0,0 +1,194 @@ +The MonoGame Content Builder (MGCB.exe) is a command line tool for building XNB content on Windows, Mac, and Linux desktop systems. + +Typically it is executed by the [Pipeline GUI tool](pipeline.md) when editing content or indirectly from VisualStudio or MonoDevelop during the build process of a MonoGame project. Alternatively you can use it yourself from the command line for specialized build pipelines or for debugging content processing. + +## Command Line Options +The options are processed "left to right". When an option is repeated the last option always wins. + +### Output Directory +``` +/outputDir: +``` +It specifies the directory where all content is written. If this option is omitted the output will be put into the current working directory. + +### Intermediate Directory +``` +/intermediateDir: +``` +It specifies the directory where all intermediate files are written. If this option is omitted the intermediate data will be put into the current working directory. + +### Rebuild Content +``` +/rebuild +``` +An optional parameter which forces a full rebuild of all content. + +### Clean Content +``` +/clean +``` +Delete all previously built content and intermediate files. Only the `/intermediateDir` and `/outputDir` need to be defined for clean to do its job. + +### Incremental Build +``` +/incremental +``` +Skip cleaning files not included in the current build. Useful for custom tools which only require a subset of the game content built. + +### Assembly Reference +``` +/reference: +``` +An optional parameter which adds an assembly reference which contains importers, processors, or writers needed during content building. + +### Target Platform +``` +/platform: +``` +Set the target platform for this build. It must be a member of the TargetPlatform enum: +* Windows +* iOS +* Android +* DesktopGL +* MacOSX +* WindowsStoreApp +* NativeClient +* PlayStation4 +* WindowsPhone8 +* RaspberryPi +* PSVita +* XboxOne +* Switch + +If not set it will default to Windows. + +NOTE: PlayStation 4, Xbox One, PS Vita, and Switch support is only available to licensed console developers. + +### Target Graphics Profile +``` +/profile: +``` +Set the target graphics profile for this build. It must be a member of the GraphicsProfile enum: +* HiDef +* Reach + +If not set it will default to HiDef. + +### Target Build Configuration +``` +/config: +``` +The optional build configuration name from the build system. This is sometimes used as a hint in content processors. + +### Content Compression +``` +/compress +``` +Uses LZ4 compression to compress the contents of the XNB files. Content build times will increase with this option enabled. Compression is not recommended for platforms such as Android, Windows Phone 8 and Windows 8 as the app package is already compressed. This is not compatible with LZX compression used in XNA content. + +### Content Importer Name +``` +/importer: +``` +An optional parameter which defines the class name of the content importer for reading source content. If the option is omitted or used without a class name the default content importer for the source type is used. + +### Content Processor Name +``` +/processor: +``` +An optional parameter which defines the class name of the content processor for processing imported content. If the option is omitted used without a class name the default content processor for the imported content is used. + +Note that when you change the processor all previously defined `/processorParam` are cleared. + +### Content Processor Parameter +``` +/processorParam:= +``` +An optional parameter which defines a parameter name and value to set on a content processor. + +Note all defined processor parameters are cleared when the `/processor` is set. + +### Build Content File +``` +/build: +/build:; +``` +Instructs the content builder to build the specified content file using the previously set switches and options. Optional destination path may be specified if you want to change the output filepath. + +### Response File +``` +/@: +``` +This defines a text response file (sometimes called a command file) that contains the same options and switches you would normally find on the command line. + +Each switch is specified on a new line. Comment lines are prefixed with #. You can specify multiple response files or mix normal command line switches with response files. + +An example response file could look like this: +``` +# Directories +/outputDir:bin/foo +/intermediateDir:obj/foo + +/rebuild + +# Build a texture +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyEnabled=false +/build:Textures\wood.png +/build:Textures\metal.png +/build:Textures\plastic.png +``` +### Launch Debugger +``` +/launchdebugger +``` +Allows a debugger to attach to the MGCB executable before content is built. +### Define Preprocessor Parameter +``` +/define = +``` +Sets or creates a preprocessor parameter with the given name and value. +### Preprocessor Macros +``` +$if = +$endif +``` +Preprocessor macros are intended to allow conditionals within a response file. + +The preprocess step is what expands a response file command into its composite commands for each line in the file. However, a line is only emitted if all conditionals which contain the line evaluate true. +``` + +MGCB.exe /define:BuildEffects=No /@:example.mgcb + + +$if BuildEffects=Yes + /importer:EffectImporter + /processor:EffectProcessor + /build:Effects\custom.fx + # all other effects here.... +$endif +``` + +### Customizing your Build Process + +When building content from your project via `msbuild` there are a few ways to can hook into the build process. The `MonoGame.Content.Builder.targets` runs a target called +`BuildContent` just before your project builds. If you want to do any processing before or after this process you can use the `BeforeTargets` and `AfterTargets` mechanism provided +by `msbuild` to run your own targest. + +``` + + + + + + +``` + +If you want to customise the arguements sent to the `MGCB.exe` as part of the build process you can use the `` property to define those. +For example if you wanted to pass in the current project configuration you could define + +``` +-config:$(Configuration) +``` + diff --git a/Libraries/MonoGame.Framework/Src/Documentation/monogame_faq.md b/Libraries/MonoGame.Framework/Src/Documentation/monogame_faq.md new file mode 100644 index 000000000..7c9935c1b --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/monogame_faq.md @@ -0,0 +1,11 @@ +This page contains a list of frequently asked questions. + +### What software do I need to start? + +Depending on the platform you wish to develop for the following thing are needed: + +- Android: [Xamarin.Android](https://docs.microsoft.com/en-us/xamarin/android/) +- iOS: [Xamarin.iOS](https://docs.microsoft.com/en-us/xamarin/ios/) + +The linked pages will guide you through the setup process. + diff --git a/Libraries/MonoGame.Framework/Src/Documentation/pipeline.md b/Libraries/MonoGame.Framework/Src/Documentation/pipeline.md new file mode 100644 index 000000000..b8daab685 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/pipeline.md @@ -0,0 +1,23 @@ +The MonoGame Pipeline Tool (Pipeline.exe) is the front-end GUI editor for MonoGame content builder projects. + +

+ +

+ +The Pipeline Tool has the following features: + + * Create, open, and save MGCB projects. + * Import existing XNA .contentproj. + * Tree view showing content of project. + * Property grid for editing content settings. + * Full undo/redo support. + * Build, rebuild, and clean the project. + * Rebuild selected items. + * Create new content like fonts and xml. + * Support for custom importers/processors/writers. + * Template format for adding new custom content types. + +The Pipeline Tool is included in the SDK installation. + +[Read detailed documentation](using_pipeline_tool.md) + diff --git a/Libraries/MonoGame.Framework/Src/Documentation/platform_specific.md b/Libraries/MonoGame.Framework/Src/Documentation/platform_specific.md new file mode 100644 index 000000000..4aa003cef --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/platform_specific.md @@ -0,0 +1,5 @@ +While MonoGame aims to provide a platform-agnostic framework for developing games and apps, there are still some specific for each platform that need the developer needs to be aware of. This section lists those specifics broken down by platform. + + - [Android](android.md) + - [tvOS](tvOS.md) + - [Windows Universal Platform (UWP)](UWP.md) diff --git a/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame.md b/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame.md new file mode 100644 index 000000000..955117346 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame.md @@ -0,0 +1,6 @@ +This section will help you setup MonoGame on Platform of your choice. Please select the platform you wish to develop from: + + - [Windows](setting_up_monogame_windows.md) + - [Mac](setting_up_monogame_mac.md) + - [Linux](setting_up_monogame_linux.md) + - [Building from source](setting_up_monogame_source.md) diff --git a/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame_linux.md b/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame_linux.md new file mode 100644 index 000000000..8f49b03ac --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame_linux.md @@ -0,0 +1,30 @@ +This section will help you setup MonoGame on Linux. + +### Running MonoGame Applications + +The following packages are needed for the MonoGame Applications to run on Linux: +* libopenal-dev +* mono-runtime + +For Ubuntu/Debian based Linux systems, you can run: +``` +sudo apt-get install libopenal-dev mono-runtime +``` + +### Developing MonoGame Applications + +* Go to [MonoGame Downloads page](http://www.monogame.net/downloads/) +* Download MonoGame for Linux +* Open up terminal and type in: +``` +cd Downloads +chmod +x monogame-sdk.run +sudo ./monogame-sdk.run +``` +* During the installation process the installer will give you the following list of dependencies, please make sure they are installed: + * monodevelop ([http://www.monodevelop.com/download/](http://www.monodevelop.com/download/)) + * libopenal-dev + * gtk-sharp3 + * referenceassemblies-pcl (needed to use PCL template) + * ttf-mscorefonts-installer (recommended, but not needed) +* That's it, MonoGame SDK is installed diff --git a/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame_mac.md b/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame_mac.md new file mode 100644 index 000000000..620138b01 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame_mac.md @@ -0,0 +1,34 @@ +This section will help you setup MonoGame on Mac OSX. + +### Running MonoGame Applications + + +### Developing MonoGame Applications + +Developing on the Mac requires a number of other frameworks and applications. +To get started you can use the Linux or DesktopGL platforms which will run quite happily +on MacOS providing you have mono installed. + +So to get setup you will first need to install mono. +* Go to [Mono Downloads page](http://www.mono-project.com/download/) +* Download the latest Mac OS installer. + +Note: If you are running El Capitan you will need to install the very latest mono otherwise things +will not work correctly. + +You will also need Visual Studio for Mac +* Go to the [Visual Studio for Mac website](https://visualstudio.microsoft.com/vs/mac/) +* Download the installer. + +This will install Visual Studio for Mac (which is free). + +To setup MonoGame application development on mac OSX do the following: +* Go to [MonoGame Downloads page](http://www.monogame.net/downloads/) +* Click on the newest MonoGame release +* Download MonoGame for Mac +* Open the .pkg + * You will probably get an error about signing. If you do , right click and Open the .pkg file and you will be able to continue +* That's it, MonoGame is installed. + +Make sure you install mono and Visual Studio for Mac first so that MonoGame can correctly setup the +project templates and addins. diff --git a/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame_source.md b/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame_source.md new file mode 100644 index 000000000..ae1148aab --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame_source.md @@ -0,0 +1,40 @@ +This section will help you setup MonoGame by building it from source code. + +### Prerequisites + +Install the tools for the system you are building from: +* Windows: + * [Git for Windows](https://git-scm.com/download/win) + * [Visual Studio](https://www.visualstudio.com/) + * [Xamarin.Android](https://www.xamarin.com/download) (Optional) + * [Windows Phone 8 SDK](https://www.microsoft.com/en-us/download/details.aspx?id=35471) (Optional) +* Mac: + * [Git](https://git-scm.com/download/mac) + * [Xamarin Studio](https://store.xamarin.com/) + * Xamarin.Android and Xamarin.iOS can be installed with the Xamarin Studio installer (Optional) +* Linux: + * [Git](https://git-scm.com/download/linux) + * [Monodevelop](http://www.monodevelop.com/download/linux/) + +### Getting the source code + +Start up a Terminal (Mac/Linux) or Git Bash (Windows) and clone the MonoGame repository: +``` +git clone https://github.com/MonoGame/MonoGame.git +cd MonoGame +git submodule init +git submodule update +``` + +### Building from source + +MonoGame uses [Protobuild](https://protobuild.org/) to generate project and solution files. Protobuild.exe will be in your MonoGame folder. To run Protobuild: + +- On Windows run Protobuild.exe either by double-clicking or by executing it from the command line. +- On Mac/Linux open a terminal and run `mono Protobuild.exe` in the MonoGame folder. + +Once the project and solution files are generated you can build them with the IDE you installed. + +### Referencing the projects + +First get the MonoGame SDK from the [downloads page](http://www.monogame.net/downloads/) and install it to get the IDE templates. Start up the IDE you have installed and create a new project from one of the templates. Click Add > Existing Project... on your solution and select the MonoGame.Framework project that matches the template (i.e. MonoGame.Framework.Windows.csproj for a MonoGame Windows project template). The project files are located in MonoGame/MonoGame.Framework. Delete the existing MonoGame.Framework reference and add a reference to the added project by clicking Add Reference... > Projects and selecting the project. You can run your game now. If you make changes to the MonoGame.Framework project it will automatically rebuild when running your game. diff --git a/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame_windows.md b/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame_windows.md new file mode 100644 index 000000000..2aba7081f --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/setting_up_monogame_windows.md @@ -0,0 +1,20 @@ +This section will help you setup MonoGame on Windows. + +### Developing MonoGame Applications + +You will need an IDE to develop MonoGame applications, the most common on Windows is Visual Studio. +* Go to the [Visual Studio website](https://visualstudio.microsoft.com/) +* Download a Visual Studio IDE, the Community edition is free for personal use. +* Run the installer and complete the installation. + +Visual Studio is an IDE used to develop applications in, among other languages, C#. C# is the most common language used in MonoGame development. + +After installing Visual Studio, do the following: +* Go to [MonoGame Downloads page](http://www.monogame.net/downloads/) +* Click on the newest MonoGame release +* Download MonoGame for Visual Studio +* Run the installer + * You will probably get an error from Windows Defender due to the install file not being digitally signed. If you do, click "More info" and then "Run anyway" to continue the installation. +* That's it, MonoGame is installed. + +You are now ready to develop MonoGame applications using Visual Studio. The next time you open Visual Studio you will find a list of MonoGame template projects ready to use. diff --git a/Libraries/MonoGame.Framework/Src/Documentation/system_requirements.md b/Libraries/MonoGame.Framework/Src/Documentation/system_requirements.md new file mode 100644 index 000000000..b33a85723 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/system_requirements.md @@ -0,0 +1,16 @@ +This section will give you an overview of minimal system requirements for developing and running MonoGame Applications. + +### Development +* Windows - +* Linux - 1 GB Ram +* Mac - + +### Running MonoGame Application on specific Platform +* WindowsDX - DirectX 9.0c capable gpu +* WindowsGL - +* Linux - 512 MB Ram +* Mac - +* Android - Android 4.2 or higher +* iOS - +* Windows Phone - Windows Phone 10 + diff --git a/Libraries/MonoGame.Framework/Src/Documentation/tools.md b/Libraries/MonoGame.Framework/Src/Documentation/tools.md new file mode 100644 index 000000000..d197822a0 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/tools.md @@ -0,0 +1,4 @@ +This section explains the various command line tools that are part of MonoGame. + + - [2MGFX](2mgfx.md) is used to compile stand alone effects. + - [MGCB](mgcb.md) is used to build content pipeline content. diff --git a/Libraries/MonoGame.Framework/Src/Documentation/tutorials.md b/Libraries/MonoGame.Framework/Src/Documentation/tutorials.md new file mode 100644 index 000000000..c6dc83a18 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/tutorials.md @@ -0,0 +1,50 @@ +Links to various tutorials and articles to help you get started with MonoGame. + +### RB Whitaker's MonoGame Tutorials + - [1 - C# Crash Course](http://rbwhitaker.wikidot.com/c-sharp-tutorials) + - [2 - Getting started](http://rbwhitaker.wikidot.com/monogame-getting-started-tutorials) + - [3 - 2D tutorials](http://rbwhitaker.wikidot.com/monogame-2d-tutorials) + - [4 - 3D tutorials](http://rbwhitaker.wikidot.com/monogame-3d-tutorials) + - [Extra - XNA tutorials](http://rbwhitaker.wikidot.com/xna-tutorials) + +### Microsoft +Tara Walker's "Building a Shooter Game" tutorial series. + + - [Part 1: Overview, Installation, MonoGame 3.0 Project Creation](http://blogs.msdn.com/b/tarawalker/archive/2012/12/04/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-1-overview-installation-monogame-3-0-project-creation.aspx) + - [Part 2: Creating the Shooter/Player Asset of the Game](http://blogs.msdn.com/b/tarawalker/archive/2012/12/10/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-2-creating-the-shooter-player-asset-of-the-game.aspx) + - [Part 3: Updating Graphics using Content Pipeline with MonoGame](http://blogs.msdn.com/b/tarawalker/archive/2013/01/04/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-3-updating-graphics-using-content-pipeline-with-monogame.aspx) + - [Part 4: Adding and Processing Player (User) Input](http://blogs.msdn.com/b/tarawalker/archive/2013/02/23/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-4-adding-and-processing-player-user-input.aspx) + - [Part 5: Animating the Player/Ship and Creating a Parallaxing Background](http://blogs.msdn.com/b/tarawalker/archive/2013/04/12/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-5-animating-the-player-ship-and-creating-a-parallaxing-background.aspx) + - [Part 6: Creating Enemies and Detecting Collisions](http://blogs.msdn.com/b/tarawalker/archive/2013/08/26/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-6-creating-enemies-and-detecting-collisions.aspx) + - [Part 7: Creating Projectiles and Detecting Collisions](http://chrisongames.blogspot.com/2014/12/windows-8-game-development-using-c-xna.html) + - [Part 8: Creating Explosions using Sprite Animations](http://chrisongames.blogspot.com/2015/02/windows-8-game-development-using-c-xna.html) + - [Part 9: Adding Sound Effects and Game Music](http://chrisongames.blogspot.com/2015/12/windows-810-game-development-using-c.html) + +### Neil Danson's F# series + - [Part 1 - MacOS](http://neildanson.wordpress.com/2013/07/30/f-and-monogame/) + - [Part 2 - Android](http://neildanson.wordpress.com/2013/07/31/f-and-monogame-part-2-android/) + - [Part 3 - iOS](http://neildanson.wordpress.com/2013/07/31/f-and-monogame-part-3-ios/) + - [Part 4 - Content Pipeline](http://neildanson.wordpress.com/2013/08/13/f-and-monogame-part-4-content-pipeline/) + +### Others + - [How to create animations and sprite sheets for MonoGame](https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-and-animations-with-monogame) + - [Making a platformer in F# with MonoGame](http://bruinbrown.wordpress.com/2013/10/06/making-a-platformer-in-f-with-monogame/) + - [XNA 4.0 Shader Programming / HLSL](http://digitalerr0r.wordpress.com/tutorials/) + - [Using Spine with MonoGame - by Randolph Burt (Randeroo)](http://randolphburt.co.uk/2013/03/30/dragons-and-dancing-crabs/) + - [Mac porting series](http://benkane.wordpress.com/2012/01/20/the-great-porting-adventure-day-8/) + - [Porting a Windows Phone 7 Game to Android](http://warrenburch.blogspot.co.uk/2011/12/porting-windows-phone-7-game-to-android.html) + - [A series on embedding MonoGame/WinGL into WinForms](http://jaquadro.com/2013/03/bringing-your-xna-winforms-controls-to-monogame-opengl/) + - [French articles about MonoGame on Linux, Windows and Windows 8](http://www.demonixis.net/blog/category/tutoriels/tuto-xna/) + - [Dark Genesis Blog](http://darkgenesis.zenithmoon.com/tag/monogame/) + - [MonoGame "Hello World" on Mac OS X and Xamarin Studio](http://jaquadro.com/2013/09/monogame-hello-world-on-mac-os-x-and-xamarin-studio/) + - [Solving Resolution Independent Rendering And 2D Camera Using Monogame](http://blog.roboblob.com/2013/07/27/solving-resolution-independent-rendering-and-2d-camera-using-monogame/) + - [XNA is Dead; Long Live the New XNA, MonoGame](http://www.codemag.com/Article/1411081) + - [Make Santa Jump - Making an endless runner game in F# using MonoGame](http://timjones.tw/blog/archive/2014/12/28/make-santa-jump-game-in-fsharp-using-monogame) + - [Running MonoGame on Android Wear](http://crossplatform.io/running-monogame-on-android-wear/) + +## Video Tutorials + + - [CodingMadeEasy RPG Tutorial](http://www.youtube.com/watch?feature=player_embedded&v=agt9-J9RPZ0) + - [Psuedo Games Tutorials](http://www.youtube.com/watch?feature=player_embedded&v=BwtQn02oy6A) + - [Desenvolvendo jogos multiplataforma em C# com MonoGame - Alexandre Chohfi (Portuguese)](http://channel9.msdn.com/Blogs/MSDN-Brasil-Cursos-de-Desenvolvimento/Desenvolvendo-jogos-multiplataforma-em-C-com-MonoGame) + - [Desenvolvimento de jogos para Windows 8 com XNA - Alexandre Chohfi (Portuguese)](https://www.youtube.com/watch?v=gM5pRnYV1tA) diff --git a/Libraries/MonoGame.Framework/Src/Documentation/tvOS.md b/Libraries/MonoGame.Framework/Src/Documentation/tvOS.md new file mode 100644 index 000000000..19451422c --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/tvOS.md @@ -0,0 +1,53 @@ +## Menu Button Handling + +The Menu button will map to the "Back" button on the GamePad. However on tvOS, +the Menu button requires some special processing. According to the Apple +documentation the Menu Button + +"*Pauses/resumes gameplay. +Returns to previous screen, exits to main game menu, and/or exits to Apple TV Home screen.*" + +By default MonoGame will exit to the Apple TV Home screen when the Menu button is pressed, +this is not alawys the desired behviour. When in gameplay the Menu button really should +Pause the game rather than Exiting to the Home screen. + +Because MonoGame has no idea of the game state, it is down to the developer to inform +it when it can exit to the Home screen and when it should ignore the Menu event and allow +the developer to the event. + +Some sample code. + +```csharp + +public class Game1 : Game, IPlaformBackButton +{ + + private bool _isOnRootMenu = true; + + public bool Handled() + { + return !_isOnRootMenu; + } + + public Game1() + { + Services.AddService(this); + } + + public override Update(GameTime gametime) + { + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) + { + // do something in game + } + } +} +``` + +The key to this working is the `IPlatformBackButton` interface. By implementing +and registering this interface MonoGame can callback into your application to ask if it +should let you handle the Menu button or if it should pass it up to tvOS. So in this case if +the app is on the "Main menu" the developer will set *IsOnRootMenu* to true and when the Menu +button is pressed the game with Exit. However if IsOnRootMenu is false then the "Menu" button +click will be routed to the GamePad Back button and the developer can check for the Back button +press and act accordingly. diff --git a/Libraries/MonoGame.Framework/Src/Documentation/using_pipeline_tool.md b/Libraries/MonoGame.Framework/Src/Documentation/using_pipeline_tool.md new file mode 100644 index 000000000..20da18278 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/using_pipeline_tool.md @@ -0,0 +1,110 @@ +The [Pipeline Tool](pipeline.md) is used to organize and build content for use with MonoGame. It is installed as part of the MonoGame SDK Installer or can be built [directly from source](https://github.com/mono/MonoGame/tree/develop/Tools/Pipeline) if needed. + +## Create A Project + +To start a new project just select "New..." from the "File" menu. This will give you a new empty project to add content to. + +If you are starting from an existing XNA project, the Pipeline Tool supports importing your existing .contentproj. Again you can access this from the the "File" menu: + +

+ +

+ +This creates a new project, adding all your content and content settings from the XNA project. If you happened to be using custom processors you may need to edit the assembly references to link to the correct paths which we discuss next. + +## Project Settings + +You can edit the content project settings directly from the property grid editor after selecting the project node in the tree view: + +

+ +

+ +This is where you setup the folders for output, the platform to target, the assembly references for custom processors, etc. + +Note that currently the Pipeline tool is not setup to support multiple target platforms. This means you may need to manage mutliple content projects or manually change the target platform between builds. We are working on adding functionaliy to support multiple platforms and configurations within a single project. + + +## Adding Content Items + +Once you have a project setup you can add content to it for building. You can do this from the "Edit" menu: + +

+ +

+ +Selecting "New Item..." will bring up the New Item dialog which displays a list of new items that can be created: + +

+ +

+ +When you select "Existing Item..." you get to select an existing item from disk to add to the content project. + + +## Custom Content Processors + +Just like XNA, the MonoGame content pipeline supports custom content processors. To use them you need to rebuild them correctly to work against MonoGame. + +The first step is removing all `Microsoft.Xna.Framework.XXX` references and replacing them with references to `MonoGame.Framework` and `MonoGame.Framework.Content.Pipeline`. This is required as you will no longer be building against Microsoft XNA. + +Once you references are working you then need to change your assembly target platform. MonoGame does not support x86 (aka 32bit) assemblies in the content pipeline. This is mainly to allow of processing really big content as well as to simplify the number of configurations and native code dependancies. For this reason you should try to target "Any CPU" with your custom content assembly. + +After you have done these fixes you should be able to add these new processors to the content project "References". + +## Building Content + +The Pipeline Tool has 3 actions related to building content: Build, Rebuild and Clean. Build will build all content that needs to be built and put the xnb's in the output directory (bin by default). Content will be skipped if it hasn't changed since the last build. The time source content was last edited is saved in the intermediate directory (obj by default) to determine if content changed since the last build. Clean will empty the output and intermediate directories. Rebuild will first Clean and then Build. + +## Linking Content To Your Game + +Once you have built your content you have a few different ways to add the xnb's to your game project. They all have the same goal, to get the built xnb's in your project output folder so a ContentManager can easily find and load them. + +### MonoGameContentReference + +The simplest method is to setup your game project from one of the templates that come with the SDK. When you create a new project it will include a Content.mgcb file with its Build Action set to MonoGameContentReference. This build action is defined in the .targets file [here](https://github.com/MonoGame/MonoGame/blob/develop/MonoGame.Framework.Content.Pipeline/MonoGame.Content.Builder.targets). MonoGameContentReference is set up so that when the project is built, the mgcb will build any new/modified content and copy the resulting xnb's to the project output directory so they can be used in the project. Note that this way you don't even have to manually build the content with the Pipeline Tool. Just add your content to the .mgcb with the Pipeline Tool and the rest will happen when you build your project. The content files do not need to be added to your project. + +### Manual Copy + +If you don't want to use the automated process, you can build the content project with the Pipeline Tool and copy the xnb's to the output folder of your project manually. + + +### Add As Content + +If you are using Visual Studio you can simply add the xnb files to your C# game project. Create a folder in the project called Content then right click on the folder and select Add -> Existing Item. + +

+ +

+ +You will now see a file dialog from which you can add your content files. Note that if you don't want Visual Studio to make a local copy of the files be sure to use "Add As Link". + +

+ +

+ +Once the files are added you need to select them all and change their build action to "Content" and "Copy if newer". + +

+ +

+ + +### Add With Wildcard + +The more automatic option is to hand edit your game .csproj and have it include you content using wildcards. To do this just open the .csproj with any text editor then add the following after any other ``: + +``` + + + PreserveNewest + + +``` + +Then any files you put in a Content folder within your game project will automatically be included in the build. + + +## Reporting Bugs + +If you run into any problems with MGCB or the Pipeline Tool, please ask for help on the [community site](http://community.monogame.net/) or submit a [bug report on GitHub](https://github.com/MonoGame/MonoGame/issues). diff --git a/Libraries/MonoGame.Framework/Src/Documentation/welcome.md b/Libraries/MonoGame.Framework/Src/Documentation/welcome.md new file mode 100644 index 000000000..d7edfa5cf --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/welcome.md @@ -0,0 +1,16 @@ +Welcome to the MonoGame game library documentation hub. + +This area of the site contains the documentation on the API of MonoGame as well as how to use it to create great games. +Note that this is a work in progress so there will be gaps in the documentation coverage. + +If you cannot find what you need here you can also look at the [Microsoft XNA documentation](https://msdn.microsoft.com/en-us/library/bb200104.aspx). MonoGame is API compatible +with [XNA](https://msdn.microsoft.com/en-us/library/bb203940.aspx) even down to the namespaces. So usually what works for XNA will work for MonoGame too. + +Note that this documentation hub is built from the source code on every commit to the development branch. As such +it applies to the development builds available on the [Downloads](http://www.monogame.net/downloads) page. This may include new features which may +not be available in the current stable release + +### We Need Your Help! +Truly great open source projects require high quality documentation. This is call for volunteers to help us make the MonoGame documentation truly great. If you can help write tutorials, guides, code snippets, reference docs, video walkthroughs or just any improvement to our current documentation we could use your help! + +Check out the [README on GitHub](https://github.com/mono/MonoGame/blob/develop/Documentation/README.md) or [talk with us on the community site](http://community.monogame.net/t/lets-improve-the-monogame-documentation/916) to learn how to help! diff --git a/Libraries/MonoGame.Framework/Src/Documentation/what_is_monogame.md b/Libraries/MonoGame.Framework/Src/Documentation/what_is_monogame.md new file mode 100644 index 000000000..02499564e --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/Documentation/what_is_monogame.md @@ -0,0 +1,25 @@ +MonoGame is an Open Source implementation of the Microsoft XNA 4 Framework. Our goal is to allow people to make great games using a simple API. +The currently supported platforms are as follows. + + * Desktop PCs + * Windows 10 Store Apps (UWP) + * Windows Win32 (OpenGL & DirectX) + * Linux (OpenGL) + * Mac OS X (OpenGL) + * Mobile/Tablet Devices + * Android (OpenGL) + * iPhone/iPad (OpenGL) + * Windows Phone 10 +* Television + * tvOS + +MonoGame also supports a number of Game Consoles. The templates and source for these platforms +are not publicly availalbe. However they are available to developers registered with the appropriate +developer programs. + + * Consoles (for registered developers) + * PlayStation 4 (Sony) + * PlayStation Vita (Sony) + * Xbox One (both UWP and XDK) (id@xbox) + * Nintendo Switch (Nintendo) + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Addin.sln b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Addin.sln new file mode 100644 index 000000000..3e4e4086c --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Addin.sln @@ -0,0 +1,44 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.MonoGame.Core", "MonoDevelop.MonoGame.Core\MonoDevelop.MonoGame.Core.csproj", "{3FE5AAE8-BE24-4FC3-AF86-2AA3C3CD8DB4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.MonoGame", "MonoDevelop.MonoGame\MonoDevelop.MonoGame.csproj", "{B2C75BDF-A022-41C6-9618-EDD8BEE76556}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.MonoGame.Android", "MonoDevelop.MonoGame.Android\MonoDevelop.MonoGame.Android.csproj", "{FB8E0F6F-522F-4C22-A2F2-1097EB549FE5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.MonoGame.iOS", "MonoDevelop.MonoGame.iOS\MonoDevelop.MonoGame.iOS.csproj", "{B2150BB5-02A0-4CD7-A61F-C17C09045D1D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.MonoGame.Mac", "MonoDevelop.MonoGame.Mac\MonoDevelop.MonoGame.Mac.csproj", "{08E68315-4124-4199-BBD9-E57282458A31}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {08E68315-4124-4199-BBD9-E57282458A31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {08E68315-4124-4199-BBD9-E57282458A31}.Debug|Any CPU.Build.0 = Debug|Any CPU + {08E68315-4124-4199-BBD9-E57282458A31}.Release|Any CPU.ActiveCfg = Release|Any CPU + {08E68315-4124-4199-BBD9-E57282458A31}.Release|Any CPU.Build.0 = Release|Any CPU + {3FE5AAE8-BE24-4FC3-AF86-2AA3C3CD8DB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3FE5AAE8-BE24-4FC3-AF86-2AA3C3CD8DB4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3FE5AAE8-BE24-4FC3-AF86-2AA3C3CD8DB4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3FE5AAE8-BE24-4FC3-AF86-2AA3C3CD8DB4}.Release|Any CPU.Build.0 = Release|Any CPU + {B2150BB5-02A0-4CD7-A61F-C17C09045D1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2150BB5-02A0-4CD7-A61F-C17C09045D1D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2150BB5-02A0-4CD7-A61F-C17C09045D1D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2150BB5-02A0-4CD7-A61F-C17C09045D1D}.Release|Any CPU.Build.0 = Release|Any CPU + {B2C75BDF-A022-41C6-9618-EDD8BEE76556}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2C75BDF-A022-41C6-9618-EDD8BEE76556}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2C75BDF-A022-41C6-9618-EDD8BEE76556}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2C75BDF-A022-41C6-9618-EDD8BEE76556}.Release|Any CPU.Build.0 = Release|Any CPU + {FB8E0F6F-522F-4C22-A2F2-1097EB549FE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FB8E0F6F-522F-4C22-A2F2-1097EB549FE5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FB8E0F6F-522F-4C22-A2F2-1097EB549FE5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FB8E0F6F-522F-4C22-A2F2-1097EB549FE5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = ..\MonoDevelop.MonoGame\MonoDevelop.MonoGame.csproj + EndGlobalSection +EndGlobal diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/MonoDevelop.MonoGame.Android.csproj b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/MonoDevelop.MonoGame.Android.csproj new file mode 100644 index 000000000..b6209ad11 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/MonoDevelop.MonoGame.Android.csproj @@ -0,0 +1,110 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {FB8E0F6F-522F-4C22-A2F2-1097EB549FE5} + Library + MonoDevelop.MonoGame.Android + MonoDevelop.MonoGame.Android + v4.5 + + + true + full + false + ..\bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + ..\bin\Release + prompt + 4 + false + + + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/MonoDevelop.Ide.dll + False + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/MonoDevelop.Core.dll + False + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll + False + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.MonoDroid/MonoDevelop.MonoDroid.dll + False + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/Xamarin.Ide/Xamarin.Components.Ide.dll + False + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/Xamarin.Ide/Xamarin.Ide.dll + False + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop//AddIns/Xamarin.Ide.Insights/Xamarin.Ide.Insights.dll + False + + + + + + + + + {3FE5AAE8-BE24-4FC3-AF86-2AA3C3CD8DB4} + MonoDevelop.MonoGame.Core + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/MonoGameAndroidProject.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/MonoGameAndroidProject.cs new file mode 100644 index 000000000..53ce0345c --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/MonoGameAndroidProject.cs @@ -0,0 +1,29 @@ +using System; + +namespace MonoDevelop.MonoGame.Android +{ + public class MonoGameAndroidProject : MonoDevelop.MonoDroid.MonoDroidProject + { + public MonoGameAndroidProject () : base() + { + } + + public override MonoDevelop.Projects.SolutionItemConfiguration CreateConfiguration (string name) + { + return base.CreateConfiguration (name); + } + + protected override void PopulateSupportFileList (MonoDevelop.Projects.FileCopySet list, MonoDevelop.Projects.ConfigurationSelector configuration) + { + base.PopulateSupportFileList (list, configuration); + } + + [Obsolete] + public override string ProjectType { + get { + return "MonoGameAndroid"; + } + } + } +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/Properties/AssemblyInfo.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..ddff13d24 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. +[assembly: AssemblyTitle ("MonoDevelop.MonoGame.Android")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("MonoGame Team")] +[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.*")] +// 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/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/AboutAssets.txt b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/AboutAssets.txt new file mode 100644 index 000000000..ee3988629 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/AboutAssets.txt @@ -0,0 +1,19 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "AndroidAsset". + +These files will be deployed with you package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); \ No newline at end of file diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/AboutContent.txt b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/AboutContent.txt new file mode 100644 index 000000000..10f52d460 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/AboutContent.txt @@ -0,0 +1,44 @@ +Images, layout descriptions, binary blobs and string dictionaries can be included +in your application as resource files. Various Android APIs are designed to +operate on the resource IDs instead of dealing with images, strings or binary blobs +directly. + +For example, a sample Android app that contains a user interface layout (main.axml), +an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) +would keep its resources in the "Resources" directory of the application: + +Resources/ + drawable/ + icon.png + + layout/ + main.axml + + values/ + strings.xml + +In order to get the build system to recognize Android resources, set the build action to +"AndroidResource". The native Android APIs do not operate directly with filenames, but +instead operate on resource IDs. When you compile an Android application that uses resources, +the build system will package the resources for distribution and generate a class called "R" +(this is an Android convention) that contains the tokens for each one of the resources +included. For example, for the above Resources layout, this is what the R class would expose: + +public class R { + public class drawable { + public const int icon = 0x123; + } + + public class layout { + public const int main = 0x456; + } + + public class strings { + public const int first_string = 0xabc; + public const int second_string = 0xbcd; + } +} + +You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main +to reference the layout/main.axml file, or R.strings.first_string to reference the first +string in the dictionary file values/strings.xml. diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/AboutResources.txt b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/AboutResources.txt new file mode 100644 index 000000000..10f52d460 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/AboutResources.txt @@ -0,0 +1,44 @@ +Images, layout descriptions, binary blobs and string dictionaries can be included +in your application as resource files. Various Android APIs are designed to +operate on the resource IDs instead of dealing with images, strings or binary blobs +directly. + +For example, a sample Android app that contains a user interface layout (main.axml), +an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) +would keep its resources in the "Resources" directory of the application: + +Resources/ + drawable/ + icon.png + + layout/ + main.axml + + values/ + strings.xml + +In order to get the build system to recognize Android resources, set the build action to +"AndroidResource". The native Android APIs do not operate directly with filenames, but +instead operate on resource IDs. When you compile an Android application that uses resources, +the build system will package the resources for distribution and generate a class called "R" +(this is an Android convention) that contains the tokens for each one of the resources +included. For example, for the above Resources layout, this is what the R class would expose: + +public class R { + public class drawable { + public const int icon = 0x123; + } + + public class layout { + public const int main = 0x456; + } + + public class strings { + public const int first_string = 0xabc; + public const int second_string = 0xbcd; + } +} + +You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main +to reference the layout/main.axml file, or R.strings.first_string to reference the first +string in the dictionary file values/strings.xml. diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/Activity1.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/Activity1.cs new file mode 100644 index 000000000..48f7e672f --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/Activity1.cs @@ -0,0 +1,40 @@ +using System; + +using Android.App; +using Android.Content; +using Android.Runtime; +using Android.Content.PM; +using Android.Views; +using Android.Widget; +using Android.OS; + +using Microsoft.Xna.Framework; + +namespace ${Namespace} +{ + [Activity (Label = "${ProjectName}", + MainLauncher = true, + Icon = "@drawable/icon", + Theme = "@style/Theme.Splash", + AlwaysRetainTaskState=true, + LaunchMode=LaunchMode.SingleInstance, + ScreenOrientation = ScreenOrientation.FullUser, + ConfigurationChanges = ConfigChanges.Orientation | + ConfigChanges.KeyboardHidden | + ConfigChanges.Keyboard | + ConfigChanges.ScreenSize | + ConfigChanges.ScreenLayout)] + public class Activity1 : AndroidGameActivity + { + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + var g = new Game1 (); + SetContentView (g.Services.GetService()); + g.Run (); + } + + } +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/AndroidManifest.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/AndroidManifest.xml new file mode 100644 index 000000000..4ebab7d2c --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/Resource.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/Resource.cs new file mode 100644 index 000000000..491e76fe0 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/Resource.cs @@ -0,0 +1,103 @@ +#pragma warning disable 1591 +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Mono Runtime Version: 4.0.30319.17020 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ + +[assembly: Android.Runtime.ResourceDesignerAttribute("OpenGLApplication1.Resource", IsApplication=true)] + +namespace ${Namespace} +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + public partial class Resource + { + + static Resource() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + public static void UpdateIdValues() + { + } + + public partial class Attribute + { + + static Attribute() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Attribute() + { + } + } + + public partial class Drawable + { + + // aapt resource value: 0x7f020000 + public const int Icon = 2130837504; + + static Drawable() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Drawable() + { + } + } + + public partial class Id + { + + static Id() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Id() + { + } + } + + public partial class Layout + { + + static Layout() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Layout() + { + } + } + + public partial class String + { + + // aapt resource value: 0x7f040001 + public const int ApplicationName = 2130968577; + + static String() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private String() + { + } + } + } +} +#pragma warning restore 1591 diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/Splash.png b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/Splash.png new file mode 100644 index 000000000..2f8610744 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/Splash.png differ diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/Styles.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/Styles.xml new file mode 100644 index 000000000..510213401 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/Android/Styles.xml @@ -0,0 +1,7 @@ + + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/MonoGameAndroidProject.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/MonoGameAndroidProject.xpt.xml new file mode 100644 index 000000000..47b2d9c5e --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Android/templates/MonoGameAndroidProject.xpt.xml @@ -0,0 +1,63 @@ + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Core/IMonoGameProject.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Core/IMonoGameProject.cs new file mode 100644 index 000000000..d94200420 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Core/IMonoGameProject.cs @@ -0,0 +1,9 @@ +using System; + +namespace MonoDevelop.MonoGame.Core +{ + public interface IMonoGameProject + { + } +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Core/MonoDevelop.MonoGame.Core.csproj b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Core/MonoDevelop.MonoGame.Core.csproj new file mode 100644 index 000000000..af2eb9d17 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Core/MonoDevelop.MonoGame.Core.csproj @@ -0,0 +1,40 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {3FE5AAE8-BE24-4FC3-AF86-2AA3C3CD8DB4} + Library + MonoDevelop.MonoGame.Core + MonoDevelop.MonoGame.Core + v4.5 + + + true + full + false + ..\bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + ..\bin\Release + prompt + 4 + false + + + + + + + + + + \ No newline at end of file diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Core/Properties/AssemblyInfo.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Core/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..4a6cbd50e --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Core/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. +[assembly: AssemblyTitle ("MonoDevelop.MonoGame.Core")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("MonoGame Team")] +[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.*")] +// 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/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/MonoDevelop.MonoGame.Mac.csproj b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/MonoDevelop.MonoGame.Mac.csproj new file mode 100644 index 000000000..888733b7c --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/MonoDevelop.MonoGame.Mac.csproj @@ -0,0 +1,88 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {08E68315-4124-4199-BBD9-E57282458A31} + Library + MonoDevelop.MonoGame.Mac + MonoDevelop.MonoGame.Mac + v4.5 + + + true + full + false + ..\bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + ..\bin\Release + prompt + 4 + false + + + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/MonoDevelop.Ide.dll + False + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/MonoDevelop.Core.dll + False + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll + False + + + + + + + + + {3FE5AAE8-BE24-4FC3-AF86-2AA3C3CD8DB4} + MonoDevelop.MonoGame.Core + False + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/Properties/AssemblyInfo.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..1caf43bb7 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. +[assembly: AssemblyTitle ("MonoDevelop.MonoGame.Mac")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("MonoGame Team")] +[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.*")] +// 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/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/MacInfo.plist b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/MacInfo.plist new file mode 100644 index 000000000..6db7056e2 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/MacInfo.plist @@ -0,0 +1,18 @@ + + + + + CFBundleIdentifier + project.MonoGame.${Namespace} + CFBundleName + ${Namespace} + CFBundleVersion + 1 + LSMinimumSystemVersion + 10.6 + NSPrincipalClass + NSApplication + NSMainNibFile + MainMenu + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/MainMenu.xib b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/MainMenu.xib new file mode 100644 index 000000000..ff2faa0e1 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/MainMenu.xib @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/Program.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/Program.cs new file mode 100644 index 000000000..e049b8f80 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/Program.cs @@ -0,0 +1,45 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using System.Linq; + +using MonoMac.AppKit; +using MonoMac.Foundation; +#endregion + +namespace ${Namespace} +{ + static class Program + { + /// + /// The main entry point for the application. + /// + static void Main(string[] args) + { + NSApplication.Init (); + + using (var p = new NSAutoreleasePool ()) { + NSApplication.SharedApplication.Delegate = new AppDelegate(); + NSApplication.Main(args); + } + } + } + + class AppDelegate : NSApplicationDelegate + { + private static Game1 game; + + public override void FinishedLaunching (NSObject notification) + { + game = new Game1(); + game.Run(); + } + + public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender) + { + return true; + } + } + +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/XamMac2Program.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/XamMac2Program.cs new file mode 100644 index 000000000..2b695a7da --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/XamMac2Program.cs @@ -0,0 +1,26 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using System.Linq; + +using AppKit; +using Foundation; +#endregion + +namespace ${Namespace} +{ + static class Program + { + /// + /// The main entry point for the application. + /// + static void Main(string[] args) + { + NSApplication.Init (); + + using (var game = new Game1 ()) { + game.Run (); + } + } + } +} diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/XamMacProgram.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/XamMacProgram.cs new file mode 100644 index 000000000..34f0adc75 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/Mac/XamMacProgram.cs @@ -0,0 +1,27 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using System.Linq; + +using MonoMac.AppKit; +using MonoMac.Foundation; +#endregion + +namespace ${Namespace} +{ + static class Program + { + /// + /// The main entry point for the application. + /// + static void Main(string[] args) + { + NSApplication.Init (); + + using (var game = new Game1 ()) { + game.Run (); + } + } + } +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/MonoGameMacProject.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/MonoGameMacProject.xpt.xml new file mode 100644 index 000000000..3f520ab81 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/MonoGameMacProject.xpt.xml @@ -0,0 +1,49 @@ + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/MonoGameOSXProject.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/MonoGameOSXProject.xpt.xml new file mode 100644 index 000000000..0ab9c08f0 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/MonoGameOSXProject.xpt.xml @@ -0,0 +1,50 @@ + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/MonoGameXamMacProject.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/MonoGameXamMacProject.xpt.xml new file mode 100644 index 000000000..d49598230 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.Mac/templates/MonoGameXamMacProject.xpt.xml @@ -0,0 +1,56 @@ + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/MonoDevelop.MonoGame.iOS.csproj b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/MonoDevelop.MonoGame.iOS.csproj new file mode 100644 index 000000000..48de71b54 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/MonoDevelop.MonoGame.iOS.csproj @@ -0,0 +1,85 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {B2150BB5-02A0-4CD7-A61F-C17C09045D1D} + Library + MonoDevelop.MonoGame.iOS + MonoDevelop.MonoGame.iOS + v4.5 + + + true + full + false + ..\bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + ..\bin\Release + prompt + 4 + false + + + + + + + + + + + {3FE5AAE8-BE24-4FC3-AF86-2AA3C3CD8DB4} + MonoDevelop.MonoGame.Core + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + \ No newline at end of file diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/Properties/AssemblyInfo.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..53434db08 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. +[assembly: AssemblyTitle ("MonoDevelop.MonoGame.iOS")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("MonoGame Team")] +[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.*")] +// 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/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/MonoGameMobileOnly-PCL.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/MonoGameMobileOnly-PCL.xpt.xml new file mode 100644 index 000000000..f713c7041 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/MonoGameMobileOnly-PCL.xpt.xml @@ -0,0 +1,96 @@ + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/MonoGameMobileOnly-SAP.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/MonoGameMobileOnly-SAP.xpt.xml new file mode 100644 index 000000000..44e463819 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/MonoGameMobileOnly-SAP.xpt.xml @@ -0,0 +1,92 @@ + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/MonoGameiOSProject.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/MonoGameiOSProject.xpt.xml new file mode 100644 index 000000000..94b8d0fe9 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/MonoGameiOSProject.xpt.xml @@ -0,0 +1,46 @@ + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/MonoGametvOSProject.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/MonoGametvOSProject.xpt.xml new file mode 100644 index 000000000..50103cc2d --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/MonoGametvOSProject.xpt.xml @@ -0,0 +1,44 @@ + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/Shared/Activity1.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/Shared/Activity1.cs new file mode 100644 index 000000000..becdc7118 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/Shared/Activity1.cs @@ -0,0 +1,39 @@ +using System; + +using Android.App; +using Android.Content; +using Android.Runtime; +using Android.Content.PM; +using Android.Views; +using Android.Widget; +using Android.OS; + +using Microsoft.Xna.Framework; + +namespace ${Namespace} +{ + [Activity (Label = "${ProjectName}", + MainLauncher = true, + Icon = "@drawable/icon", + Theme = "@style/Theme.Splash", + AlwaysRetainTaskState=true, + LaunchMode=LaunchMode.SingleInstance, + ConfigurationChanges = ConfigChanges.Orientation | + ConfigChanges.KeyboardHidden | + ConfigChanges.Keyboard)] + public class Activity1 : AndroidGameActivity + { + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + // Create our OpenGL view, and display it + Game1.Activity = this; + var g = new Game1(); + SetContentView (g.Window); + g.Run(); + } + + } +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/Shared/Program.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/Shared/Program.cs new file mode 100644 index 000000000..a37be0bc4 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/Shared/Program.cs @@ -0,0 +1,82 @@ +#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 ${Namespace} +{ + #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(); + } + + /// + /// 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/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/Entitlements.plist.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/Entitlements.plist.xml new file mode 100644 index 000000000..0cdf11f38 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/Entitlements.plist.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/Info_tvOS.plist.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/Info_tvOS.plist.xml new file mode 100644 index 000000000..419e6eadd --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/Info_tvOS.plist.xml @@ -0,0 +1,30 @@ + + + + + CFBundleDisplayName + ${AppName} + CFBundleName + ${AppName} + CFBundleIdentifier + ${AppIdentifier} + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + MinimumOSVersion + ${MinimumOSVersion} + UIDeviceFamily + + 3 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Resources/Images.xcassets/AppIcons.appiconset + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/iOSDefault.png b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/iOSDefault.png new file mode 100644 index 000000000..1f9b909f1 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/iOSDefault.png differ diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/iOSGameThumbnail.png b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/iOSGameThumbnail.png new file mode 100644 index 000000000..99814c32f Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/iOSGameThumbnail.png differ diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/iOSInfo.plist b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/iOSInfo.plist new file mode 100644 index 000000000..4811dd198 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame.iOS/templates/iOS/iOSInfo.plist @@ -0,0 +1,23 @@ + + + + + CFBundleDisplayName + ${Namespace} + CFBundleIconFiles + + GameThumbnail.png + + CFBundleIdentifier + project.MonoGame.${Namespace} + MinimumOSVersion + 7.0 + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/ContentItemTemplate.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/ContentItemTemplate.cs new file mode 100644 index 000000000..27564325e --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/ContentItemTemplate.cs @@ -0,0 +1,53 @@ +using System; +using MonoDevelop.Ide.Templates; +using System.Xml; +using MonoDevelop.Core; +using MonoDevelop.Projects; + +namespace MonoDevelop.MonoGame +{ + public class ContentItemTemplate : FileDescriptionTemplate + { + SingleFileDescriptionTemplate template; + FileCopyMode mode = FileCopyMode.None; + + public override string Name { + get { return template.Name; } + } + + public override void Load (XmlElement filenode, FilePath baseDirectory) + { + foreach (XmlNode node in filenode.ChildNodes) { + if (node is XmlElement) { + template = CreateTemplate ((XmlElement) node, baseDirectory) as SingleFileDescriptionTemplate; + if (template == null) + throw new InvalidOperationException ("Resource templates must contain single-file templates."); + var attr = node.Attributes ["CopyToOutputDirectory"]; + if (attr != null) { + Enum.TryParse ( attr.Value, out mode); + } + return; + } + } + } + + public override bool AddToProject(SolutionFolderItem policyParent, Project project, string language, string directory, string name) + { + ProjectFile file = template.AddFileToProject(policyParent, project, language, directory, name); + if (file != null) + { + file.BuildAction = BuildAction.Content; + file.CopyToOutputDirectory = mode; + return true; + } + else + return false; + } + + public override void Show () + { + template.Show (); + } + } +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoDevelop.MonoGame.addin.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoDevelop.MonoGame.addin.xml new file mode 100644 index 000000000..122f3c62e --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoDevelop.MonoGame.addin.xml @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoDevelop.MonoGame.csproj b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoDevelop.MonoGame.csproj new file mode 100644 index 000000000..dc254792e --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoDevelop.MonoGame.csproj @@ -0,0 +1,246 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {B2C75BDF-A022-41C6-9618-EDD8BEE76556} + Library + MonoDevelop.MonoGame + MonoDevelop.MonoGame + v4.5 + + + true + full + false + ..\bin\Debug + DEBUG; + prompt + 4 + false + + + + + + + + + + + + full + true + ..\bin\Release + prompt + 4 + false + + + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/MonoDevelop.Core.dll + False + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/MonoDevelop.Ide.dll + False + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll + False + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/ICSharpCode.NRefactory.dll + False + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/Mono.TextEditor.dll + False + + + + + + + /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/Mono.Addins.dll + False + + + + + + + + + + + + + + {3FE5AAE8-BE24-4FC3-AF86-2AA3C3CD8DB4} + MonoDevelop.MonoGame.Core + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + templates\Common\OpenTK.dll.config + PreserveNewest + + + templates\Common\Tao.Sdl.dll.config + PreserveNewest + + + PreserveNewest + + + templates\Common\MonoGame.Framework.dll.config + PreserveNewest + + + templates\libs\libopenal.1.dylib + PreserveNewest + + + templates\libs\x64\libopenal.so.1 + PreserveNewest + + + templates\libs\x64\soft_oal.dll + PreserveNewest + + + templates\libs\x86\soft_oal.dll + PreserveNewest + + + templates\libs\x86\libopenal.so.1 + PreserveNewest + + + templates\libs\x64\libSDL2-2.0.so.0 + PreserveNewest + + + templates\libs\x64\SDL2.dll + PreserveNewest + + + templates\libs\x86\SDL2.dll + PreserveNewest + + + templates\libs\x86\libSDL2-2.0.so.0 + PreserveNewest + + + templates\libs\libSDL2-2.0.0.dylib + PreserveNewest + + + + + + + + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameBuildExtension.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameBuildExtension.cs new file mode 100644 index 000000000..3f98a8a57 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameBuildExtension.cs @@ -0,0 +1,148 @@ +using System; +using System.Linq; +using MonoDevelop.Projects; +using System.Diagnostics; +using System.IO; +using System.Collections.Generic; + +namespace MonoDevelop.MonoGame +{ + public class MonoGameBuildExtension : ProjectServiceExtension + { + /// + /// List of ProjectTypes which map to the Platform Enum in MonoGame + /// This is used to pass the correct /platform parameter for the auto + /// build of content. + /// + static Dictionary supportedProjectTypes = new Dictionary() { + {"MonoMac", "MacOSX"}, + {"XamMac","DesktopGL"}, + }; + + string platform; + + protected override BuildResult Build (MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, ConfigurationSelector configuration) + { + #if DEBUG + monitor.Log.WriteLine("MonoGame Extension Build Called"); + #endif + try + { + var proj = item as Project; + if (proj == null) + { + #if DEBUG + monitor.Log.WriteLine("MonoGame Extension Null Project"); + #endif + return base.Build (monitor, item, configuration); + } + #if DEBUG + foreach(var p in proj.GetProjectTypes()) { + monitor.Log.WriteLine("MonoGame Extension Project Type {0}", p); + } + #endif + if (!proj.GetProjectTypes().Any(x => supportedProjectTypes.ContainsKey(x))) + return base.Build (monitor, item, configuration); + + var files = proj.Items.Where(x => x is ProjectFile).Cast(); + foreach(var file in files.Where(f => f.BuildAction == "MonoGameContentReference")) { + monitor.Log.WriteLine ("Found MonoGame Content Builder Response File : {0}", file.FilePath); + platform = proj.GetProjectTypes().FirstOrDefault(x => supportedProjectTypes.ContainsKey(x)); + if (!string.IsNullOrEmpty (platform)) { + try { + RunMonoGameContentBuilder(file.FilePath.ToString(), supportedProjectTypes[platform], monitor); + } catch (Exception ex) { + monitor.ReportWarning(ex.ToString()); + } + } + } + return base.Build (monitor, item, configuration); + } + finally + { + #if DEBUG + monitor.Log.WriteLine("MonoGame Extension Build Ended"); + #endif + } + } + + protected override BuildResult Compile (MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) + { + var proj = item as Project; + if (proj == null) + return base.Compile (monitor, item, buildData); + if (!proj.GetProjectTypes().Any(x => supportedProjectTypes.ContainsKey(x))) + return base.Compile (monitor, item, buildData); + var files = buildData.Items.Where(x => x is ProjectFile).Cast().ToArray(); + foreach (var file in files.Where(f => f.BuildAction == "MonoGameContentReference")) { + var path = System.IO.Path.Combine (Path.GetDirectoryName (file.FilePath.ToString ()), "bin", supportedProjectTypes[platform]); + monitor.Log.WriteLine("Processing {0}", path); + if (!Directory.Exists (path)) + continue; + foreach (var output in Directory.GetFiles (path, "*.*", SearchOption.AllDirectories)) { + var link = string.Format ("Content{0}", output.Replace (path, "")); + if (proj.Files.FirstOrDefault (x => Path.GetFileName (x.FilePath.ToString ()) == Path.GetFileName (output)) == null) { + monitor.Log.WriteLine ("Auto Including Content {0}", output); + proj.Files.Add (new ProjectFile (output, BuildAction.BundleResource) { + Link = new MonoDevelop.Core.FilePath (link), + Flags = ProjectItemFlags.DontPersist | ProjectItemFlags.Hidden, + Visible = false, + }); + } + } + } + return base.Compile (monitor, item, buildData); + } + + void RunMonoGameContentBuilder(string responseFile, string platform, MonoDevelop.Core.IProgressMonitor monitor) { + var process = new Process (); + var location = Path.Combine (Path.GetDirectoryName (typeof(MonoGameBuildExtension).Assembly.Location), "MGCB.exe"); + if (!File.Exists (location)) { + switch (Environment.OSVersion.Platform) { + case PlatformID.Win32NT: + location = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86), @"MSBuild\MonoGame\v3.0\Tools", "MGCB.exe"); + break; + case PlatformID.Unix: + if (Directory.Exists ("/Applications") && + Directory.Exists ("/Users")) { + location = Path.Combine ("/Applications/Pipeline.app/Contents/MonoBundle", "MGCB.exe"); + } else { + location = Path.Combine ("/bin", "mgcb"); + } + break; + case PlatformID.MacOSX: + location = Path.Combine ("/Applications/Pipeline.app/Contents/MonoBundle", "MGCB.exe"); + break; + } + } + if (!File.Exists (location)) { + monitor.Log.WriteLine ("MGCB.exe not found"); + return; + } + process.StartInfo.WorkingDirectory = Path.GetDirectoryName (responseFile); + if (Environment.OSVersion.Platform == PlatformID.Win32NT) { + process.StartInfo.FileName = location; + process.StartInfo.Arguments = string.Format ("/@:\"{1}\" /platform:{0}", platform, responseFile); + } else if (Directory.Exists ("/Applications") && + Directory.Exists ("/Users")) { + process.StartInfo.FileName = "mono"; + process.StartInfo.Arguments = string.Format ("\"{0}\" /@:\"{2}\" /platform:{1}", location, platform, responseFile); + } else { + process.StartInfo.FileName = location; + process.StartInfo.Arguments = string.Format ("/@:\"{1}\" /platform:{0}", platform, responseFile); + } + process.StartInfo.CreateNoWindow = true; + process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + process.StartInfo.UseShellExecute = false; + process.StartInfo.RedirectStandardOutput = true; + process.OutputDataReceived += (sender, args) => monitor.Log.WriteLine(args.Data); + + monitor.Log.WriteLine ("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments); + + // Fire off the process. + process.Start(); + process.BeginOutputReadLine(); + process.WaitForExit(); + } + } +} diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameConditions.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameConditions.cs new file mode 100644 index 000000000..f7c280477 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameConditions.cs @@ -0,0 +1,38 @@ +using System; +using Mono.Addins; +using System.IO; + +namespace MonoDevelop.MonoGame +{ + public class MonoGameIsWindowsCondition : ConditionType + { + public override bool Evaluate (NodeElement conditionNode) + { + return Environment.OSVersion.Platform == PlatformID.Win32NT; + } + } + + public class MonoGameIsLinuxCondition : ConditionType + { + public override bool Evaluate (NodeElement conditionNode) + { + return Environment.OSVersion.Platform == PlatformID.Unix + && !Directory.Exists ("/Applications") + && !Directory.Exists ("/Users") + && !Directory.Exists ("/Library"); + } + } + + public class MonoGameIsMacCondition : ConditionType + { + public override bool Evaluate (NodeElement conditionNode) + { + return (Environment.OSVersion.Platform == PlatformID.Unix + && Directory.Exists("/Applications") + && Directory.Exists("/Users") + && Directory.Exists("/Library")) + || Environment.OSVersion.Platform == PlatformID.MacOSX; + } + } +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameContentEditorViewContent.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameContentEditorViewContent.cs new file mode 100644 index 000000000..c40789197 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameContentEditorViewContent.cs @@ -0,0 +1,114 @@ +using System; +using MonoDevelop.Ide.Gui; +using Gtk; +using System.IO; + +namespace MonoDevelop.MonoGame +{ + #if BUILDINEDITOR + class MonoGameContentEditorViewContent : AbstractBaseViewContent, IViewContent + { + Alignment control; + Pipeline.MacOS.MainView view; + + public event EventHandler ContentNameChanged; + public event EventHandler ContentChanged; + public event EventHandler DirtyChanged; + public event EventHandler BeforeSave; + public void Load (string fileName) + { + view.Load (fileName); + } + public void LoadNew (Stream content, string mimeType) + { + view.LoadNew (content, mimeType); + } + public void Save (string fileName) + { + view.Save (fileName); + } + public void Save () + { + view.Save (); + } + public void DiscardChanges () + { + view.Undo (); + } + public MonoDevelop.Projects.Project Project { + get ; + set; + } + public string PathRelativeToProject { + get { + return string.Empty; + } + } + public string ContentName { + get; + set; + } + public string UntitledName { + get; + set; + } + public string StockIconId { + get { + return "monogame-project"; + } + } + public bool IsUntitled { + get { + return false; + } + } + public bool IsViewOnly { + get { + return true; + } + } + public bool IsFile { + get { + return true; + } + } + public bool IsDirty { + get { return view.IsDirty; } + set { view.IsDirty = value; } + } + public bool IsReadOnly { + get { + return false; + } + } + + public override Gtk.Widget Control { + get { + return control; + } + } + + public MonoGameContentEditorViewContent (MonoDevelop.Core.FilePath filename, MonoDevelop.Projects.Project project) + { + this.ContentName = Path.GetFileName (filename.ToString()); + this.Project = project; + control = new Alignment (0, 0, 1, 1); + control.SetPadding (5, 5, 5, 5); + + view = new Pipeline.MacOS.MainView (null); + + if (filename != null) { + view.OpenProjectPath = filename.ToString(); + } + Pipeline.MacOS.MainView.CreateControllers (view); + view.BuildUI (); + + control.Add (view); + + control.ShowAll (); + } + + } + #endif +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameMSBuildImports.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameMSBuildImports.cs new file mode 100644 index 000000000..fa33621e7 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameMSBuildImports.cs @@ -0,0 +1,177 @@ +using System; +using System.Xml; +using System.Xml.XPath; +using System.Linq; +using System.Collections.Generic; +using MonoDevelop.Projects.MSBuild; +using MonoDevelop.Projects; + +namespace MonoDevelop.MonoGame +{ + public class MonoGameMSBuildImports : DotNetProjectExtension + { + const string MonoGameContentBuildTargets = "$(MSBuildExtensionsPath)\\MonoGame\\v3.0\\MonoGame.Content.Builder.targets"; + const string MonoGameCommonProps = "$(MSBuildExtensionsPath)\\MonoGame\\v3.0\\MonoGame.Common.props"; + const string MonoGameExtensionsPath = @"$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\{0}\{1}"; + const string MonoGameExtensionsAbsolutePath = @"/Library/Frameworks/MonoGame.framework/v3.0/Assemblies/{0}/{1}"; + + static bool UpgradeMonoGameProject (MonoDevelop.Core.ProgressMonitor monitor, DotNetProjectExtension extension, MSBuildProject project) + { + bool needsSave = false; + bool containsMGCB = project.ItemGroups.Any (x => x.Items.Any (i => System.IO.Path.GetExtension (i.Include) == ".mgcb")); + bool isMonoGame = project.PropertyGroups.Any (x => x.GetProperties().Any (p => p.Name == "MonoGamePlatform")) || + project.ItemGroups.Any (x => x.Items.Any (i => i.Name == "Reference" && i.Include == "MonoGame.Framework")) || + containsMGCB; + bool isDesktopGL = project.ItemGroups.Any (x => x.Items.Any (i => i.Include.EndsWith ("SDL2.dll"))); + bool isApplication = project.PropertyGroups.Any (x => x.GetProperties().Any (p => p.Name == "OutputType" && p.Value == "Exe")) + | project.PropertyGroups.Any (x => x.GetProperties().Any (p => p.Name == "AndroidApplication" && string.Compare (p.Value, bool.TrueString, true)==0)); + bool isShared = project.PropertyGroups.Any (x => x.GetProperties().Any (p => p.Name == "HasSharedItems" && p.Value == "true")); + bool absoluteReferenes = false; + var type = extension.Project.GetType ().Name; + + monitor.Log.WriteLine ("Found {0}", type); + monitor.Log.WriteLine ("Found {0}", project.GetType ().Name); + var platform = isDesktopGL ? "DesktopGL" : "Windows"; + var path = MonoGameExtensionsPath; + if (extension.Project.FlavorGuids.Contains ("{FEACFBD2-3405-455C-9665-78FE426C6842}")) { + platform = "iOS"; + } + if (extension.Project.FlavorGuids.Contains ("{06FA79CB-D6CD-4721-BB4B-1BD202089C55}")) { + platform = "tvOS"; + } + if (extension.Project.FlavorGuids.Contains ("{EFBA0AD7-5A72-4C68-AF49-83D382785DCF}")) { + platform = "Android"; + } + if (extension.Project.FlavorGuids.Contains ("{948B3504-5B70-4649-8FE4-BDE1FB46EC69}")) { + platform = "MacOSX"; + // MonoMac Classic does not use MSBuild so we need to absolute path. + path = MonoGameExtensionsAbsolutePath; + absoluteReferenes = true; + } + if (extension.Project.FlavorGuids.Contains ("{42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23}")) { + platform = "DesktopGL"; + // Xamarin.Mac Classic does not use MSBuild so we need to absolute path. + path = MonoGameExtensionsAbsolutePath; + absoluteReferenes = true; + } + if (extension.Project.FlavorGuids.Contains ("{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1}")) { + platform = "DesktopGL"; + } + monitor.Log.WriteLine ("Platform = {0}", platform); + monitor.Log.WriteLine ("Path = {0}", path); + monitor.Log.WriteLine ("isMonoGame {0}", isMonoGame); + if (isMonoGame) { + var ritems = new List (); + foreach (var ig in project.ItemGroups) { + foreach (var i in ig.Items.Where (x => x.Name == "Reference" && x.Include == "MonoGame.Framework")) { + var metaData = i.Metadata; + if (!metaData.HasProperty("HintPath")) { + monitor.Log.WriteLine ("Fixing {0} to be MonoGameContentReference", i.Include); + metaData.SetValue ("HintPath", string.Format (path, platform, "MonoGame.Framework.dll")); + needsSave = true; + } + } + foreach (var i in ig.Items.Where (x => x.Name == "Reference" && x.Include == "Tao.Sdl")) { + var metaData = i.Metadata; + if (!metaData.HasProperty("HintPath")) { + monitor.Log.WriteLine ("Fixing {0} to be Tao.Sdl", i.Include); + metaData.SetValue ("HintPath", string.Format (path, platform, "Tao.Sdl.dll")); + needsSave = true; + } + } + foreach (var i in ig.Items.Where (x => x.Name == "Reference" && x.Include.StartsWith ("OpenTK") && + (platform != "iOS" && platform != "Android"))) { + var metaData = i.Metadata; + if (!metaData.HasProperty ("HintPath")) { + monitor.Log.WriteLine("Fixing {0} to be OpenTK", i.Include); + metaData.SetValue ("HintPath", string.Format (path, platform, "OpenTK.dll")); + metaData.SetValue ("SpecificVersion", "true"); + needsSave = true; + } + } + } + foreach (var a in ritems) { + project.RemoveItem (a); + } + var dotNetProject = extension.Project; + if (dotNetProject != null && absoluteReferenes) { + var items = new List (); + var newitems = new List (); + foreach (var reference in dotNetProject.References) { + if (reference.Reference == "MonoGame.Framework" && string.IsNullOrEmpty (reference.HintPath)) { + items.Add (reference); + newitems.Add (ProjectReference.CreateCustomReference (ReferenceType.Assembly, reference.Reference, string.Format(path, platform, "MonoGame.Framework.dll"))); + } + if (reference.Reference.StartsWith ("OpenTK", StringComparison.OrdinalIgnoreCase) && string.IsNullOrEmpty (reference.HintPath)) { + items.Add (reference); + newitems.Add (ProjectReference.CreateCustomReference (ReferenceType.Assembly, reference.Reference, string.Format (path, platform, "OpenTK.dll"))); + } + if (reference.Reference == "Tao.Sdl" && string.IsNullOrEmpty (reference.HintPath)) { + items.Add (reference); + newitems.Add (ProjectReference.CreateCustomReference (ReferenceType.Assembly, reference.Reference, string.Format (path, platform, "Tao.Sdl.dll"))); + } + } + dotNetProject.References.RemoveRange (items); + dotNetProject.References.AddRange (newitems); + } + } + if (isMonoGame && containsMGCB && (isApplication || isShared)) { + if (!project.PropertyGroups.Any (x => x.GetProperties().Any (p => p.Name == "MonoGamePlatform")) && !isShared) { + monitor.Log.WriteLine ("Adding MonoGamePlatform {0}", platform == "tvOS" ? "iOS" : platform); + project.PropertyGroups.First ().SetValue ("MonoGamePlatform", platform == "tvOS" ? "iOS" : platform, true); + needsSave = true; + } + if (!project.Imports.Any (x => x.Project.StartsWith (MonoGameCommonProps, StringComparison.OrdinalIgnoreCase))&& !isShared) { + monitor.Log.WriteLine ("Adding MonoGame.Common.props Import"); + project.AddNewImport(MonoGameCommonProps, string.Format ("Exists('{0}')", MonoGameCommonProps), project.PropertyGroups.First()); + needsSave = true; + } + if (containsMGCB) { + var ritems = new List (); + foreach (var ig in project.ItemGroups) { + foreach (var i in ig.Items.Where (x => System.IO.Path.GetExtension (x.Include) == ".mgcb")) { + if (i.Name != "MonoGameContentReference" && i.Name == "None") { + monitor.Log.WriteLine ("Fixing {0} to be MonoGameContentReference", i.Include); + ig.AddNewItem ("MonoGameContentReference", i.Include); + ritems.Add (i); + needsSave = true; + } + } + } + foreach (var a in ritems) { + project.RemoveItem (a); + } + } + if (!project.Imports.Any (x => x.Project.StartsWith (MonoGameContentBuildTargets, StringComparison.OrdinalIgnoreCase)) && !isShared) { + monitor.Log.WriteLine ("Adding MonoGame Content Builder .targets"); + project.AddNewImport (MonoGameContentBuildTargets); + needsSave = true; + } + } + return needsSave; + } + + protected override void OnWriteProject(MonoDevelop.Core.ProgressMonitor monitor, MSBuildProject msproject) + { + base.OnWriteProject(monitor, msproject); + var changed = UpgradeMonoGameProject (monitor, this, msproject); + if (changed) + { + msproject.Save(msproject.FileName); + this.Project.NeedsReload = true; + } + } + + protected override void OnReadProject(MonoDevelop.Core.ProgressMonitor monitor, MSBuildProject msproject) + { + base.OnReadProject (monitor, msproject); + var changed = (UpgradeMonoGameProject(monitor, this, msproject)); + if (changed) + { + msproject.Save (msproject.FileName); + this.Project.NeedsReload = true; + } + } + } +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameProject.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameProject.cs new file mode 100644 index 000000000..cbbe89152 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/MonoGameProject.cs @@ -0,0 +1,97 @@ +using System; +using MonoDevelop.Projects.MSBuild; +using MonoDevelop.Core.Assemblies; +using System.Xml; +using MonoDevelop.Projects; + +namespace MonoDevelop.MonoGame +{ + public class MonoGameProject : DotNetAssemblyProject + { + public MonoGameProject () + { + Init (); + } + + public MonoGameProject (string languageName) + : base (languageName) + { + Init (); + } + + public MonoGameProject (string languageName, ProjectCreateInformation info, XmlElement projectOptions) + : base (languageName, info, projectOptions) + { + Init (); + } + + private void Init() + { + } + + public override SolutionItemConfiguration CreateConfiguration (string name) + { + var conf = new MonoGameProjectConfiguration (name); + conf.CopyFrom (base.CreateConfiguration (name)); + return conf; + } + + public override bool SupportsFormat (FileFormat format) + { + return format.Id == "MSBuild12"; + } + + public override TargetFrameworkMoniker GetDefaultTargetFrameworkForFormat (FileFormat format) + { + return new TargetFrameworkMoniker("4.0"); + } + + public override bool SupportsFramework (MonoDevelop.Core.Assemblies.TargetFramework framework) + { + if (!framework.CanReferenceAssembliesTargetingFramework (MonoDevelop.Core.Assemblies.TargetFrameworkMoniker.NET_4_0)) + return false; + else + return base.SupportsFramework (framework); + } + } + + public class MonoGameProjectBinding : IProjectBinding + { + public Project CreateProject (ProjectCreateInformation info, XmlElement projectOptions) + { + string lang = projectOptions.GetAttribute ("language"); + return new MonoGameProject (lang, info, projectOptions); + } + + public Project CreateSingleFileProject (string sourceFile) + { + throw new InvalidOperationException (); + } + + public bool CanCreateSingleFileProject (string sourceFile) + { + return false; + } + + public string Name { + get { return "MonoGame"; } + } + } + + public class MonoGameProjectConfiguration : DotNetProjectConfiguration + { + public MonoGameProjectConfiguration () : base () + { + } + + public MonoGameProjectConfiguration (string name) : base (name) + { + } + + public override void CopyFrom (ItemConfiguration configuration) + { + base.CopyFrom (configuration); + } + } +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/PipelineDisplayBinding.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/PipelineDisplayBinding.cs new file mode 100644 index 000000000..306cc606e --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/PipelineDisplayBinding.cs @@ -0,0 +1,104 @@ +using System; +using MonoDevelop.Ide.Gui; +using System.IO; +using System.Diagnostics; +using MonoDevelop.Ide.Gui.Content; +using Gtk; + +namespace MonoDevelop.MonoGame +{ + #if BUILDINEDITOR + public class PipelineDisplayBinding: IViewDisplayBinding + { + #region IViewDisplayBinding implementation + + public IViewContent CreateContent (MonoDevelop.Core.FilePath fileName, string mimeType, MonoDevelop.Projects.Project ownerProject) + { + return new MonoGameContentEditorViewContent (fileName, ownerProject); + } + + public string Name { + get { + return "MonoGame Content Builder"; + } + } + + #endregion + + #region IDisplayBinding implementation + + public bool CanHandle (MonoDevelop.Core.FilePath fileName, string mimeType, MonoDevelop.Projects.Project ownerProject) + { + return mimeType == "text/x-mgcb"; + } + + public bool CanUseAsDefault { + get { + return true; + } + } + + #endregion + } + #else + public class PipelineDisplayBinding : IExternalDisplayBinding { + #region IExternalDisplayBinding implementation + public MonoDevelop.Ide.Desktop.DesktopApplication GetApplication (MonoDevelop.Core.FilePath fileName, string mimeType, MonoDevelop.Projects.Project ownerProject) + { + return new PipelineDesktopApplication (fileName.FullPath,ownerProject); + } + #endregion + #region IDisplayBinding implementation + public bool CanHandle (MonoDevelop.Core.FilePath fileName, string mimeType, MonoDevelop.Projects.Project ownerProject) + { + return mimeType == "text/x-mgcb"; + } + public bool CanUseAsDefault { + get { + return true; + } + } + #endregion + + } + + class PipelineDesktopApplication : MonoDevelop.Ide.Desktop.DesktopApplication + { + MonoDevelop.Projects.Project project; + string filename; + + public PipelineDesktopApplication (string filename, MonoDevelop.Projects.Project ownerProject) + : base ("MonoGamePipelineTool", "MonoGame Pipeline Tool", true) + { + this.project = ownerProject; + this.filename = filename; + } + + public override void Launch (params string[] files) + { + var process = new Process (); + if (Environment.OSVersion.Platform == PlatformID.Win32NT) { + process.StartInfo.FileName = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86), @"MSBuild\MonoGame\v3.0\Tools", "Pipeline.exe"); + process.StartInfo.Arguments = string.Format ("\"{0}\"", filename); + } else { + if (Directory.Exists ("/Applications/Pipeline.app")) { + process.StartInfo.FileName = "open"; + process.StartInfo.EnvironmentVariables.Add("MONOGAME_PIPELINE_PROJECT", Path.GetFullPath (filename)); + process.StartInfo.Arguments = string.Format ("-b com.monogame.pipeline --args \"{0}\"", Path.GetFullPath (filename)); + } else { + // figure out linix + process.StartInfo.FileName = "monogame-pipeline-tool"; + process.StartInfo.Arguments = string.Format ("\"{0}\"", filename); + } + } + process.StartInfo.CreateNoWindow = true; + process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + process.StartInfo.UseShellExecute = false; + + // Fire off the process. + process.Start(); + } + } + #endif +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/Properties/AssemblyInfo.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..39c2b593b --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. +[assembly: AssemblyTitle ("MonoDevelop.MonoGame")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("MonoGame Team")] +[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.*")] +// 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/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/exclude.addins b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/exclude.addins new file mode 100644 index 000000000..c0041baac --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/exclude.addins @@ -0,0 +1,23 @@ + + Assimp64.dll + nvtt.dll + freetype6.dll + pvrtc.dll + templates/libs/x86/SDL2.dll + templates/libs/x64/SDL2.dll + templates/libs/x86/soft_oal.dll + templates/libs/x64/soft_oal.dll + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/icons/monogame-project-32.png b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/icons/monogame-project-32.png new file mode 100644 index 000000000..1c64b51e8 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/icons/monogame-project-32.png differ diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/AssemblyInfo.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/AssemblyInfo.cs new file mode 100644 index 000000000..28bcd70af --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/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("${ProjectName}")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("${AuthorCompany}")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("${AuthorCopyright}")] +[assembly: AssemblyTrademark("${AuthorTrademark}")] +[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/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Content.mgcb b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Content.mgcb new file mode 100644 index 000000000..70c5afb44 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Content.mgcb @@ -0,0 +1,12 @@ +#----------------------------- Global Properties ----------------------------# + +/outputDir:bin/$(Platform) +/intermediateDir:obj/$(Platform) +/config: +/profile:Reach +/compress:False + +#-------------------------------- References --------------------------------# + + +#---------------------------------- Content ---------------------------------# \ No newline at end of file diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Game1.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Game1.cs new file mode 100644 index 000000000..67e26cbe9 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Game1.cs @@ -0,0 +1,80 @@ +using System; + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace ${Namespace} +{ + /// + /// This is the main type for your game. + /// + public class Game1 : Game + { + GraphicsDeviceManager graphics; + SpriteBatch spriteBatch; + + public Game1() + { + graphics = new GraphicsDeviceManager(this); + Content.RootDirectory = "Content"; + } + + /// + /// 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); + + //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 + + 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 + + base.Draw(gameTime); + } + } +} diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Icon-hd.png b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Icon-hd.png new file mode 100644 index 000000000..631d6532d Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Icon-hd.png differ diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Icon-md.png b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Icon-md.png new file mode 100644 index 000000000..ce7f8c4a2 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Icon-md.png differ diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Icon.ico b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Icon.ico new file mode 100644 index 000000000..7d9dec187 Binary files /dev/null and b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Icon.ico differ diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Importer1.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Importer1.cs new file mode 100644 index 000000000..52c3c29cf --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Importer1.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Content.Pipeline; +using Microsoft.Xna.Framework.Content.Pipeline.Graphics; + +using TImport = System.String; + +namespace ${Namespace} +{ + [ContentImporter(".txt", DisplayName = "Importer1", DefaultProcessor = "Processor1")] + public class Importer1 : ContentImporter + { + public override TImport Import(string filename, ContentImporterContext context) + { + return default(TImport); + } + } +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Processor1.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Processor1.cs new file mode 100644 index 000000000..22906a686 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Processor1.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Content.Pipeline; +using Microsoft.Xna.Framework.Content.Pipeline.Graphics; + +using TInput = System.String; +using TOutput = System.String; + +namespace ${Namespace} +{ + [ContentProcessor(DisplayName = "Processor1")] + class Processor1 : ContentProcessor + { + public override TOutput Process(TInput input, ContentProcessorContext context) + { + return default(TOutput); + } + } +} + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Program.cs b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/Program.cs new file mode 100644 index 000000000..483f2fa8c --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/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 ${Namespace} +{ + #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/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/app.manifest b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/app.manifest new file mode 100644 index 000000000..724f8c407 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/app.manifest @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true/pm + + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameContentBuilderTemplate.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameContentBuilderTemplate.xpt.xml new file mode 100644 index 000000000..2acb64686 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameContentBuilderTemplate.xpt.xml @@ -0,0 +1,14 @@ + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameContentImporter.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameContentImporter.xpt.xml new file mode 100644 index 000000000..a831b6cef --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameContentImporter.xpt.xml @@ -0,0 +1,16 @@ + + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameContentProcessor.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameContentProcessor.xpt.xml new file mode 100644 index 000000000..ebced5805 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameContentProcessor.xpt.xml @@ -0,0 +1,15 @@ + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGamePCLProject.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGamePCLProject.xpt.xml new file mode 100644 index 000000000..a8a47ea0b --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGamePCLProject.xpt.xml @@ -0,0 +1,30 @@ + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGamePipelineProject.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGamePipelineProject.xpt.xml new file mode 100644 index 000000000..6e329adc7 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGamePipelineProject.xpt.xml @@ -0,0 +1,28 @@ + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameProject.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameProject.xpt.xml new file mode 100644 index 000000000..e30915ea6 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameProject.xpt.xml @@ -0,0 +1,80 @@ + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameSharedProject.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameSharedProject.xpt.xml new file mode 100644 index 000000000..876d6df61 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameSharedProject.xpt.xml @@ -0,0 +1,26 @@ + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameWindowsProject.xpt.xml b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameWindowsProject.xpt.xml new file mode 100644 index 000000000..d046d4f7c --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/MonoDevelop.MonoGame/templates/MonoGameWindowsProject.xpt.xml @@ -0,0 +1,42 @@ + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/default.build b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/default.build new file mode 100644 index 000000000..75af7fb16 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoDevelop/default.build @@ -0,0 +1,64 @@ + + + Default Addins Automated Build script + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/MonoGame.IDE.Extensions.sln b/Libraries/MonoGame.Framework/Src/IDE/MonoGame.IDE.Extensions.sln new file mode 100644 index 000000000..9f906d551 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/MonoGame.IDE.Extensions.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.IDE.VisualStudioForMac", "VisualStudioForMac\MonoGame.IDE.VisualStudioForMac.csproj", "{95728082-6120-4837-BB99-257181AF0506}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Templates", "..\ProjectTemplates\DotNetTemplate\MonoGame.Templates.csproj", "{01CCC19F-CEF9-4A47-9931-3F5AEF008BB1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {95728082-6120-4837-BB99-257181AF0506}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95728082-6120-4837-BB99-257181AF0506}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95728082-6120-4837-BB99-257181AF0506}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95728082-6120-4837-BB99-257181AF0506}.Release|Any CPU.Build.0 = Release|Any CPU + {01CCC19F-CEF9-4A47-9931-3F5AEF008BB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {01CCC19F-CEF9-4A47-9931-3F5AEF008BB1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {01CCC19F-CEF9-4A47-9931-3F5AEF008BB1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {01CCC19F-CEF9-4A47-9931-3F5AEF008BB1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Libraries/MonoGame.Framework/Src/IDE/VisualStudioForMac/MonoGame.IDE.VisualStudioForMac.csproj b/Libraries/MonoGame.Framework/Src/IDE/VisualStudioForMac/MonoGame.IDE.VisualStudioForMac.csproj new file mode 100644 index 000000000..116fc207b --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/VisualStudioForMac/MonoGame.IDE.VisualStudioForMac.csproj @@ -0,0 +1,156 @@ + + + net461 + $(AssemblySearchPaths);{GAC} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + monogame-project-32.png + + + monogame-android.png + + + monogame-desktopgl.png + + + monogame-ios.png + + + monogame-preview.png + + + monogame-shared.png + + + monogame-windows.png + + + project-monogame-32.png + + + project-monogame-32@2x.png + + + project-monogame-32@~dark.png + + + project-monogame-32~dark%402x.png + + + project-monogame-32~dark~sel.png + + + project-monogame-32~dark~sel%402x.png + + + project-monogame-32~sel.png + + + project-monogame-32~sel%402x.png + + + project-monogame-template.png + + + project-monogame-template%402x.png + + + project-monogame-template~dark.png + + + project-monogame-template~dark%402x.png + + + monogame-16.png + + + monogame-16@2x.png + + + monogame-16~dark.png + + + monogame-16~dark@2x.png + + + monogame-16~dark~sel.png + + + monogame-16~dark~sel@2x.png + + + monogame-16~sel.png + + + monogame-16~sel@2x.png + + + + + Templates\MonoGame.Templates.CSharp.nupkg + + + + + $(BUILD_NUMBER) + 3.7.0.0 + + + + + + + + + + + + + + diff --git a/Libraries/MonoGame.Framework/Src/IDE/VisualStudioForMac/PipelineDisplayBinding.cs b/Libraries/MonoGame.Framework/Src/IDE/VisualStudioForMac/PipelineDisplayBinding.cs new file mode 100644 index 000000000..eb9e5f2b5 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/VisualStudioForMac/PipelineDisplayBinding.cs @@ -0,0 +1,64 @@ +using System; +using System.IO; +using System.Diagnostics; +using MonoDevelop.Ide.Gui; + +namespace MonoGame.IDE.VisualStudioForMac { + public class PipelineDisplayBinding : IExternalDisplayBinding { + #region IExternalDisplayBinding implementation + public MonoDevelop.Ide.Desktop.DesktopApplication GetApplication (MonoDevelop.Core.FilePath fileName, string mimeType, MonoDevelop.Projects.Project ownerProject) + { + return new PipelineDesktopApplication (fileName.FullPath, ownerProject); + } + #endregion + #region IDisplayBinding implementation + public bool CanHandle (MonoDevelop.Core.FilePath fileName, string mimeType, MonoDevelop.Projects.Project ownerProject) + { + return mimeType == "text/x-mgcb"; + } + public bool CanUseAsDefault { + get { + return true; + } + } + #endregion + + } + + class PipelineDesktopApplication : MonoDevelop.Ide.Desktop.DesktopApplication { + MonoDevelop.Projects.Project project; + string filename; + + public PipelineDesktopApplication (string filename, MonoDevelop.Projects.Project ownerProject) + : base ("MonoGamePipelineTool", "MonoGame Pipeline Tool", true) + { + this.project = ownerProject; + this.filename = filename; + } + + public override void Launch (params string [] files) + { + var process = new Process (); + if (Environment.OSVersion.Platform == PlatformID.Win32NT) { + process.StartInfo.FileName = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86), @"MSBuild\MonoGame\v3.0\Tools", "Pipeline.exe"); + process.StartInfo.Arguments = string.Format ("\"{0}\"", filename); + } else { + if (Directory.Exists ("/Applications/Pipeline.app")) { + process.StartInfo.FileName = "open"; + process.StartInfo.EnvironmentVariables.Add ("MONOGAME_PIPELINE_PROJECT", Path.GetFullPath (filename)); + process.StartInfo.Arguments = string.Format ("-b com.monogame.pipeline --args \"{0}\"", Path.GetFullPath (filename)); + } else { + // figure out linix + process.StartInfo.FileName = "monogame-pipeline-tool"; + process.StartInfo.Arguments = string.Format ("\"{0}\"", filename); + } + } + process.StartInfo.CreateNoWindow = true; + process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + process.StartInfo.UseShellExecute = false; + + // Fire off the process. + process.Start (); + } + } +} diff --git a/Libraries/MonoGame.Framework/Src/IDE/VisualStudioForMac/Properties/AddinInfo.cs b/Libraries/MonoGame.Framework/Src/IDE/VisualStudioForMac/Properties/AddinInfo.cs new file mode 100644 index 000000000..be571ee71 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/VisualStudioForMac/Properties/AddinInfo.cs @@ -0,0 +1,8 @@ +using System; +using Mono.Addins; +using Mono.Addins.Description; +[assembly: Addin("MonoGame_IDE_VisualStudioForMac",Namespace = "MonoDevelop",Version = "0.0.0.0")] +[assembly: AddinName("MonoGame Extension")] +[assembly: AddinCategory("Game Development")] +[assembly: AddinDescription("VisualStudio for Mac extension for MonoGame")] +[assembly: AddinAuthor("@MonoGameTeam")] diff --git a/Libraries/MonoGame.Framework/Src/IDE/VisualStudioForMac/Properties/Manifest.addin.xml b/Libraries/MonoGame.Framework/Src/IDE/VisualStudioForMac/Properties/Manifest.addin.xml new file mode 100644 index 000000000..a148df5d0 --- /dev/null +++ b/Libraries/MonoGame.Framework/Src/IDE/VisualStudioForMac/Properties/Manifest.addin.xml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + +