├── .gitignore
├── Gamemaker-Sharp.csproj
├── Gamemaker-Sharp.sln
├── LICENSE
├── Properties
└── AssemblyInfo.cs
├── README.md
├── app.config
├── logos
├── LOGO16.png
├── README.md
├── logo1024.png
├── logo256.png
├── logo32.png
├── logo48.png
├── logo512.png
├── logo64.png
└── logo96.png
├── splashscreen.png
└── src
├── GMGame.cs
├── GML.cs
├── GMSharp.cs
└── GMSprite.cs
/.gitignore:
--------------------------------------------------------------------------------
1 | GameMakerSharpOLD/
2 | ## Ignore Visual Studio temporary files, build results, and
3 | ## files generated by popular Visual Studio add-ons.
4 |
5 | # User-specific files
6 | *.suo
7 | *.user
8 | *.userosscache
9 | *.sln.docstates
10 |
11 | # User-specific files (MonoDevelop/Xamarin Studio)
12 | *.userprefs
13 |
14 | # Build results
15 | [Dd]ebug/
16 | [Dd]ebugPublic/
17 | [Rr]elease/
18 | [Rr]eleases/
19 | x64/
20 | x86/
21 | build/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 |
26 | # Visual Studio 2015 cache/options directory
27 | .vs/
28 |
29 | # MSTest test Results
30 | [Tt]est[Rr]esult*/
31 | [Bb]uild[Ll]og.*
32 |
33 | # NUNIT
34 | *.VisualState.xml
35 | TestResult.xml
36 |
37 | # Build Results of an ATL Project
38 | [Dd]ebugPS/
39 | [Rr]eleasePS/
40 | dlldata.c
41 |
42 | # DNX
43 | project.lock.json
44 | artifacts/
45 |
46 | *_i.c
47 | *_p.c
48 | *_i.h
49 | *.ilk
50 | *.meta
51 | *.obj
52 | *.pch
53 | *.pdb
54 | *.pgc
55 | *.pgd
56 | *.rsp
57 | *.sbr
58 | *.tlb
59 | *.tli
60 | *.tlh
61 | *.tmp
62 | *.tmp_proj
63 | *.log
64 | *.vspscc
65 | *.vssscc
66 | .builds
67 | *.pidb
68 | *.svclog
69 | *.scc
70 |
71 | # Chutzpah Test files
72 | _Chutzpah*
73 |
74 | # Visual C++ cache files
75 | ipch/
76 | *.aps
77 | *.ncb
78 | *.opensdf
79 | *.sdf
80 | *.cachefile
81 |
82 | # Visual Studio profiler
83 | *.psess
84 | *.vsp
85 | *.vspx
86 |
87 | # TFS 2012 Local Workspace
88 | $tf/
89 |
90 | # Guidance Automation Toolkit
91 | *.gpState
92 |
93 | # ReSharper is a .NET coding add-in
94 | _ReSharper*/
95 | *.[Rr]e[Ss]harper
96 | *.DotSettings.user
97 |
98 | # JustCode is a .NET coding add-in
99 | .JustCode
100 |
101 | # TeamCity is a build add-in
102 | _TeamCity*
103 |
104 | # DotCover is a Code Coverage Tool
105 | *.dotCover
106 |
107 | # NCrunch
108 | _NCrunch_*
109 | .*crunch*.local.xml
110 |
111 | # MightyMoose
112 | *.mm.*
113 | AutoTest.Net/
114 |
115 | # Web workbench (sass)
116 | .sass-cache/
117 |
118 | # Installshield output folder
119 | [Ee]xpress/
120 |
121 | # DocProject is a documentation generator add-in
122 | DocProject/buildhelp/
123 | DocProject/Help/*.HxT
124 | DocProject/Help/*.HxC
125 | DocProject/Help/*.hhc
126 | DocProject/Help/*.hhk
127 | DocProject/Help/*.hhp
128 | DocProject/Help/Html2
129 | DocProject/Help/html
130 |
131 | # Click-Once directory
132 | publish/
133 |
134 | # Publish Web Output
135 | *.[Pp]ublish.xml
136 | *.azurePubxml
137 | ## TODO: Comment the next line if you want to checkin your
138 | ## web deploy settings but do note that will include unencrypted
139 | ## passwords
140 | #*.pubxml
141 |
142 | *.publishproj
143 |
144 | # NuGet Packages
145 | *.nupkg
146 | # The packages folder can be ignored because of Package Restore
147 | **/packages/*
148 | # except build/, which is used as an MSBuild target.
149 | !**/packages/build/
150 | # Uncomment if necessary however generally it will be regenerated when needed
151 | #!**/packages/repositories.config
152 |
153 | # Windows Azure Build Output
154 | csx/
155 | *.build.csdef
156 |
157 | # Windows Store app package directory
158 | AppPackages/
159 |
160 | # Visual Studio cache files
161 | # files ending in .cache can be ignored
162 | *.[Cc]ache
163 | # but keep track of directories ending in .cache
164 | !*.[Cc]ache/
165 |
166 | # Others
167 | ClientBin/
168 | [Ss]tyle[Cc]op.*
169 | ~$*
170 | *~
171 | *.dbmdl
172 | *.dbproj.schemaview
173 | *.pfx
174 | *.publishsettings
175 | node_modules/
176 | orleans.codegen.cs
177 |
178 | # RIA/Silverlight projects
179 | Generated_Code/
180 |
181 | # Backup & report files from converting an old project file
182 | # to a newer Visual Studio version. Backup files are not needed,
183 | # because we have git ;-)
184 | _UpgradeReport_Files/
185 | Backup*/
186 | UpgradeLog*.XML
187 | UpgradeLog*.htm
188 |
189 | # SQL Server files
190 | *.mdf
191 | *.ldf
192 |
193 | # Business Intelligence projects
194 | *.rdl.data
195 | *.bim.layout
196 | *.bim_*.settings
197 |
198 | # Microsoft Fakes
199 | FakesAssemblies/
200 |
201 | # Node.js Tools for Visual Studio
202 | .ntvs_analysis.dat
203 |
204 | # Visual Studio 6 build log
205 | *.plg
206 |
207 | # Visual Studio 6 workspace options file
208 | *.opt
209 |
210 | # LightSwitch generated files
211 | GeneratedArtifacts/
212 | _Pvt_Extensions/
213 | ModelManifest.xml
214 |
--------------------------------------------------------------------------------
/Gamemaker-Sharp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {C027E589-4F22-4A58-9D22-8F4EB151C8F9}
8 | Library
9 | Properties
10 | GMSharp
11 | GMSharp
12 | v4.5
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | TRACE;DEBUG
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 | $(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
64 |
--------------------------------------------------------------------------------
/Gamemaker-Sharp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gamemaker-Sharp", "Gamemaker-Sharp.csproj", "{C027E589-4F22-4A58-9D22-8F4EB151C8F9}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {C027E589-4F22-4A58-9D22-8F4EB151C8F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {C027E589-4F22-4A58-9D22-8F4EB151C8F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {C027E589-4F22-4A58-9D22-8F4EB151C8F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {C027E589-4F22-4A58-9D22-8F4EB151C8F9}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Game Maker is the intellectual property of YoYo Games Ltd. I do not claim otherwise, nor do I have any malicious intent.
2 |
3 | No parts of Game Maker are included within Gamemaker-Sharp. While the syntax is extremely similar (it was meant to be that
4 | way), it is all custom coding made from the ground up in MonoGame. And, of course, I'm legally allowed to place a license on
5 | my own work. Hence I can proudly say that the following license applies to this project in it's entirety. (Except maybe MonoGame.
6 | Still not sure how that works 100% yet. :|)
7 |
8 |
9 |
10 | The MIT License (MIT)
11 |
12 | Copyright (c) 2015 Radfordhound
13 |
14 | Permission is hereby granted, free of charge, to any person obtaining a copy
15 | of this software and associated documentation files (the "Software"), to deal
16 | in the Software without restriction, including without limitation the rights
17 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18 | copies of the Software, and to permit persons to whom the Software is
19 | furnished to do so, subject to the following conditions:
20 |
21 | The above copyright notice and this permission notice shall be included in all
22 | copies or substantial portions of the Software.
23 |
24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 | SOFTWARE.
31 |
32 |
33 | The font used in this software, as well as it's logos, is "Webly Sleek UI" by Mat Douglas, which is under ...er, well, I'm not
34 | quite sure what license it's under. :| As indicated here: "http://www.dafont.com/weblysleek-ui.font", it's un-clear which license it's
35 | under exactly ("Public domain/GPL/OPF" ...Okay?), but from the information I've gathered, all the licenses various sites say this font
36 | is under say it *should* be useable.
37 |
38 | If you fear of copyright issues with the included font, change icon.ico to a custom, copy-right free icon, set "GMSharp.GMSharp.useerrorfont"
39 | to false in your code and delete "errorfont.xnb" and "errorfontheader.xnb" within your game's "Resources" folder. Do note, however, that this
40 | will prevent "friendly" error messages from showing, and instead will cause your game to start acting pretty weird when it encounters an error.
41 |
--------------------------------------------------------------------------------
/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Gamemaker-Sharp")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Gamemaker-Sharp")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("c027e589-4f22-4a58-9d22-8f4eb151c8f9")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |

2 | A GML (Short for "Game Maker Language") wrapper for MonoGame/C# made to help developers more easily migrate their games from Game Maker to Monogame.
3 |
4 | ##Cut to the chase. I'm new to this. How the heck do I use it? :|
5 | Check out the [Getting started guide](https://github.com/Radfordhound/Gamemaker-Sharp/wiki/Getting-Started)! :wink:
6 |
7 | ##Wait, what? What is this again? O.o
8 | GM-Sharp is a GML wrapper for C#/MonoGame. In other words, it's a big chunk of code that allows MonoGame to understand GML code.
9 |
10 | ##Why would I want this?
11 | Let's say you're a developer who's been using Game Maker for years and is confortable with it, but is now being limited by the engine and wants to move on to actual coding to unlock the full potential of the machine. It may sound like a pretty narrow group of people to some, but in reality the target audience is actually quite broad. And, un-fortunately, a lot of these coders are a bit, shall we say, "scared" to move on to more "professional" coding methods as they fear it'll take too much of their time to learn or be too difficult.
12 |
13 | And, in a way, they'd be right. For example, let's take a simple game which draws an object to the screen and moves it around based upon keyboard button presses.
14 |
15 | In Game Maker/GML, you make a room (Let's call it 'rm_main'.), make an object (Let's call it 'obj_player'.), and make a sprite (Let's call that 'spr_player'.). Then, you use spr_player as obj_player's sprite, add obj_player to a position in your room (Let's say 'X: 0, y: 0'), and do the following in it's step event:
16 |
17 | ```Delphi
18 | if (keyboard_check(vk_left))
19 | {
20 | x-=1;
21 | }
22 | else if (keyboard_check(vk_right))
23 | {
24 | x+=1;
25 | }
26 | ```
27 |
28 | Now, in MonoGame, that whole thing looks like this:
29 |
30 | ```C#
31 | using System;
32 | using System.Collections.Generic;
33 | using Microsoft.Xna.Framework;
34 | using Microsoft.Xna.Framework.Content;
35 | using Microsoft.Xna.Framework.Graphics;
36 | using Microsoft.Xna.Framework.Input;
37 | using Microsoft.Xna.Framework.Storage;
38 | using Microsoft.Xna.Framework.GamerServices;
39 |
40 | namespace TestGame
41 | {
42 | public class Main : Game
43 | {
44 | GraphicsDeviceManager graphics;
45 | SpriteBatch spriteBatch;
46 | Texture2D spr_player;
47 | int x = 0;
48 | int y = 0;
49 |
50 | public Main(): base()
51 | {
52 | graphics = new GraphicsDeviceManager(this);
53 | Content.RootDirectory = "Content";
54 | }
55 |
56 | protected override void LoadContent()
57 | {
58 | // Create a new SpriteBatch, which can be used to draw textures.
59 | spriteBatch = new SpriteBatch(GraphicsDevice);
60 | spr_player = Content.Load("spr_player");
61 | }
62 |
63 | protected override void UnloadContent()
64 | {
65 | Content.Unload();
66 | }
67 |
68 | protected override void Update(GameTime gameTime)
69 | {
70 | if (Keyboard.GetState().IsKeyDown(Keys.Left))
71 | {
72 | x-=1;
73 | }
74 | else if (Keyboard.GetState().IsKeyDown(Keys.Right))
75 | {
76 | x+=1;
77 | }
78 |
79 | base.Update(gameTime);
80 | }
81 |
82 |
83 | protected override void Draw(GameTime gameTime)
84 | {
85 | GraphicsDevice.Clear(Color.Black);
86 |
87 | spriteBatch.Begin();
88 | spriteBatch.Draw(spr_player,new Vector2(x,y));
89 | spriteBatch.End();
90 |
91 | base.Draw(gameTime);
92 | }
93 | }
94 | }
95 | ```
96 |
97 | Yeah, a little complicated for those new to the engine! Learning how it works takes a decent amount of time, and managing to port your current Game Maker games to it without optimization problems/sloppy code (Even the above example had a bit of that!) is pretty difficult for first-time users!
98 |
99 | But MonoGame is so much faster than Game Maker, and so less limited! It's worth moving on to! And that's where GM-Sharp comes into play.
100 |
101 | The above sample in GM-Sharp is instead split into multiple files to make it more "clean." for the developer. It looks something like this:
102 |
103 | Main.cs
104 | ```C#
105 | using System;
106 | using Microsoft.Xna.Framework;
107 | using Microsoft.Xna.Framework.Graphics;
108 | using Microsoft.Xna.Framework.Input;
109 | using GMSharp;
110 | using GMSharp.Resources;
111 |
112 | namespace TestGame
113 | {
114 | public class Main : GMSharpGame
115 | {
116 | public override void Start()
117 | {
118 | Resources.Define(); //Executes the code inside resources.cs
119 | }
120 | }
121 | }
122 | ```
123 |
124 | Resources.cs
125 | ```C#
126 | using System.Collections.Generic;
127 | using System.Linq;
128 | using System.Text;
129 | using GMSharp.Resources;
130 | using GMSharp;
131 | using TestGame.Objects;
132 |
133 | namespace TestGame
134 | {
135 | public static class Resources
136 | {
137 | public static Sprite spr_player = new Sprite(new List { "spr_player" }); //Makes a sprite called 'spr_player'.
138 | public static Room rm_main = new Room(); //Makes a room called 'rm_main'.
139 |
140 | public static void Define()
141 | {
142 | rm_main.objects.Add(new obj_player()); //Adds obj_player to rm_main.
143 | Main.rooms.Add(rm_main); //Tells the game "Hey! We just added a new room called 'rm_main'!"
144 | }
145 | }
146 | }
147 | ```
148 |
149 | obj_player.cs
150 | ```C#
151 | using System;
152 | using System.Collections.Generic;
153 | using System.Linq;
154 | using System.Text;
155 | using GMSharp;
156 |
157 | namespace TestGame.Objects
158 | {
159 | public class obj_player : GMSharp.Resources.Object //Makes an object called 'obj_player'.
160 | {
161 | public override void Create() //The object's create event, like in Game Maker.
162 | {
163 | sprite = Resources.spr_player; //Set the object's sprite to 'spr_player'.
164 | }
165 |
166 | public override void Step() //The object's step event, like in Game Maker.
167 | {
168 | if (GML.keyboard_check(GML.vkeys.vk_right))
169 | {
170 | x+=1;
171 | }
172 | else if (GML.keyboard_check(GML.vkeys.vk_left))
173 | {
174 | x-=1;
175 | }
176 | }
177 | }
178 | }
179 | ```
180 |
181 | Now, yes, this still probably seems more complicated to new users. But it's much similar to GML than the plain MonoGame example used above! (And I plan on making it more like Game Maker shortly. :wink:)
182 |
183 | The point of this project, quite simply, is to get existing Game Maker users started with "real programming" more comfortably. There's still a slight learning curve, yes, but I plan on remedying that with the help of the guides on [the wiki](https://github.com/Radfordhound/Gamemaker-Sharp/wiki). I hope to help Game Maker users move on more easily! :)
184 |
185 | ##Wait? It's like Game Maker, but it's free? Is this legal? O.o
186 | While I'm no lawyer, I see no reason why it wouldn't be! This project contains 100% custom code that simply "looks like" GML. It isn't GML, it's just designed to pretend that it is to make porting Game Maker games easier. And, of course, I'm allowed to distribute my own content!
187 |
188 | The best way I can describe this project's legality is that it's relationship to Game Maker/GML is as to Mono's relationship with .NET. Both .NET and Game Maker are copy-righted pieces of work. However, while both Mono and GM-Sharp act a lot like their inspiration, they're not and are custom pieces of code from the ground up. And how's Mono doing, you may ask? Amazingly! Millions of projects around the world are using it, and Microsoft themselves (Creator of the .NET framework Mono seemingly "copied.") has acknowledged it multiple times. Quite simply, as greedy as a company may be, there's no way to copy-right custom work they didn't produce! It's not theirs! They can't own it.
189 |
190 | This isn't like taking an official picture of Mickey Mouse and claiming it's yours. This is more like making your own picture of a mouse with light-brites which somewhat resembles mickey, claiming you made **the image**, and stating that it was inspired by Mickey. It's your own work, whether it takes inspiration or not! And while I can't give expert legal advice, there's no reason why that shouldn't be allowed in my opinion.
191 |
192 | ##What license is this under?
193 | The MIT license. Yeah, that's right. MIT. Essentially, you can go crazy with it so long as you follow it's super-small list of simple terms. ;)
194 |
195 | The only exception being that, while under the MIT license you technically *could* sell this engine... well... just don't. Trust me. **You want to sell games made with this? Go right on ahead!** You can sell games made with MonoGame, which this is built off of (And basically is, in a sense.). So there's no reason you can't here as well! **But selling the actual engine? Nnoooooo. Don't do that. Trust me.**
196 |
197 | For more information, see [the license](https://github.com/Radfordhound/Gamemaker-Sharp/blob/master/LICENSE).
198 |
199 | ##More README content coming soon!
--------------------------------------------------------------------------------
/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | 183742990
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/logos/LOGO16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Radfordhound/Gamemaker-Sharp/725feee7b5751ab0de4a2b9c68ff9463812034e5/logos/LOGO16.png
--------------------------------------------------------------------------------
/logos/README.md:
--------------------------------------------------------------------------------
1 | #Logos
2 | Here you'll find some high-quality logos I quickly whipped-up for the project in various sizes.
3 | They're all under the MIT license like the rest of the project, so feel free to use em' in, say, your
4 | game. :)
5 |
6 | If you've got your own logo for the project, simply fork the repo, add your logos to your custom
7 | fork, and merge/pull request the logos folder from your fork. That way I'll see your new logos and,
8 | if I like em' (90% chance I will.. I mean, come on), I'll add them to the official repo! :)
--------------------------------------------------------------------------------
/logos/logo1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Radfordhound/Gamemaker-Sharp/725feee7b5751ab0de4a2b9c68ff9463812034e5/logos/logo1024.png
--------------------------------------------------------------------------------
/logos/logo256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Radfordhound/Gamemaker-Sharp/725feee7b5751ab0de4a2b9c68ff9463812034e5/logos/logo256.png
--------------------------------------------------------------------------------
/logos/logo32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Radfordhound/Gamemaker-Sharp/725feee7b5751ab0de4a2b9c68ff9463812034e5/logos/logo32.png
--------------------------------------------------------------------------------
/logos/logo48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Radfordhound/Gamemaker-Sharp/725feee7b5751ab0de4a2b9c68ff9463812034e5/logos/logo48.png
--------------------------------------------------------------------------------
/logos/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Radfordhound/Gamemaker-Sharp/725feee7b5751ab0de4a2b9c68ff9463812034e5/logos/logo512.png
--------------------------------------------------------------------------------
/logos/logo64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Radfordhound/Gamemaker-Sharp/725feee7b5751ab0de4a2b9c68ff9463812034e5/logos/logo64.png
--------------------------------------------------------------------------------
/logos/logo96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Radfordhound/Gamemaker-Sharp/725feee7b5751ab0de4a2b9c68ff9463812034e5/logos/logo96.png
--------------------------------------------------------------------------------
/splashscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Radfordhound/Gamemaker-Sharp/725feee7b5751ab0de4a2b9c68ff9463812034e5/splashscreen.png
--------------------------------------------------------------------------------
/src/GMGame.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Microsoft.Xna.Framework;
7 | using Microsoft.Xna.Framework.Graphics;
8 | using Microsoft.Xna.Framework.Input;
9 | using System.IO;
10 | using System.Threading;
11 |
12 | namespace GMSharp
13 | {
14 | public class GMGame : Game
15 | {
16 | public GraphicsDeviceManager graphics;
17 | public SpriteBatch spriteBatch;
18 |
19 | public Texture2D splashscreen;
20 | public bool contentloaded = false;
21 |
22 | ///
23 | /// The game's sprites.
24 | /// Access them like this: sprites["SPRITENAME"] with "SPRITENAME" being the name of the sprite you want to load.
25 | ///
26 | public Dictionary sprites = new Dictionary();
27 |
28 | public GMGame()
29 | {
30 | graphics = new GraphicsDeviceManager(this);
31 | Content.RootDirectory = "Content";
32 | }
33 |
34 | ///
35 | /// Allows the game to perform any initialization it needs to before starting to run.
36 | /// This is where it can query for any required services and load any non-graphic
37 | /// related content. Calling base.Initialize will enumerate through any components
38 | /// and initialize them as well.
39 | ///
40 | protected override void Initialize()
41 | {
42 | Window.Title = GameProperties.gamedisplayname;
43 | graphics.PreferredBackBufferWidth = 1024;
44 | graphics.PreferredBackBufferHeight = 768;
45 | graphics.ApplyChanges();
46 |
47 | base.Initialize();
48 | }
49 |
50 | ///
51 | /// LoadContent will be called once per game and is the place to load
52 | /// all of your content.
53 | ///
54 | protected override void LoadContent()
55 | {
56 | // Create a new SpriteBatch, which can be used to draw textures.
57 | spriteBatch = new SpriteBatch(GraphicsDevice);
58 |
59 | if (Directory.Exists(Main.contentpath))
60 | {
61 | splashscreen = Content.Load("splashscreen");
62 | new Thread(new ThreadStart(LoadContentThreaded)).Start();
63 | }
64 | }
65 |
66 | ///
67 | /// Loads content on a separate thread, thus allowing the game to do other stuff (such as show a splash screen).
68 | ///
69 | private void LoadContentThreaded()
70 | {
71 | if (Directory.Exists(Main.contentpath + "\\Sprites"))
72 | {
73 | //Load all the sprites with the following extensions.
74 | string[] spriteextensions = { ".xml", ".sprite.gmx", ".json" };
75 |
76 | foreach (string file in Directory.GetFiles(Main.contentpath + "\\Sprites", "*.*").Where(file => spriteextensions.Contains(Path.GetExtension(file).ToLower())))
77 | {
78 | GMSprite.LoadSprite(file);
79 | //sprites.Add(new GMSprite(Content.Load(Path.GetFileNameWithoutExtension(file)),"");
80 | }
81 | }
82 |
83 | contentloaded = true;
84 | }
85 |
86 | ///
87 | /// UnloadContent will be called once per game and is the place to unload
88 | /// game-specific content.
89 | ///
90 | protected override void UnloadContent()
91 | {
92 | Content.Unload();
93 | }
94 |
95 | ///
96 | /// Allows the game to run logic such as updating the world,
97 | /// checking for collisions, gathering input, and playing audio.
98 | ///
99 | /// Provides a snapshot of timing values.
100 | protected override void Update(GameTime gameTime)
101 | {
102 | if (Keyboard.GetState().IsKeyDown(Keys.Escape))
103 | {
104 | GML.game_restart();
105 | }
106 |
107 | base.Update(gameTime);
108 | }
109 |
110 | ///
111 | /// This is called when the game should draw itself.
112 | ///
113 | /// Provides a snapshot of timing values.
114 | protected override void Draw(GameTime gameTime)
115 | {
116 | GraphicsDevice.Clear(Color.CornflowerBlue);
117 |
118 | if (contentloaded || splashscreen != null)
119 | {
120 | spriteBatch.Begin();
121 |
122 | if (!contentloaded)
123 | {
124 | int screenwidth = GraphicsDevice.Viewport.Width, screenheight = GraphicsDevice.Viewport.Height;
125 | spriteBatch.Draw(splashscreen, new Vector2(0, -((screenwidth - screenheight) / 2)), scale: new Vector2((float)screenwidth/splashscreen.Width));
126 | }
127 | else
128 | {
129 | //TODO
130 | }
131 |
132 | spriteBatch.End();
133 | }
134 |
135 | base.Draw(gameTime);
136 | }
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/src/GML.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.IO;
7 |
8 | namespace GMSharp
9 | {
10 | public static class GML
11 | {
12 | #region Standard GML functions/variables/constants
13 |
14 | ///
15 | /// This variable holds a different constant depending on the operating system the game is currently being run with.
16 | /// Currently it should return correct values when running on Desktop Windows, Mac OSX, iOS, and Android. Other platforms will likely return "Unknown."
17 | ///
18 | public static OSType os_type = GetOS();
19 |
20 | ///
21 | /// Enumerator of Operating Systems MonoGame (GMSharp's framework) currently runs on.
22 | ///
23 | public enum OSType
24 | {
25 | os_windows, os_win8native, os_winphone, os_uwp,
26 | os_linux, os_macosx, os_ios, os_android,
27 | os_ps4, os_psvita, os_xboxone, os_ouya, os_unknown
28 | }
29 |
30 | ///
31 | /// Returns the unique game identifier. We recommend you use "Properties.Settings.Default.game_id" instead.
32 | /// (Kept in for compatibility with existing GML projects. For GMSharp, this is always set to "183742990".)
33 | ///
34 | [Obsolete("This value is only kept in for compatibility with existing GML projects. We recommend you use \"Properties.Settings.Default.game_id\" instead.")]
35 | public static readonly int game_id = 183742990;
36 |
37 | ///
38 | /// The location where the game files are saved to.
39 | ///
40 | public static string game_save_id
41 | {
42 | get
43 | {
44 | return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\" + GameProperties.gamedisplayname;
45 | }
46 | }
47 |
48 | ///
49 | /// Returns the game name string as defined in "GameProperties.gamedisplayname".
50 | ///
51 | public static string game_display_name
52 | {
53 | get
54 | {
55 | return GameProperties.gamedisplayname;
56 | }
57 | }
58 |
59 | ///
60 | /// Returns a version of the game display name as defined in "GameProperties.gamedisplayname" that's safe to use in file names (all invalid file name characters have been replaced with "_").
61 | ///
62 | public static string game_project_name
63 | {
64 | get
65 | {
66 | string projectname = GameProperties.gamedisplayname;
67 | foreach (char c in Path.GetInvalidFileNameChars())
68 | {
69 | GameProperties.gamedisplayname.Replace(c,'_');
70 | }
71 |
72 | return projectname;
73 | }
74 | }
75 |
76 | ///
77 | /// Deprecated as it's NOT SUPPORTED ON ALL PLATFORMS! Please use "Main.game.End();" instead.
78 | ///
79 | [Obsolete("game_end could not be integrated into GMSharp due to a limitation that would prevent it from running on multiple platforms. Please use \"Main.game.end\" instead.", true)]
80 | public static void game_end()
81 | {
82 | //Why are you looking at this when you could just be using Main.game.End(); instead?! :P
83 | }
84 |
85 | ///
86 | /// THIS FUNCTION HAS NOT YET BEEN IMPLEMENTED: Restarts the game.
87 | ///
88 | public static void game_restart()
89 | {
90 | //TODO: CODE GAME RESTART CLASS
91 | }
92 |
93 | //TODO: Code the following functions/variables/constants (delete each line when implemented):
94 | //game_load
95 | //game_load_buffer
96 | //game_save
97 | //game_save_buffer
98 | //script_exists
99 | //script_get_name
100 | //script_execute
101 | //gml_release_mode
102 | //gml_pragma
103 | //parameter_count
104 | //parameter_string
105 | //environment_get_variable
106 | //external_define
107 | //external_call
108 | //external_free
109 | //cursor_sprite
110 | //alarm_set
111 | //alarm_get
112 | //GM_build_date
113 | //GM_version
114 |
115 | #endregion
116 |
117 | #region Sprite-related GML functions/variables/constants
118 |
119 | ///
120 | /// Draws a sprite at a given position.
121 | ///
122 | /// The index of the sprite to draw.
123 | /// The sub-img (frame) of the sprite to draw (image_index or -1 correlate to the current frame of animation in the object).
124 | /// The x coordinate of where to draw the sprite.
125 | /// The y coordinate of where to draw the sprite.
126 | public static void draw_sprite(GMSprite sprite, int subimg, float x, float y)
127 | {
128 | //TODO: This
129 | }
130 |
131 | //TODO: Add the rest of the sprite-related GML functions/variables/constants
132 |
133 | #endregion
134 |
135 | //TODO: Add the rest of the GML functions/variables/constants
136 |
137 | #region Non-GML functions
138 |
139 | ///
140 | /// Returns the current Operating System the game is running on.
141 | /// - Currently doesn't return correct values on all platforms!! -
142 | ///
143 | /// The Operating System the game is running on.
144 | private static OSType GetOS()
145 | {
146 | //TODO: Return correct values on all platforms
147 | int platform = (int)Environment.OSVersion.Platform;
148 |
149 | #if !__MOBILE__
150 | if (platform <= 3)
151 | {
152 | return OSType.os_windows;
153 | }
154 | else if (platform == (int)PlatformID.MacOSX)
155 | {
156 | return OSType.os_macosx;
157 | }
158 | #else
159 | #if __IOS__
160 | return OSType.os_ios;
161 | #endif
162 |
163 | #if __ANDROID__
164 | return OSType.os_android;
165 | #endif
166 | #endif
167 |
168 | return OSType.os_unknown;
169 | }
170 |
171 | #endregion
172 | }
173 | }
174 |
--------------------------------------------------------------------------------
/src/GMSharp.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Reflection; //Let's take some time to reflect....
7 | using System.IO;
8 | using System.Numerics;
9 |
10 | namespace GMSharp
11 | {
12 | ///
13 | /// Contains the base variables/constants/functions pertaining to GMSharp.
14 | ///
15 | public static class Main
16 | {
17 | ///
18 | /// The path the application was started from.
19 | ///
20 | public static string startuppath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
21 |
22 | ///
23 | /// Returns the path to the game's content.
24 | /// Change "Main.game.Content.RootDirectory" if you wish to modify contentpath's value.
25 | ///
26 | public static string contentpath
27 | {
28 | get
29 | {
30 | return startuppath + "\\" + game.Content.RootDirectory;
31 | }
32 | }
33 | ///
34 | /// The main game class.
35 | ///
36 | public static GMGame game;
37 | }
38 |
39 | ///
40 | /// Contains game-related properties (many of which come from the GMS Global Game Settings window).
41 | ///
42 | public class GameProperties
43 | {
44 | ///
45 | /// The name of your game.
46 | ///
47 | public static string gamedisplayname = "GMSharp";
48 |
49 | ///
50 | /// Where game save data will be stored.
51 | /// Can be saved to the following locations:
52 | /// - The user's local application data ("SaveDataLocations.LocalAppData").
53 | /// - The user's roaming application data ("SaveDataLocations.AppData").
54 | /// - A custom location.
55 | ///
56 | public static string savedatalocation = "";
57 |
58 | ///
59 | /// Whether or not to display the game's splash screen loaded from the game's "Content/splashscreen.png" file.
60 | ///
61 | public static bool displaysplashscreen = true;
62 | }
63 |
64 | ///
65 | /// Typical locations for game save data.
66 | ///
67 | public struct SaveDataLocations
68 | {
69 | ///
70 | /// Represents the user's local application data. Typically in "C:\Users\USERNAME\AppData\Local".
71 | ///
72 | public static readonly string LocalAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
73 | ///
74 | /// Represents the user's roaming application data. Typically in "C:\Users\USERNAME\AppData\Roaming".
75 | ///
76 | public static readonly string AppData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/GMSprite.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Microsoft.Xna.Framework.Graphics;
7 | using Microsoft.Xna.Framework;
8 | using System.IO;
9 |
10 | namespace GMSharp
11 | {
12 | public class GMSprite
13 | {
14 | public Texture2D texture;
15 | public Rectangle[] frames;
16 | public int currentframe = 0, curfrm = 0, loopframe = 0;
17 | public float framerate = 1;
18 |
19 | public GMSprite(Texture2D texture, int framecount, int framewidth, int frameheight, int framesperrow, int framespercolumn, float framerate = 1, int loopframe = 0)
20 | {
21 | frames = new Rectangle[framecount];
22 | this.texture = texture;
23 | this.framerate = framerate;
24 | this.loopframe = loopframe;
25 |
26 | int i = 0;
27 | for (int y = 0; y < framespercolumn * frameheight; y += frameheight)
28 | {
29 | for (int x = 0; x < framesperrow * framewidth; x += framewidth)
30 | {
31 | if (i < framecount)
32 | {
33 | frames[i] = new Rectangle(x, y, framewidth, frameheight);
34 | i++;
35 | }
36 | else break;
37 | }
38 | }
39 | }
40 |
41 | public GMSprite(Texture2D texture, Rectangle[] frames, float framerate = 1, int loopframe = 0)
42 | {
43 | this.frames = frames;
44 | this.texture = texture;
45 | this.framerate = framerate;
46 | this.loopframe = loopframe;
47 | }
48 |
49 | ///
50 | /// Changes the sprite frame appropriately when a certain number of frames have passed.
51 | ///
52 | /// How many frames must pass before the sprite's current frame is changed.
53 | public void Animate(float framerate = 1)
54 | {
55 | if (curfrm < framerate)
56 | {
57 | curfrm++;
58 | }
59 | else if (curfrm >= framerate)
60 | {
61 | curfrm = 0;
62 | currentframe = (currentframe < frames.Length - 1) ? currentframe + 1 : loopframe;
63 | }
64 | }
65 |
66 | ///
67 | /// Loads a sprite from a given file.
68 | ///
69 | /// The path to the file.. must be within the game's "Content" folder
70 | public static void LoadSprite(string file)
71 | {
72 | string extension = Path.GetExtension(file).ToLower();
73 |
74 | if (extension == ".xml")
75 | {
76 | //TODO
77 | }
78 | else if (extension == ".sprite.gmx")
79 | {
80 | //TODO
81 | }
82 | else if (extension == ".json")
83 | {
84 | //TODO
85 | }
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------