├── Logos ├── Banner.png ├── Social.png ├── Logo_x192.png ├── Logo_BG_x192.png ├── Logo_Text_x256.png ├── Logo_Text_BG_x256.png └── Logo_Text_Light_x256.png ├── MonoGo.Samples ├── Icon.bmp ├── Icon.ico ├── Screenshots │ ├── Tiled.png │ ├── PostFX.png │ └── ColorPicker.png ├── Program.cs ├── Misc │ ├── Tiled │ │ ├── SolidTilesetTile.cs │ │ ├── BotFactory.cs │ │ └── PlayerFactory.cs │ ├── Bot.cs │ ├── PositionComponent.cs │ └── ActorComponent.cs └── SceneFactory.cs ├── Content ├── Assets │ ├── Demo │ │ ├── Misc │ │ │ ├── Font.json │ │ │ ├── Bot.json │ │ │ ├── Bot.png │ │ │ ├── Fire.png │ │ │ ├── Font.png │ │ │ ├── Test.png │ │ │ ├── Fire.json │ │ │ ├── MonoGo.json │ │ │ ├── MonoGo.png │ │ │ ├── Player.json │ │ │ ├── Player.png │ │ │ ├── DebugSquare.png │ │ │ └── Textures │ │ │ │ ├── Logo.png │ │ │ │ └── BlizzCrafter.png │ │ ├── Maps │ │ │ ├── Tilesets │ │ │ │ └── grass.png │ │ │ └── Templates │ │ │ │ ├── TemplatesTileset │ │ │ │ ├── bot.png │ │ │ │ ├── player.png │ │ │ │ └── Templates.tsx │ │ │ │ ├── Player.tx │ │ │ │ └── Bot.tx │ │ ├── GUI │ │ │ ├── MonoGoTheme │ │ │ │ ├── Textures │ │ │ │ │ ├── UI.png │ │ │ │ │ └── Icons.png │ │ │ │ └── Styles │ │ │ │ │ ├── paragraph.json │ │ │ │ │ ├── label.json │ │ │ │ │ ├── numeric_input.json │ │ │ │ │ ├── message_box_backdrop.json │ │ │ │ │ ├── numeric_input_button.json │ │ │ │ │ ├── title.json │ │ │ │ │ ├── panel.json │ │ │ │ │ ├── color_picker_handle.json │ │ │ │ │ ├── list_panel_centered.json │ │ │ │ │ ├── dropdown_icon.json │ │ │ │ │ ├── list_panel.json │ │ │ │ │ ├── slider_handle.json │ │ │ │ │ ├── radio_button.json │ │ │ │ │ ├── vertical_line.json │ │ │ │ │ ├── color_picker.json │ │ │ │ │ ├── horizontal_line.json │ │ │ │ │ ├── list_item.json │ │ │ │ │ ├── text_input.json │ │ │ │ │ ├── color_slider_horizontal.json │ │ │ │ │ ├── scrollbar_vertical.json │ │ │ │ │ ├── progress_bar_horizontal.json │ │ │ │ │ ├── progress_bar_horizontal_alt_fill.json │ │ │ │ │ ├── color_slider_horizontal_handle.json │ │ │ │ │ ├── panel_title.json │ │ │ │ │ ├── progress_bar_horizontal_fill.json │ │ │ │ │ ├── checkbox.json │ │ │ │ │ ├── paragraph_base_style.json │ │ │ │ │ ├── progress_bar_horizontal_alt.json │ │ │ │ │ ├── scrollbar_vertical_handle.json │ │ │ │ │ ├── button.json │ │ │ │ │ ├── list_item_centered.json │ │ │ │ │ ├── slider_horizontal.json │ │ │ │ │ └── slider_vertical.json │ │ │ └── DefaultTheme │ │ │ │ ├── Textures │ │ │ │ ├── UI.png │ │ │ │ └── Icons.png │ │ │ │ └── Styles │ │ │ │ ├── paragraph.json │ │ │ │ ├── label.json │ │ │ │ ├── numeric_input.json │ │ │ │ ├── message_box_backdrop.json │ │ │ │ ├── numeric_input_button.json │ │ │ │ ├── title.json │ │ │ │ ├── panel.json │ │ │ │ ├── color_picker_handle.json │ │ │ │ ├── list_panel_centered.json │ │ │ │ ├── dropdown_icon.json │ │ │ │ ├── list_panel.json │ │ │ │ ├── slider_handle.json │ │ │ │ ├── radio_button.json │ │ │ │ ├── vertical_line.json │ │ │ │ ├── color_picker.json │ │ │ │ ├── horizontal_line.json │ │ │ │ ├── list_item.json │ │ │ │ ├── text_input.json │ │ │ │ ├── color_slider_horizontal.json │ │ │ │ ├── progress_bar_horizontal.json │ │ │ │ ├── scrollbar_vertical.json │ │ │ │ ├── progress_bar_horizontal_alt_fill.json │ │ │ │ ├── color_slider_horizontal_handle.json │ │ │ │ ├── panel_title.json │ │ │ │ ├── progress_bar_horizontal_fill.json │ │ │ │ ├── checkbox.json │ │ │ │ ├── paragraph_base_style.json │ │ │ │ ├── progress_bar_horizontal_alt.json │ │ │ │ ├── scrollbar_vertical_handle.json │ │ │ │ ├── button.json │ │ │ │ ├── list_item_centered.json │ │ │ │ ├── slider_horizontal.json │ │ │ │ └── slider_vertical.json │ │ └── Misc.spritegroup │ └── Engine │ │ ├── Effects │ │ ├── LUT │ │ │ ├── Lava.png │ │ │ ├── Bright.png │ │ │ ├── Default.png │ │ │ ├── Dimmed.png │ │ │ ├── Selective.png │ │ │ ├── Solarized.png │ │ │ ├── Xray_Soft.png │ │ │ └── Xray_Strong.png │ │ ├── Grayscale.fx │ │ ├── Seizure.fx │ │ ├── Common.fxh │ │ ├── Disabled.fx │ │ └── Silhouette.fx │ │ └── LUT.spritegroup └── Content.csproj ├── Resources ├── AlphaBlend_dx.mgfxo └── AlphaBlend_gl.mgfxo ├── Templates ├── DesktopGL │ ├── Game │ │ ├── Icon.bmp │ │ ├── Icon.ico │ │ ├── Program.cs │ │ ├── SplashScreen.cs │ │ └── Game1.cs │ ├── .template.config │ │ ├── icon.png │ │ ├── ide.host.json │ │ └── template.json │ └── Content │ │ ├── Assets │ │ ├── Engine │ │ │ ├── Effects │ │ │ │ ├── LUT │ │ │ │ │ ├── Lava.png │ │ │ │ │ ├── Bright.png │ │ │ │ │ ├── Default.png │ │ │ │ │ ├── Dimmed.png │ │ │ │ │ ├── Selective.png │ │ │ │ │ ├── Solarized.png │ │ │ │ │ ├── Xray_Soft.png │ │ │ │ │ └── Xray_Strong.png │ │ │ │ ├── Grayscale.fx │ │ │ │ ├── Seizure.fx │ │ │ │ ├── Common.fxh │ │ │ │ ├── Disabled.fx │ │ │ │ └── Silhouette.fx │ │ │ └── LUT.spritegroup │ │ └── Game │ │ │ └── GUI │ │ │ └── MonoGoTheme │ │ │ ├── Textures │ │ │ ├── UI.png │ │ │ └── Icons.png │ │ │ └── Styles │ │ │ ├── paragraph.json │ │ │ ├── label.json │ │ │ ├── numeric_input.json │ │ │ ├── message_box_backdrop.json │ │ │ ├── numeric_input_button.json │ │ │ ├── title.json │ │ │ ├── panel.json │ │ │ ├── color_picker_handle.json │ │ │ ├── list_panel_centered.json │ │ │ ├── dropdown_icon.json │ │ │ ├── list_panel.json │ │ │ ├── slider_handle.json │ │ │ ├── radio_button.json │ │ │ ├── vertical_line.json │ │ │ ├── color_picker.json │ │ │ ├── horizontal_line.json │ │ │ ├── list_item.json │ │ │ ├── text_input.json │ │ │ ├── color_slider_horizontal.json │ │ │ ├── scrollbar_vertical.json │ │ │ ├── progress_bar_horizontal.json │ │ │ ├── progress_bar_horizontal_alt_fill.json │ │ │ ├── color_slider_horizontal_handle.json │ │ │ ├── panel_title.json │ │ │ ├── progress_bar_horizontal_fill.json │ │ │ ├── checkbox.json │ │ │ ├── paragraph_base_style.json │ │ │ ├── progress_bar_horizontal_alt.json │ │ │ ├── scrollbar_vertical_handle.json │ │ │ ├── button.json │ │ │ ├── list_item_centered.json │ │ │ ├── slider_horizontal.json │ │ │ └── slider_vertical.json │ │ └── Content.csproj └── MonoGo.Templates.nuspec ├── Packages.props ├── MonoGo.Engine ├── Properties │ └── AssemblyInfo.cs ├── Drawing │ ├── ShapeFill.cs │ ├── TextAlign.cs │ ├── CustomLinePrimitive.cs │ ├── CustomTrianglePrimitive.cs │ ├── IFont.cs │ ├── Vertex.cs │ ├── LineShape.cs │ ├── TriangleFanPrimitive.cs │ ├── LineStripPrimitive.cs │ └── TriangleStripPrimitive.cs ├── GraphicsBackend.cs ├── Enums │ └── EngineResources.cs ├── Utils │ ├── Tilemaps │ │ ├── ITilesetTile.cs │ │ ├── BasicTilesetTile.cs │ │ ├── ITile.cs │ │ ├── ITilemap.cs │ │ ├── BasicTile.cs │ │ └── Tileset.cs │ ├── CustomCollections │ │ ├── IPoolable.cs │ │ ├── AccumulationBuffer.cs │ │ └── Pool.cs │ ├── OnTriggerAction.cs │ ├── SlowRotator.cs │ └── Coroutines │ │ └── Coroutine.cs ├── Platform.cs ├── InspectableButtonAttribute.cs ├── ITextInputBinder.cs ├── EC │ ├── EntityDepthComparer.cs │ ├── ComponentDepthComparer.cs │ └── IEntityMethods.cs ├── IAmFollowable.cs ├── RectangleExtensions.cs ├── IAmMovable.cs ├── Collisions │ ├── Shapes │ │ ├── IShape.cs │ │ ├── ShapeType.cs │ │ └── Circle.cs │ ├── Colliders │ │ ├── CircleCollider.cs │ │ └── LineCollider.cs │ ├── Algorithms │ │ └── SimpleCollisionDetection.cs │ ├── ShapePool.cs │ ├── ColliderPool.cs │ └── CollisionSettings.cs ├── InspectableAttribute.cs ├── Resources │ ├── IResourceBox.cs │ └── SpriteGroupResourceBox.cs ├── Cameras │ ├── FilterMode.cs │ ├── PostprocessingMode.cs │ ├── CameraMgr.cs │ └── RenderMask.cs ├── CanvasMode.cs ├── MonoGo.Engine.csproj ├── IHaveGUI.cs └── StuffResolver.cs ├── MonoGo.Pipeline ├── SpriteGroup │ ├── AST │ │ ├── Node.cs │ │ ├── NumberNode.cs │ │ ├── UnaryOperationNode.cs │ │ ├── BinaryOperationNode.cs │ │ └── TokenNotExpectedException.cs │ ├── Frame.cs │ ├── RawSprite.cs │ └── SpriteGroupData.cs ├── app.config └── Tiled │ └── TiledMapImporter.cs ├── Modules ├── MonoGo.MercuryParticleEngine │ ├── BlendMode.cs │ ├── RenderingOrder.cs │ ├── Modifiers │ │ ├── IModifier.cs │ │ ├── OpacityFastFadeModifier.cs │ │ ├── RotationModifier.cs │ │ ├── OpacityInterpolator2.cs │ │ ├── ScaleInterpolator2.cs │ │ ├── HueInterpolator2.cs │ │ ├── LinearGravityModifier.cs │ │ ├── DragModifier.cs │ │ ├── VortexModifier.cs │ │ └── VelocityHueModifier.cs │ ├── Profiles │ │ ├── PointProfile.cs │ │ ├── LineProfile.cs │ │ ├── BoxFillProfile.cs │ │ ├── SprayProfile.cs │ │ ├── RingProfile.cs │ │ ├── CircleProfile.cs │ │ └── BoxUniformProfile.cs │ ├── Particle.cs │ ├── Extensions.cs │ ├── Serialization.cs │ ├── MonoGo.MercuryParticleEngine.csproj │ └── ReleaseParameters.cs ├── MonoGo.Tiled.MapStructure │ ├── Objects │ │ ├── TiledTextAlign.cs │ │ ├── TiledRectangleObject.cs │ │ ├── TiledEllipseObject.cs │ │ ├── TiledPointObject.cs │ │ ├── TiledObjectType.cs │ │ └── TiledPolygonObject.cs │ ├── TiledMapTileLayer.cs │ ├── FlipFlags.cs │ ├── TiledMapObjectDrawingOrder.cs │ ├── StaggerAxis.cs │ ├── StaggerIndex.cs │ ├── Orientation.cs │ ├── RenderOrder.cs │ ├── TiledMapObjectLayer.cs │ ├── TiledMapImageLayer.cs │ ├── MonoGo.Tiled.MapStructure.shproj │ └── TiledMapLayer.cs ├── MonoGo.Iguina │ ├── Extensions.cs │ ├── MonoGo.Iguina.csproj │ └── UIController.cs └── MonoGo.Tiled │ ├── MonoGo.Tiled.csproj │ └── ITiledEntityFactory.cs ├── Directory.Build.props ├── MonoGo.Engine.WindowsDX ├── MonoGoPlatform.cs ├── AlphaBlendEffectLoaderWindowsDX .cs └── MonoGo.Engine.WindowsDX.csproj ├── MonoGo.Engine.DesktopGL ├── AlphaBlendEffectLoaderDesktopGl.cs ├── MonoGo.Engine.DesktopGL.csproj └── MonoGoPlatform.cs ├── Tests ├── GameMathTests.cs └── MonoGo.Tests.csproj └── Nuget.props /Logos/Banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Logos/Banner.png -------------------------------------------------------------------------------- /Logos/Social.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Logos/Social.png -------------------------------------------------------------------------------- /Logos/Logo_x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Logos/Logo_x192.png -------------------------------------------------------------------------------- /Logos/Logo_BG_x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Logos/Logo_BG_x192.png -------------------------------------------------------------------------------- /MonoGo.Samples/Icon.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/MonoGo.Samples/Icon.bmp -------------------------------------------------------------------------------- /MonoGo.Samples/Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/MonoGo.Samples/Icon.ico -------------------------------------------------------------------------------- /Logos/Logo_Text_x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Logos/Logo_Text_x256.png -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/Font.json: -------------------------------------------------------------------------------- 1 | { 2 | "v": 5, 3 | "h": 20, 4 | "originX": 0, 5 | "originY": 0 6 | } 7 | -------------------------------------------------------------------------------- /Logos/Logo_Text_BG_x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Logos/Logo_Text_BG_x256.png -------------------------------------------------------------------------------- /Logos/Logo_Text_Light_x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Logos/Logo_Text_Light_x256.png -------------------------------------------------------------------------------- /Resources/AlphaBlend_dx.mgfxo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Resources/AlphaBlend_dx.mgfxo -------------------------------------------------------------------------------- /Resources/AlphaBlend_gl.mgfxo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Resources/AlphaBlend_gl.mgfxo -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/Bot.json: -------------------------------------------------------------------------------- 1 | { 2 | "v": 1, 3 | "h": 1, 4 | "originX": "center", 5 | "originY": "bottom" 6 | } 7 | -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/Bot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/Misc/Bot.png -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/Fire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/Misc/Fire.png -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/Font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/Misc/Font.png -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/Test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/Misc/Test.png -------------------------------------------------------------------------------- /Templates/DesktopGL/Game/Icon.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Templates/DesktopGL/Game/Icon.bmp -------------------------------------------------------------------------------- /Templates/DesktopGL/Game/Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Templates/DesktopGL/Game/Icon.ico -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/Fire.json: -------------------------------------------------------------------------------- 1 | { 2 | "v": 1, 3 | "h": 17, 4 | "originX": "center", 5 | "originY": "bottom" 6 | } 7 | -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/MonoGo.json: -------------------------------------------------------------------------------- 1 | { 2 | "v": 1, 3 | "h": 1, 4 | "originX": "center", 5 | "originY": "center" 6 | } 7 | -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/MonoGo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/Misc/MonoGo.png -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/Player.json: -------------------------------------------------------------------------------- 1 | { 2 | "v": 1, 3 | "h": 1, 4 | "originX": "center", 5 | "originY": "center" 6 | } 7 | -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/Player.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/Misc/Player.png -------------------------------------------------------------------------------- /MonoGo.Samples/Screenshots/Tiled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/MonoGo.Samples/Screenshots/Tiled.png -------------------------------------------------------------------------------- /Packages.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.3.7 4 | 5 | -------------------------------------------------------------------------------- /MonoGo.Samples/Screenshots/PostFX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/MonoGo.Samples/Screenshots/PostFX.png -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/DebugSquare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/Misc/DebugSquare.png -------------------------------------------------------------------------------- /MonoGo.Engine/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly:InternalsVisibleTo("MonoGo.Tests")] 4 | -------------------------------------------------------------------------------- /Content/Assets/Demo/Maps/Tilesets/grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/Maps/Tilesets/grass.png -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/Textures/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/Misc/Textures/Logo.png -------------------------------------------------------------------------------- /Content/Assets/Engine/Effects/LUT/Lava.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Engine/Effects/LUT/Lava.png -------------------------------------------------------------------------------- /MonoGo.Samples/Screenshots/ColorPicker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/MonoGo.Samples/Screenshots/ColorPicker.png -------------------------------------------------------------------------------- /Content/Assets/Engine/Effects/LUT/Bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Engine/Effects/LUT/Bright.png -------------------------------------------------------------------------------- /Content/Assets/Engine/Effects/LUT/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Engine/Effects/LUT/Default.png -------------------------------------------------------------------------------- /Content/Assets/Engine/Effects/LUT/Dimmed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Engine/Effects/LUT/Dimmed.png -------------------------------------------------------------------------------- /Templates/DesktopGL/.template.config/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Templates/DesktopGL/.template.config/icon.png -------------------------------------------------------------------------------- /Content/Assets/Engine/Effects/LUT/Selective.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Engine/Effects/LUT/Selective.png -------------------------------------------------------------------------------- /Content/Assets/Engine/Effects/LUT/Solarized.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Engine/Effects/LUT/Solarized.png -------------------------------------------------------------------------------- /Content/Assets/Engine/Effects/LUT/Xray_Soft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Engine/Effects/LUT/Xray_Soft.png -------------------------------------------------------------------------------- /MonoGo.Engine/Drawing/ShapeFill.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Engine.Drawing 2 | { 3 | public enum ShapeFill 4 | { 5 | Solid, 6 | Outline 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Textures/UI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/GUI/MonoGoTheme/Textures/UI.png -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc/Textures/BlizzCrafter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/Misc/Textures/BlizzCrafter.png -------------------------------------------------------------------------------- /Content/Assets/Engine/Effects/LUT/Xray_Strong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Engine/Effects/LUT/Xray_Strong.png -------------------------------------------------------------------------------- /MonoGo.Samples/Program.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.DesktopGL; 2 | 3 | MonoGoPlatform.Init(); 4 | using var game = new MonoGo.Samples.Game1(); 5 | game.Run(); 6 | -------------------------------------------------------------------------------- /Templates/DesktopGL/.template.config/ide.host.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/ide.host", 3 | "icon": "icon.png", 4 | "order": 0 5 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Textures/UI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/GUI/DefaultTheme/Textures/UI.png -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Textures/Icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/GUI/DefaultTheme/Textures/Icons.png -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Textures/Icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/GUI/MonoGoTheme/Textures/Icons.png -------------------------------------------------------------------------------- /Templates/DesktopGL/Game/Program.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.DesktopGL; 2 | 3 | MonoGoPlatform.Init(); 4 | using var game = new MGNamespace.Game1(); 5 | game.Run(); 6 | -------------------------------------------------------------------------------- /Content/Assets/Demo/Maps/Templates/TemplatesTileset/bot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/Maps/Templates/TemplatesTileset/bot.png -------------------------------------------------------------------------------- /MonoGo.Engine/GraphicsBackend.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Engine 3 | { 4 | public enum GraphicsBackend 5 | { 6 | DirectX, 7 | OpenGL, 8 | Other 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /MonoGo.Pipeline/SpriteGroup/AST/Node.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Pipeline.SpriteGroup.AST 2 | { 3 | abstract class Node 4 | { 5 | public abstract int Eval(); 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /Content/Assets/Demo/Maps/Templates/TemplatesTileset/player.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Content/Assets/Demo/Maps/Templates/TemplatesTileset/player.png -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Lava.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Lava.png -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/paragraph.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "MarginAfter": {"X": 0, "Y": 6} 5 | } 6 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Bright.png -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Default.png -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Dimmed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Dimmed.png -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/paragraph.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "MarginAfter": {"X": 0, "Y": 6} 5 | } 6 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Selective.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Selective.png -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Solarized.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Solarized.png -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Xray_Soft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Xray_Soft.png -------------------------------------------------------------------------------- /Content/Assets/Engine/LUT.spritegroup: -------------------------------------------------------------------------------- 1 | { 2 | "atlasSize": 512, 3 | "texturePadding": 1, 4 | "rootDir": "/Effects", 5 | "singleTexturesWildcards": 6 | [ 7 | "/LUT/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/BlendMode.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.MercuryParticleEngine 2 | { 3 | public enum BlendMode { 4 | Alpha, 5 | Add, 6 | Subtract 7 | } 8 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Xray_Strong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Templates/DesktopGL/Content/Assets/Engine/Effects/LUT/Xray_Strong.png -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Textures/UI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Textures/UI.png -------------------------------------------------------------------------------- /Content/Assets/Demo/Misc.spritegroup: -------------------------------------------------------------------------------- 1 | { 2 | "atlasSize": 512, 3 | "texturePadding": 1, 4 | "rootDir": "/Misc", 5 | "singleTexturesWildcards": 6 | [ 7 | "/Textures/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/RenderingOrder.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.MercuryParticleEngine 2 | { 3 | public enum RenderingOrder { 4 | FrontToBack, 5 | BackToFront 6 | } 7 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/paragraph.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "MarginAfter": {"X": 0, "Y": 6} 5 | } 6 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Textures/Icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MonoGo-Engine/MonoGo/HEAD/Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Textures/Icons.png -------------------------------------------------------------------------------- /MonoGo.Engine/Enums/EngineResources.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Engine.Enums 2 | { 3 | public enum EngineResources 4 | { 5 | LUTSprites, 6 | Effects, 7 | Fonts 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/LUT.spritegroup: -------------------------------------------------------------------------------- 1 | { 2 | "atlasSize": 512, 3 | "texturePadding": 1, 4 | "rootDir": "/Effects", 5 | "singleTexturesWildcards": 6 | [ 7 | "/LUT/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /MonoGo.Engine/Utils/Tilemaps/ITilesetTile.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.Drawing; 2 | 3 | namespace MonoGo.Engine.Utils.Tilemaps 4 | { 5 | public interface ITilesetTile 6 | { 7 | Frame Frame {get;} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | false 6 | 7 | -------------------------------------------------------------------------------- /MonoGo.Engine/Platform.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Engine 3 | { 4 | public enum Platform 5 | { 6 | Windows, 7 | Linux, 8 | MacOS, 9 | Android, 10 | iOS, 11 | Xbox, 12 | PlayStation, 13 | Switch, 14 | Other 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /MonoGo.Pipeline/SpriteGroup/Frame.cs: -------------------------------------------------------------------------------- 1 | 2 | using Microsoft.Xna.Framework; 3 | 4 | namespace MonoGo.Pipeline.SpriteGroup 5 | { 6 | public class Frame 7 | { 8 | public Rectangle TexturePos; 9 | public int TextureIndex; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Content/Assets/Demo/Maps/Templates/Player.tx: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /MonoGo.Engine/InspectableButtonAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoGo.Engine 4 | { 5 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] 6 | public class InspectableButtonAttribute : Attribute 7 | { 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/label.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "TextFillColor": {"R": 220, "G": 220, "B": 220, "A": 255}, 5 | "TextScale": 0.85, 6 | "MarginAfter": {"X": 0, "Y": 2} 7 | } 8 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/label.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "TextFillColor": {"R": 220, "G": 220, "B": 220, "A": 255}, 5 | "TextScale": 0.85, 6 | "MarginAfter": {"X": 0, "Y": 2} 7 | } 8 | } -------------------------------------------------------------------------------- /MonoGo.Engine/ITextInputBinder.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Engine 2 | { 3 | /// 4 | /// Binds Input.TextInput to the platform-specific text input provider. 5 | /// 6 | internal interface ITextInputBinder 7 | { 8 | void Init(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/numeric_input.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "text_input.json", 3 | "Default": { 4 | "TextAlignment": "Center", 5 | "Padding": {"Left": 2, "Right": 2, "Top": 6, "Bottom": 6} 6 | }, 7 | "DefaultTextAnchor": "Center" 8 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/numeric_input.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "text_input.json", 3 | "Default": { 4 | "TextAlignment": "Center", 5 | "Padding": {"Left": 2, "Right": 2, "Top": 6, "Bottom": 6} 6 | }, 7 | "DefaultTextAnchor": "Center" 8 | } -------------------------------------------------------------------------------- /MonoGo.Engine/EC/EntityDepthComparer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace MonoGo.Engine.EC 4 | { 5 | internal class EntityDepthComparer : IComparer 6 | { 7 | public int Compare(Entity x, Entity y) => 8 | y.Depth - x.Depth; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/Objects/TiledTextAlign.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Tiled.MapStructure.Objects 3 | { 4 | public enum TiledTextAlign : byte 5 | { 6 | Left = 0, 7 | Right = 2, 8 | Top = 0, 9 | Bottom = 2, 10 | Center = 1, 11 | Justify = 3, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/label.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "TextFillColor": {"R": 220, "G": 220, "B": 220, "A": 255}, 5 | "TextScale": 0.85, 6 | "MarginAfter": {"X": 0, "Y": 2} 7 | } 8 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/numeric_input.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "text_input.json", 3 | "Default": { 4 | "TextAlignment": "Center", 5 | "Padding": {"Left": 2, "Right": 2, "Top": 6, "Bottom": 6} 6 | }, 7 | "DefaultTextAnchor": "Center" 8 | } -------------------------------------------------------------------------------- /MonoGo.Engine/EC/ComponentDepthComparer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace MonoGo.Engine.EC 4 | { 5 | internal class ComponentDepthComparer : IComparer 6 | { 7 | public int Compare(Component x, Component y) => 8 | y.Depth - x.Depth; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /MonoGo.Engine/IAmFollowable.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Engine 2 | { 3 | /// 4 | /// Make your object followable by adding an property. 5 | /// 6 | public interface IAmFollowable 7 | { 8 | public IAmMovable Followable { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/TiledMapTileLayer.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Tiled.MapStructure 3 | { 4 | public class TiledMapTileLayer : TiledMapLayer 5 | { 6 | public int Width; 7 | public int Height; 8 | public int TileWidth; 9 | public int TileHeight; 10 | public TiledMapTile[][] Tiles; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/message_box_backdrop.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "BackgroundColor": { 4 | "R": 0, 5 | "G": 0, 6 | "B": 0, 7 | "A": 150 8 | } 9 | }, 10 | "Disabled": { 11 | "EffectIdentifier": "disabled" 12 | }, 13 | "InterpolateStatesSpeed": 2.5 14 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/message_box_backdrop.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "BackgroundColor": { 4 | "R": 0, 5 | "G": 0, 6 | "B": 0, 7 | "A": 150 8 | } 9 | }, 10 | "Disabled": { 11 | "EffectIdentifier": "disabled" 12 | }, 13 | "InterpolateStatesSpeed": 2.5 14 | } -------------------------------------------------------------------------------- /MonoGo.Engine/RectangleExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace MonoGo.Engine 4 | { 5 | public static class RectangleExtensions 6 | { 7 | public static RectangleF ToRectangleF(this Rectangle rectagle) => 8 | new RectangleF(rectagle.X, rectagle.Y, rectagle.Width, rectagle.Height); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /MonoGo.Engine/Utils/Tilemaps/BasicTilesetTile.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.Drawing; 2 | 3 | namespace MonoGo.Engine.Utils.Tilemaps 4 | { 5 | public class BasicTilesetTile : ITilesetTile 6 | { 7 | public Frame Frame {get; private set;} 8 | 9 | public BasicTilesetTile(Frame frame) => 10 | Frame = frame; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /MonoGo.Engine/Utils/Tilemaps/ITile.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Engine.Utils.Tilemaps 3 | { 4 | /// 5 | /// Tile interface. 6 | /// 7 | public interface ITile 8 | { 9 | int Index {get; set;} 10 | bool IsBlank {get;} 11 | bool FlipHor {get; set;} 12 | bool FlipVer {get; set;} 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/numeric_input_button.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "button.json", 3 | "Default": { 4 | "MarginBefore": {"X": 4, "Y": 0}, 5 | "MarginAfter": {"X": 4, "Y": 0} 6 | }, 7 | "DefaultWidth": {"Units": "Pixels", "Value": 40}, 8 | "DefaultHeight": {"Units": "Pixels", "Value": 40} 9 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/numeric_input_button.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "button.json", 3 | "Default": { 4 | "MarginBefore": {"X": 4, "Y": 0}, 5 | "MarginAfter": {"X": 4, "Y": 0} 6 | }, 7 | "DefaultWidth": {"Units": "Pixels", "Value": 40}, 8 | "DefaultHeight": {"Units": "Pixels", "Value": 40} 9 | } -------------------------------------------------------------------------------- /MonoGo.Pipeline/SpriteGroup/AST/NumberNode.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Pipeline.SpriteGroup.AST 2 | { 3 | class NumberNode : Node 4 | { 5 | public NumberNode(int number) 6 | { 7 | _number = number; 8 | } 9 | 10 | int _number; 11 | 12 | public override int Eval() 13 | { 14 | return _number; 15 | } 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /MonoGo.Engine/Drawing/TextAlign.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Engine.Drawing 2 | { 3 | /// 4 | /// Use for serious graphical user interfaces! 5 | /// 6 | public enum TextAlign : int 7 | { 8 | Left = 0, 9 | Right = 2, 10 | Top = 0, 11 | Bottom = 2, 12 | Center = 1 13 | } 14 | } -------------------------------------------------------------------------------- /MonoGo.Engine/IAmMovable.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace MonoGo.Engine 4 | { 5 | /// 6 | /// Make your object movable by adding a property. 7 | /// 8 | public interface IAmMovable 9 | { 10 | public Vector2 Position { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/message_box_backdrop.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "BackgroundColor": { 4 | "R": 0, 5 | "G": 0, 6 | "B": 0, 7 | "A": 150 8 | } 9 | }, 10 | "Disabled": { 11 | "EffectIdentifier": "disabled" 12 | }, 13 | "InterpolateStatesSpeed": 2.5 14 | } -------------------------------------------------------------------------------- /MonoGo.Engine/Collisions/Shapes/IShape.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.Utils; 2 | 3 | namespace MonoGo.Engine.Collisions.Shapes 4 | { 5 | /// 6 | /// Defines a concave shape for the collision system to use. 7 | /// 8 | public interface IShape 9 | { 10 | ShapeType Type { get; } 11 | 12 | AABB GetBoundingBox(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/numeric_input_button.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "button.json", 3 | "Default": { 4 | "MarginBefore": {"X": 4, "Y": 0}, 5 | "MarginAfter": {"X": 4, "Y": 0} 6 | }, 7 | "DefaultWidth": {"Units": "Pixels", "Value": 40}, 8 | "DefaultHeight": {"Units": "Pixels", "Value": 40} 9 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/Maps/Templates/Bot.tx: -------------------------------------------------------------------------------- 1 | 2 | 10 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/title.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255}, 5 | "TextScale": 1.2, 6 | "TextOutlineWidth": 3, 7 | "TextSpacing": 3, 8 | "TextAlignment": "Center" 9 | }, 10 | "DefaultTextAnchor": "AutoCenter" 11 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/title.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255}, 5 | "TextScale": 1.2, 6 | "TextOutlineWidth": 3, 7 | "TextSpacing": 3, 8 | "TextAlignment": "Center" 9 | }, 10 | "DefaultTextAnchor": "AutoCenter" 11 | } -------------------------------------------------------------------------------- /MonoGo.Engine/Collisions/Shapes/ShapeType.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Engine.Collisions.Shapes 2 | { 3 | public enum ShapeType 4 | { 5 | /// 6 | /// Circle shape is represented by a single point and radius. 7 | /// 8 | Circle, 9 | /// 10 | /// Polygon shape is represented by a set of points. 11 | /// 12 | Polygon 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/title.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255}, 5 | "TextScale": 1.2, 6 | "TextOutlineWidth": 3, 7 | "TextSpacing": 3, 8 | "TextAlignment": "Center" 9 | }, 10 | "DefaultTextAnchor": "AutoCenter" 11 | } -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Modifiers/IModifier.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.MercuryParticleEngine.Modifiers 2 | { 3 | public interface IModifier 4 | { 5 | /// 6 | /// The key of this Modifier. 7 | /// 8 | string Key { get; set; } 9 | 10 | void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator); 11 | } 12 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/panel.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | "ExternalSourceRect": {"X": 16, "Y": 0, "Width": 96, "Height": 96}, 5 | "FrameWidth": {"X": 4, "Y": 4} 6 | }, 7 | "Padding": {"Left": 18, "Right": 18, "Top": 14, "Bottom": 14} 8 | }, 9 | "Disabled": { 10 | "EffectIdentifier": "disabled" 11 | }, 12 | "InterpolateStatesSpeed": 5 13 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/panel.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | "ExternalSourceRect": {"X": 16, "Y": 0, "Width": 96, "Height": 96}, 5 | "FrameWidth": {"X": 4, "Y": 4} 6 | }, 7 | "Padding": {"Left": 18, "Right": 18, "Top": 14, "Bottom": 14} 8 | }, 9 | "Disabled": { 10 | "EffectIdentifier": "disabled" 11 | }, 12 | "InterpolateStatesSpeed": 5 13 | } -------------------------------------------------------------------------------- /Content/Assets/Engine/Effects/Grayscale.fx: -------------------------------------------------------------------------------- 1 | #include "Common.fxh" 2 | 3 | sampler s0; 4 | 5 | float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 6 | { 7 | float4 color = tex2D(s0, input.TexCoords.xy); 8 | float s = (color.r + color.g + color.b) / 3.0 ; 9 | return float4(s, s, s, 1) * color.a; 10 | } 11 | 12 | TECHNIQUE(Technique1, PassThroughVertexFunction, PixelShaderFunction); 13 | 14 | -------------------------------------------------------------------------------- /MonoGo.Engine/InspectableAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoGo.Engine 4 | { 5 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] 6 | public class InspectableAttribute : Attribute 7 | { 8 | public readonly bool Editable = true; 9 | 10 | public InspectableAttribute(bool editable = true) 11 | { 12 | Editable = editable; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /MonoGo.Engine/Resources/IResourceBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoGo.Engine.Resources 4 | { 5 | 6 | /// 7 | /// Interface for the container of game resources. 8 | /// Resources can be accessed by the string key. 9 | /// 10 | public interface IResourceBox 11 | { 12 | bool Loaded { get; } 13 | Type Type { get; } 14 | 15 | void Load(); 16 | void Unload(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /MonoGo.Engine.WindowsDX/MonoGoPlatform.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Engine.WindowsDX 2 | { 3 | public static class MonoGoPlatform 4 | { 5 | public static void Init() 6 | { 7 | GameMgr.CurrentPlatform = Platform.Windows; 8 | GameMgr.CurrentGraphicsBackend = GraphicsBackend.DirectX; 9 | 10 | StuffResolver.AddStuffAs(new AlphaBlendEffectLoaderWindowsDX()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/Effects/Grayscale.fx: -------------------------------------------------------------------------------- 1 | #include "Common.fxh" 2 | 3 | sampler s0; 4 | 5 | float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 6 | { 7 | float4 color = tex2D(s0, input.TexCoords.xy); 8 | float s = (color.r + color.g + color.b) / 3.0 ; 9 | return float4(s, s, s, 1) * color.a; 10 | } 11 | 12 | TECHNIQUE(Technique1, PassThroughVertexFunction, PixelShaderFunction); 13 | 14 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/panel.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | "ExternalSourceRect": {"X": 16, "Y": 0, "Width": 96, "Height": 96}, 5 | "FrameWidth": {"X": 4, "Y": 4} 6 | }, 7 | "Padding": {"Left": 18, "Right": 18, "Top": 14, "Bottom": 14} 8 | }, 9 | "Disabled": { 10 | "EffectIdentifier": "disabled" 11 | }, 12 | "InterpolateStatesSpeed": 5 13 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/color_picker_handle.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "Icon": { 4 | "SourceRect": {"X": 96, "Y": 192, "Width": 16, "Height": 16} 5 | 6 | } 7 | }, 8 | "Disabled": { 9 | "EffectIdentifier": "disabled" 10 | }, 11 | "DefaultWidth": {"Value": 32, "Units": "Pixels"}, 12 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 13 | "InterpolateStatesSpeed": 5, 14 | "InterpolateOffsetsSpeed": 10 15 | } -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Profiles/PointProfile.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine; 3 | 4 | namespace MonoGo.MercuryParticleEngine.Profiles 5 | { 6 | public class PointProfile : Profile 7 | { 8 | public override void GetOffsetAndHeading(out Vector2 offset, out Axis heading) { 9 | offset = Vector2.Zero; 10 | 11 | FastRand.NextUnitVector(out heading); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /MonoGo.Samples/Misc/Tiled/SolidTilesetTile.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.Drawing; 2 | using MonoGo.Engine.Utils.Tilemaps; 3 | 4 | namespace MonoGo.Samples.Misc.Tiled 5 | { 6 | 7 | public class SolidTilesetTile : ITilesetTile 8 | { 9 | public Frame Frame {get; private set;} 10 | public bool Solid; 11 | 12 | public SolidTilesetTile(Frame frame, bool solid) 13 | { 14 | Frame = frame; 15 | Solid = solid; 16 | } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/color_picker_handle.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "Icon": { 4 | "SourceRect": {"X": 96, "Y": 192, "Width": 16, "Height": 16} 5 | 6 | } 7 | }, 8 | "Disabled": { 9 | "EffectIdentifier": "disabled" 10 | }, 11 | "DefaultWidth": {"Value": 32, "Units": "Pixels"}, 12 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 13 | "InterpolateStatesSpeed": 5, 14 | "InterpolateOffsetsSpeed": 10 15 | } -------------------------------------------------------------------------------- /MonoGo.Engine.DesktopGL/AlphaBlendEffectLoaderDesktopGl.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace MonoGo.Engine.DesktopGL 4 | { 5 | internal class AlphaBlendEffectLoaderDesktopGl : AlphaBlendEffectLoader 6 | { 7 | protected override string _effectName => "MonoGo.Engine.DesktopGL.AlphaBlend_gl.mgfxo"; 8 | 9 | protected override Assembly _assembly => Assembly.GetAssembly(typeof(AlphaBlendEffectLoaderDesktopGl)); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /MonoGo.Engine.WindowsDX/AlphaBlendEffectLoaderWindowsDX .cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace MonoGo.Engine.WindowsDX 4 | { 5 | internal class AlphaBlendEffectLoaderWindowsDX : AlphaBlendEffectLoader 6 | { 7 | protected override string _effectName => "MonoGo.Engine.WindowsDX.AlphaBlend_dx.mgfxo"; 8 | 9 | protected override Assembly _assembly => Assembly.GetAssembly(typeof(AlphaBlendEffectLoaderWindowsDX)); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /MonoGo.Pipeline/SpriteGroup/AST/UnaryOperationNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoGo.Pipeline.SpriteGroup.AST 4 | { 5 | class UnaryOperationNode : Node 6 | { 7 | public UnaryOperationNode(Node num, Func op) 8 | { 9 | _num = num; 10 | _op = op; 11 | } 12 | Node _num; 13 | Func _op; 14 | 15 | public override int Eval() 16 | { 17 | int num = _num.Eval(); 18 | 19 | return _op(num); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MonoGo.Engine/Collisions/Colliders/CircleCollider.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.Collisions.Shapes; 2 | 3 | namespace MonoGo.Engine.Collisions.Colliders 4 | { 5 | /// 6 | /// Represents a perfect circle. 7 | /// 8 | public class CircleCollider : Collider 9 | { 10 | private Circle _circle => (Circle)_shapes[0]; 11 | 12 | public float Radius 13 | { 14 | get => _circle.Radius; 15 | set => _circle.Radius = value; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/color_picker_handle.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "Icon": { 4 | "SourceRect": {"X": 96, "Y": 192, "Width": 16, "Height": 16} 5 | 6 | } 7 | }, 8 | "Disabled": { 9 | "EffectIdentifier": "disabled" 10 | }, 11 | "DefaultWidth": {"Value": 32, "Units": "Pixels"}, 12 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 13 | "InterpolateStatesSpeed": 5, 14 | "InterpolateOffsetsSpeed": 10 15 | } -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/FlipFlags.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Tiled.MapStructure 3 | { 4 | /// 5 | /// Tile flip flags are stored in the tile value itself as 3 highest bits. 6 | /// 100 - Horizontal flip. 7 | /// 010 - Vertical flip. 8 | /// 001 - Diagonal flip. 9 | /// 10 | internal enum FlipFlags : uint 11 | { 12 | FlipDiag = 536870912, 13 | FlipVer = 1073741824, 14 | FlipHor = 2147483648, 15 | All = 3758096384, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/list_panel_centered.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | "InternalSourceRect": {"X": 116, "Y": 4, "Width": 72, "Height": 24}, 5 | "ExternalSourceRect": {"X": 112, "Y": 0, "Width": 80, "Height": 32}, 6 | "TextureScale": 3 7 | }, 8 | "Padding": {"Left": 8, "Right": 8, "Top": 18, "Bottom": 8} 9 | }, 10 | "Disabled": { 11 | "EffectIdentifier": "disabled" 12 | }, 13 | "InterpolateStatesSpeed": 5 14 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/list_panel_centered.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | "InternalSourceRect": {"X": 116, "Y": 4, "Width": 72, "Height": 24}, 5 | "ExternalSourceRect": {"X": 112, "Y": 0, "Width": 80, "Height": 32}, 6 | "TextureScale": 3 7 | }, 8 | "Padding": {"Left": 8, "Right": 8, "Top": 18, "Bottom": 8} 9 | }, 10 | "Disabled": { 11 | "EffectIdentifier": "disabled" 12 | }, 13 | "InterpolateStatesSpeed": 5 14 | } -------------------------------------------------------------------------------- /Content/Assets/Engine/Effects/Seizure.fx: -------------------------------------------------------------------------------- 1 | #include "Common.fxh" 2 | 3 | sampler BaseSampler : register(s0); 4 | 5 | 6 | float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 7 | { 8 | float4 color = tex2D(BaseSampler, input.TexCoords.xy); 9 | float s = (color.r + color.g + color.b) / 3.0; 10 | return float4(input.TexCoords.x, input.TexCoords.y, s, 1) * color.a; 11 | } 12 | 13 | 14 | TECHNIQUE(Technique1, PassThroughVertexFunction, PixelShaderFunction); 15 | 16 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/dropdown_icon.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "Icon": { 4 | "SourceRect": {"X": 160, "Y": 96, "Width": 16, "Height": 16} 5 | } 6 | }, 7 | "Interacted": { 8 | "Icon": { 9 | "SourceRect": {"X": 176, "Y": 96, "Width": 16, "Height": 16} 10 | } 11 | }, 12 | "DefaultAnchor": "TopRight", 13 | "DefaultWidth": {"Value": 32, "Units": "Pixels"}, 14 | "DefaultHeight": {"Value": 32, "Units": "Pixels"} 15 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/dropdown_icon.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "Icon": { 4 | "SourceRect": {"X": 160, "Y": 96, "Width": 16, "Height": 16} 5 | } 6 | }, 7 | "Interacted": { 8 | "Icon": { 9 | "SourceRect": {"X": 176, "Y": 96, "Width": 16, "Height": 16} 10 | } 11 | }, 12 | "DefaultAnchor": "TopRight", 13 | "DefaultWidth": {"Value": 32, "Units": "Pixels"}, 14 | "DefaultHeight": {"Value": 32, "Units": "Pixels"} 15 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/list_panel.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 4, "Y": 132, "Width": 88, "Height": 88}, 6 | "ExternalSourceRect": {"X": 0, "Y": 128, "Width": 96, "Height": 96} 7 | }, 8 | "Padding": {"Left": 18, "Right": 18, "Top": 12, "Bottom": 4}, 9 | "MarginAfter": {"X": 0, "Y": 6} 10 | }, 11 | "Disabled": { 12 | "EffectIdentifier": "disabled" 13 | }, 14 | "InterpolateStatesSpeed": 5 15 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/Effects/Seizure.fx: -------------------------------------------------------------------------------- 1 | #include "Common.fxh" 2 | 3 | sampler BaseSampler : register(s0); 4 | 5 | 6 | float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 7 | { 8 | float4 color = tex2D(BaseSampler, input.TexCoords.xy); 9 | float s = (color.r + color.g + color.b) / 3.0; 10 | return float4(input.TexCoords.x, input.TexCoords.y, s, 1) * color.a; 11 | } 12 | 13 | 14 | TECHNIQUE(Technique1, PassThroughVertexFunction, PixelShaderFunction); 15 | 16 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/list_panel_centered.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | "InternalSourceRect": {"X": 116, "Y": 4, "Width": 72, "Height": 24}, 5 | "ExternalSourceRect": {"X": 112, "Y": 0, "Width": 80, "Height": 32}, 6 | "TextureScale": 3 7 | }, 8 | "Padding": {"Left": 8, "Right": 8, "Top": 18, "Bottom": 8} 9 | }, 10 | "Disabled": { 11 | "EffectIdentifier": "disabled" 12 | }, 13 | "InterpolateStatesSpeed": 5 14 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/list_panel.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 4, "Y": 132, "Width": 88, "Height": 88}, 6 | "ExternalSourceRect": {"X": 0, "Y": 128, "Width": 96, "Height": 96} 7 | }, 8 | "Padding": {"Left": 18, "Right": 18, "Top": 12, "Bottom": 4}, 9 | "MarginAfter": {"X": 0, "Y": 6} 10 | }, 11 | "Disabled": { 12 | "EffectIdentifier": "disabled" 13 | }, 14 | "InterpolateStatesSpeed": 5 15 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/dropdown_icon.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "Icon": { 4 | "SourceRect": {"X": 160, "Y": 96, "Width": 16, "Height": 16} 5 | } 6 | }, 7 | "Interacted": { 8 | "Icon": { 9 | "SourceRect": {"X": 176, "Y": 96, "Width": 16, "Height": 16} 10 | } 11 | }, 12 | "DefaultAnchor": "TopRight", 13 | "DefaultWidth": {"Value": 32, "Units": "Pixels"}, 14 | "DefaultHeight": {"Value": 32, "Units": "Pixels"} 15 | } -------------------------------------------------------------------------------- /MonoGo.Engine/Collisions/Algorithms/SimpleCollisionDetection.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System.Runtime.CompilerServices; 3 | 4 | namespace MonoGo.Engine.Collisions.Algorithms 5 | { 6 | internal static class SimpleCollisionDetection 7 | { 8 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 9 | public static bool CheckCircleCircle(Vector2 center1, float r1, Vector2 center2, float r2) 10 | { 11 | return (center1 - center2).LengthSquared() <= (r1 + r2) * (r1 + r2); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/list_panel.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 4, "Y": 132, "Width": 88, "Height": 88}, 6 | "ExternalSourceRect": {"X": 0, "Y": 128, "Width": 96, "Height": 96} 7 | }, 8 | "Padding": {"Left": 18, "Right": 18, "Top": 12, "Bottom": 4}, 9 | "MarginAfter": {"X": 0, "Y": 6} 10 | }, 11 | "Disabled": { 12 | "EffectIdentifier": "disabled" 13 | }, 14 | "InterpolateStatesSpeed": 5 15 | } -------------------------------------------------------------------------------- /MonoGo.Engine/Cameras/FilterMode.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Engine.Cameras 2 | { 3 | /// 4 | /// filtering modes for camera. 5 | /// 6 | public enum FilterMode 7 | { 8 | /// 9 | /// Triggers rendering, if filter DOES contain layer. 10 | /// 11 | Inclusive, 12 | 13 | /// 14 | /// Triggers rendering, if filter DOES NOT contain layer. 15 | /// 16 | Exclusive, 17 | 18 | /// 19 | /// Renders all layers. 20 | /// 21 | None, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /MonoGo.Engine/Utils/CustomCollections/IPoolable.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Engine.Utils.CustomCollections 2 | { 3 | public interface IPoolable 4 | { 5 | /// 6 | /// Signifies that the object is currently in a pool. 7 | /// 8 | bool InPool { get; set; } 9 | 10 | /// 11 | /// Called when the object is taken from a pool. 12 | /// 13 | void OnTakenFromPool(); 14 | 15 | /// 16 | /// Called when the object is returned to a pool. 17 | /// 18 | void OnReturnedToPool(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /MonoGo.Engine/CanvasMode.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Engine 2 | { 3 | /// 4 | /// Canvas drawing modes for WindowMgr. 5 | /// 6 | public enum CanvasMode 7 | { 8 | /// 9 | /// Keeps aspect ration between screen and canvas, 10 | /// resulting in black bars. 11 | /// 12 | KeepAspectRatio, 13 | 14 | /// 15 | /// Scales canvas to fit them into screen. 16 | /// 17 | Fill, 18 | 19 | /// 20 | /// Canvas stays as is, without any transforming. 21 | /// 22 | None, 23 | } 24 | } -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Modifiers/OpacityFastFadeModifier.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.MercuryParticleEngine.Modifiers 2 | { 3 | public class OpacityFastFadeModifier : IModifier 4 | { 5 | public string Key { get; set; } 6 | 7 | public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) 8 | { 9 | while (iterator.HasNext) 10 | { 11 | var particle = iterator.Next(); 12 | particle->Opacity = 1.0f - particle->Age; 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/slider_handle.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "Icon": { 4 | 5 | "SourceRect": {"X": 139, "Y": 96, "Width": 11, "Height": 11} 6 | } 7 | }, 8 | "Interacted": { 9 | "Icon": { 10 | 11 | "SourceRect": {"X": 128, "Y": 96, "Width": 11, "Height": 11} 12 | } 13 | }, 14 | "Disabled": { 15 | "EffectIdentifier": "disabled" 16 | }, 17 | "DefaultWidth": {"Value": 22, "Units": "Pixels"}, 18 | "DefaultHeight": {"Value": 22, "Units": "Pixels"}, 19 | "InterpolateStatesSpeed": 5, 20 | "InterpolateOffsetsSpeed": 10 21 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/slider_handle.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "Icon": { 4 | 5 | "SourceRect": {"X": 139, "Y": 96, "Width": 11, "Height": 11} 6 | } 7 | }, 8 | "Interacted": { 9 | "Icon": { 10 | 11 | "SourceRect": {"X": 128, "Y": 96, "Width": 11, "Height": 11} 12 | } 13 | }, 14 | "Disabled": { 15 | "EffectIdentifier": "disabled" 16 | }, 17 | "DefaultWidth": {"Value": 22, "Units": "Pixels"}, 18 | "DefaultHeight": {"Value": 22, "Units": "Pixels"}, 19 | "InterpolateStatesSpeed": 5, 20 | "InterpolateOffsetsSpeed": 10 21 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/Maps/Templates/TemplatesTileset/Templates.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/TiledMapObjectDrawingOrder.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Tiled.MapStructure 3 | { 4 | /// 5 | /// Specifies the drawing order for objects in a Tiled object layer. 6 | /// 7 | public enum TiledMapObjectDrawingOrder : byte 8 | { 9 | /// 10 | /// Objects are drawn from top to bottom. 11 | /// 12 | TopDown = 0, 13 | 14 | /// 15 | /// Objects are drawn in a manual order. 16 | /// 17 | Manual = 1 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /MonoGo.Engine/Utils/Tilemaps/ITilemap.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace MonoGo.Engine.Utils.Tilemaps 4 | { 5 | public interface ITilemap where T : struct, ITile 6 | { 7 | Vector2 Offset {get; set;} 8 | int TileWidth {get;} 9 | int TileHeight {get;} 10 | 11 | int Width {get;} 12 | int Height {get;} 13 | 14 | T? GetTile(int x, int y); 15 | void SetTile(int x, int y, T tile); 16 | 17 | /// 18 | /// Tells, if given coodrinates are in tilemap's bounds. 19 | /// 20 | bool InBounds(int x, int y); 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /MonoGo.Pipeline/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /MonoGo.Pipeline/SpriteGroup/RawSprite.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System.Collections.Generic; 3 | 4 | namespace MonoGo.Pipeline.SpriteGroup 5 | { 6 | public class RawSprite 7 | { 8 | public string Name = "NONE"; 9 | public int FramesH = 1; 10 | public int FramesV = 1; 11 | public Point Offset = new Point(0, 0); 12 | public Bmp RawTexture; 13 | public List Frames = new List(); 14 | 15 | /// 16 | /// Tells how many frames were already rendered to the atlas. 17 | /// 18 | public int RenderedFrames = 0; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /MonoGo.Engine/Cameras/PostprocessingMode.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Engine.Cameras 2 | { 3 | /// 4 | /// Postprocessing modes for camera. 5 | /// 6 | public enum PostprocessingMode 7 | { 8 | /// 9 | /// No shaders will be applied. 10 | /// 11 | None, 12 | 13 | /// 14 | /// Enables applying shaders to the camera surface. 15 | /// 16 | Camera, 17 | 18 | /// 19 | /// Enables applying shaders to the camera surface 20 | /// AND individual layers. 21 | /// 22 | CameraAndLayers, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/slider_handle.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "Icon": { 4 | 5 | "SourceRect": {"X": 139, "Y": 96, "Width": 11, "Height": 11} 6 | } 7 | }, 8 | "Interacted": { 9 | "Icon": { 10 | 11 | "SourceRect": {"X": 128, "Y": 96, "Width": 11, "Height": 11} 12 | } 13 | }, 14 | "Disabled": { 15 | "EffectIdentifier": "disabled" 16 | }, 17 | "DefaultWidth": {"Value": 22, "Units": "Pixels"}, 18 | "DefaultHeight": {"Value": 22, "Units": "Pixels"}, 19 | "InterpolateStatesSpeed": 5, 20 | "InterpolateOffsetsSpeed": 10 21 | } -------------------------------------------------------------------------------- /Tests/GameMathTests.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.Utils; 2 | using Moq; 3 | using NUnit.Framework; 4 | 5 | namespace Tests 6 | { 7 | public class GameMathTests 8 | { 9 | [SetUp] 10 | public void Setup() 11 | { 12 | } 13 | 14 | [Test] 15 | public void Lerp_Lerp_ReturnsCorrectValue() 16 | { 17 | var a = It.IsAny(); 18 | var b = It.IsAny(); 19 | var value = It.IsInRange(0, 1, Range.Inclusive); 20 | 21 | var result = GameMath.Lerp(a, b, value); 22 | 23 | Assert.AreEqual(a + (b - a) * value, result); 24 | } 25 | 26 | // TODO: Add MOAR. 27 | } 28 | } -------------------------------------------------------------------------------- /MonoGo.Pipeline/SpriteGroup/AST/BinaryOperationNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoGo.Pipeline.SpriteGroup.AST 4 | { 5 | class BinaryOperationNode : Node 6 | { 7 | 8 | public BinaryOperationNode(Node lhs, Node rhs, Func op) 9 | { 10 | _lhs = lhs; 11 | _rhs = rhs; 12 | _op = op; 13 | } 14 | 15 | Node _lhs; 16 | Node _rhs; 17 | Func _op; 18 | 19 | public override int Eval() 20 | { 21 | 22 | var lhsVal = _lhs.Eval(); 23 | var rhsVal = _rhs.Eval(); 24 | 25 | var result = _op(lhsVal, rhsVal); 26 | return result; 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/radio_button.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "checkbox.json", 3 | "Default": { 4 | "Icon": { 5 | 6 | "SourceRect": {"X": 80, "Y": 112, "Width": 16, "Height": 16}, 7 | "CenterVertically": true 8 | } 9 | }, 10 | "Targeted": { 11 | "Icon": { 12 | 13 | "SourceRect": {"X": 112, "Y": 112, "Width": 16, "Height": 16}, 14 | "CenterVertically": true 15 | } 16 | }, 17 | "Interacted": { 18 | "Icon": { 19 | 20 | "SourceRect": {"X": 96, "Y": 112, "Width": 16, "Height": 16}, 21 | "CenterVertically": true 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/vertical_line.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | "InternalSourceRect": {"X": 222, "Y": 51, "Width": 2, "Height": 74}, 5 | "ExternalSourceRect": {"X": 222, "Y": 48, "Width": 2, "Height": 80} 6 | }, 7 | "Padding": {"Left": 0, "Right": 0, "Top": 8, "Bottom": 8}, 8 | "MarginBefore": {"X": 6, "Y": 0}, 9 | "MarginAfter": {"X": 6, "Y": 0} 10 | }, 11 | "Disabled": { 12 | "EffectIdentifier": "disabled" 13 | }, 14 | "DefaultWidth": {"Value": 8, "Units": "Pixels"}, 15 | "DefaultHeight": {"Value": 100, "Units": "PercentOfParent"} 16 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/radio_button.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "checkbox.json", 3 | "Default": { 4 | "Icon": { 5 | 6 | "SourceRect": {"X": 80, "Y": 112, "Width": 16, "Height": 16}, 7 | "CenterVertically": true 8 | } 9 | }, 10 | "Targeted": { 11 | "Icon": { 12 | 13 | "SourceRect": {"X": 112, "Y": 112, "Width": 16, "Height": 16}, 14 | "CenterVertically": true 15 | } 16 | }, 17 | "Interacted": { 18 | "Icon": { 19 | 20 | "SourceRect": {"X": 96, "Y": 112, "Width": 16, "Height": 16}, 21 | "CenterVertically": true 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/vertical_line.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | "InternalSourceRect": {"X": 222, "Y": 51, "Width": 2, "Height": 74}, 5 | "ExternalSourceRect": {"X": 222, "Y": 48, "Width": 2, "Height": 80} 6 | }, 7 | "Padding": {"Left": 0, "Right": 0, "Top": 8, "Bottom": 8}, 8 | "MarginBefore": {"X": 6, "Y": 0}, 9 | "MarginAfter": {"X": 6, "Y": 0} 10 | }, 11 | "Disabled": { 12 | "EffectIdentifier": "disabled" 13 | }, 14 | "DefaultWidth": {"Value": 8, "Units": "Pixels"}, 15 | "DefaultHeight": {"Value": 100, "Units": "PercentOfParent"} 16 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/color_picker.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureStretched": { 4 | 5 | "SourceRect": {"X": 128, "Y": 192, "Width": 128, "Height": 32} 6 | }, 7 | "Padding": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 0}, 8 | "MarginBefore": {"X": 18, "Y": 18}, 9 | "MarginAfter": {"X": 18, "Y": 18} 10 | }, 11 | "Disabled": { 12 | "EffectIdentifier": "disabled" 13 | }, 14 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 15 | "DefaultHeight": {"Value": 96, "Units": "Pixels"}, 16 | "InterpolateStatesSpeed": 5, 17 | "InterpolateOffsetsSpeed": 10 18 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/horizontal_line.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | "InternalSourceRect": {"X": 3, "Y": 96, "Width": 74, "Height": 2}, 5 | "ExternalSourceRect": {"X": 0, "Y": 96, "Width": 80, "Height": 2} 6 | 7 | }, 8 | "Padding": {"Left": 8, "Right": 8, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 5}, 10 | "MarginAfter": {"X": 0, "Y": 6} 11 | }, 12 | "Disabled": { 13 | "EffectIdentifier": "disabled" 14 | }, 15 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 16 | "DefaultHeight": {"Value": 8, "Units": "Pixels"} 17 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/color_picker.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureStretched": { 4 | 5 | "SourceRect": {"X": 128, "Y": 192, "Width": 128, "Height": 32} 6 | }, 7 | "Padding": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 0}, 8 | "MarginBefore": {"X": 18, "Y": 18}, 9 | "MarginAfter": {"X": 18, "Y": 18} 10 | }, 11 | "Disabled": { 12 | "EffectIdentifier": "disabled" 13 | }, 14 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 15 | "DefaultHeight": {"Value": 96, "Units": "Pixels"}, 16 | "InterpolateStatesSpeed": 5, 17 | "InterpolateOffsetsSpeed": 10 18 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/horizontal_line.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | "InternalSourceRect": {"X": 3, "Y": 96, "Width": 74, "Height": 2}, 5 | "ExternalSourceRect": {"X": 0, "Y": 96, "Width": 80, "Height": 2} 6 | 7 | }, 8 | "Padding": {"Left": 8, "Right": 8, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 5}, 10 | "MarginAfter": {"X": 0, "Y": 6} 11 | }, 12 | "Disabled": { 13 | "EffectIdentifier": "disabled" 14 | }, 15 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 16 | "DefaultHeight": {"Value": 8, "Units": "Pixels"} 17 | } -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/StaggerAxis.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Tiled.MapStructure 3 | { 4 | /// 5 | /// Specifies the stagger axis for staggered or hexagonal Tiled maps. 6 | /// 7 | public enum StaggerAxis : byte 8 | { 9 | /// 10 | /// No stagger axis. 11 | /// 12 | None = 0, 13 | 14 | /// 15 | /// Stagger along the X-axis. 16 | /// 17 | X = 1, 18 | 19 | /// 20 | /// Stagger along the Y-axis. 21 | /// 22 | Y = 2 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Profiles/LineProfile.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine; 3 | 4 | namespace MonoGo.MercuryParticleEngine.Profiles 5 | { 6 | public class LineProfile : Profile 7 | { 8 | public Axis Axis { get; set; } 9 | public float Length { get; set; } 10 | 11 | public override void GetOffsetAndHeading(out Vector2 offset, out Axis heading) 12 | { 13 | var vect = Axis * FastRand.NextSingle(Length*-0.5f, Length*0.5f); 14 | offset = new Vector2(vect.X, vect.Y); 15 | FastRand.NextUnitVector(out heading); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/radio_button.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "checkbox.json", 3 | "Default": { 4 | "Icon": { 5 | 6 | "SourceRect": {"X": 80, "Y": 112, "Width": 16, "Height": 16}, 7 | "CenterVertically": true 8 | } 9 | }, 10 | "Targeted": { 11 | "Icon": { 12 | 13 | "SourceRect": {"X": 112, "Y": 112, "Width": 16, "Height": 16}, 14 | "CenterVertically": true 15 | } 16 | }, 17 | "Interacted": { 18 | "Icon": { 19 | 20 | "SourceRect": {"X": 96, "Y": 112, "Width": 16, "Height": 16}, 21 | "CenterVertically": true 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/vertical_line.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | "InternalSourceRect": {"X": 222, "Y": 51, "Width": 2, "Height": 74}, 5 | "ExternalSourceRect": {"X": 222, "Y": 48, "Width": 2, "Height": 80} 6 | }, 7 | "Padding": {"Left": 0, "Right": 0, "Top": 8, "Bottom": 8}, 8 | "MarginBefore": {"X": 6, "Y": 0}, 9 | "MarginAfter": {"X": 6, "Y": 0} 10 | }, 11 | "Disabled": { 12 | "EffectIdentifier": "disabled" 13 | }, 14 | "DefaultWidth": {"Value": 8, "Units": "Pixels"}, 15 | "DefaultHeight": {"Value": 100, "Units": "PercentOfParent"} 16 | } -------------------------------------------------------------------------------- /Content/Assets/Engine/Effects/Common.fxh: -------------------------------------------------------------------------------- 1 | struct VertexShaderOutput 2 | { 3 | float4 Position : POSITION0; 4 | float2 TexCoords : TEXCOORD0; 5 | float4 Color : COLOR0; 6 | }; 7 | 8 | #ifdef SM4 9 | // DirectX compilation. 10 | 11 | #define TECHNIQUE(name, vsName, psName) \ 12 | technique name \ 13 | { \ 14 | pass Pass1 \ 15 | { \ 16 | PixelShader = compile ps_4_0_level_9_1 psName(); \ 17 | } \ 18 | } 19 | 20 | #else 21 | 22 | // OpenGL compilation. 23 | #define TECHNIQUE(name, vsName, psName) \ 24 | technique name \ 25 | { \ 26 | pass Pass1 \ 27 | { \ 28 | PixelShader = compile ps_3_0 psName(); \ 29 | } \ 30 | } 31 | 32 | #endif -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/color_picker.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureStretched": { 4 | 5 | "SourceRect": {"X": 128, "Y": 192, "Width": 128, "Height": 32} 6 | }, 7 | "Padding": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 0}, 8 | "MarginBefore": {"X": 18, "Y": 18}, 9 | "MarginAfter": {"X": 18, "Y": 18} 10 | }, 11 | "Disabled": { 12 | "EffectIdentifier": "disabled" 13 | }, 14 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 15 | "DefaultHeight": {"Value": 96, "Units": "Pixels"}, 16 | "InterpolateStatesSpeed": 5, 17 | "InterpolateOffsetsSpeed": 10 18 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/horizontal_line.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | "InternalSourceRect": {"X": 3, "Y": 96, "Width": 74, "Height": 2}, 5 | "ExternalSourceRect": {"X": 0, "Y": 96, "Width": 80, "Height": 2} 6 | 7 | }, 8 | "Padding": {"Left": 8, "Right": 8, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 5}, 10 | "MarginAfter": {"X": 0, "Y": 6} 11 | }, 12 | "Disabled": { 13 | "EffectIdentifier": "disabled" 14 | }, 15 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 16 | "DefaultHeight": {"Value": 8, "Units": "Pixels"} 17 | } -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/StaggerIndex.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Tiled.MapStructure 3 | { 4 | /// 5 | /// Specifies the stagger index for staggered or hexagonal Tiled maps. 6 | /// 7 | public enum StaggerIndex : byte 8 | { 9 | /// 10 | /// No stagger index. 11 | /// 12 | None = 0, 13 | 14 | /// 15 | /// Stagger on odd rows or columns. 16 | /// 17 | Odd = 1, 18 | 19 | /// 20 | /// Stagger on even rows or columns. 21 | /// 22 | Even = 2 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/Effects/Common.fxh: -------------------------------------------------------------------------------- 1 | struct VertexShaderOutput 2 | { 3 | float4 Position : POSITION0; 4 | float2 TexCoords : TEXCOORD0; 5 | float4 Color : COLOR0; 6 | }; 7 | 8 | #ifdef SM4 9 | // DirectX compilation. 10 | 11 | #define TECHNIQUE(name, vsName, psName) \ 12 | technique name \ 13 | { \ 14 | pass Pass1 \ 15 | { \ 16 | PixelShader = compile ps_4_0_level_9_1 psName(); \ 17 | } \ 18 | } 19 | 20 | #else 21 | 22 | // OpenGL compilation. 23 | #define TECHNIQUE(name, vsName, psName) \ 24 | technique name \ 25 | { \ 26 | pass Pass1 \ 27 | { \ 28 | PixelShader = compile ps_3_0 psName(); \ 29 | } \ 30 | } 31 | 32 | #endif -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/list_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "TextAlignment": "Left", 5 | "DefaultTextAnchor": "CenterLeft", 6 | "ExtraSize": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 10} 7 | }, 8 | "Targeted": { 9 | }, 10 | "Checked": { 11 | "FillTextureStretched": { 12 | 13 | "SourceRect": {"X": 0, "Y": 80, "Width": 16, "Height": 16}, 14 | "ExtraSize": {"Left": 20, "Right": 10, "Top": 10, "Bottom": 0} 15 | }, 16 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255} 17 | }, 18 | "InterpolateStatesSpeed": 0 19 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/list_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "TextAlignment": "Left", 5 | "DefaultTextAnchor": "CenterLeft", 6 | "ExtraSize": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 10} 7 | }, 8 | "Targeted": { 9 | }, 10 | "Checked": { 11 | "FillTextureStretched": { 12 | 13 | "SourceRect": {"X": 0, "Y": 80, "Width": 16, "Height": 16}, 14 | "ExtraSize": {"Left": 20, "Right": 10, "Top": 10, "Bottom": 0} 15 | }, 16 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255} 17 | }, 18 | "InterpolateStatesSpeed": 0 19 | } -------------------------------------------------------------------------------- /MonoGo.Engine/Utils/OnTriggerAction.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Engine.Utils 3 | { 4 | public enum OnTriggerAction 5 | { 6 | /// 7 | /// On reaching trigger time, 8 | /// alarm resets itself to 0, triggers OnTrigger event and stops. 9 | /// 10 | Stop, 11 | 12 | /// 13 | /// On reaching trigger time, 14 | /// alarm resets itself to 0, triggers OnTrigger event and continues counting. 15 | /// In this mode, alarm takes into account leftover counter delta to make 16 | /// repeated counting precise. 17 | /// 18 | Loop, 19 | 20 | /// 21 | /// Alarm never triggers. 22 | /// 23 | None, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Modifiers/RotationModifier.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.MercuryParticleEngine.Modifiers 2 | { 3 | public class RotationModifier : IModifier 4 | { 5 | public string Key { get; set; } 6 | 7 | public float RotationRate { get; set; } 8 | 9 | public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) 10 | { 11 | var rotationRateDelta = RotationRate * elapsedSeconds; 12 | 13 | while (iterator.HasNext) 14 | { 15 | var particle = iterator.Next(); 16 | particle->Rotation += rotationRateDelta; 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Profiles/BoxFillProfile.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine; 3 | 4 | namespace MonoGo.MercuryParticleEngine.Profiles 5 | { 6 | public class BoxFillProfile : Profile 7 | { 8 | public float Width { get; set; } 9 | public float Height { get; set; } 10 | 11 | public override void GetOffsetAndHeading(out Vector2 offset, out Axis heading) { 12 | offset = new Vector2(FastRand.NextSingle(Width * -0.5f, Width * 0.5f), 13 | FastRand.NextSingle(Height * -0.5f, Height * 0.5f)); 14 | 15 | FastRand.NextUnitVector(out heading); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /MonoGo.Pipeline/SpriteGroup/AST/TokenNotExpectedException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace MonoGo.Pipeline.SpriteGroup.AST 5 | { 6 | [Serializable] 7 | internal class TokenNotExpectedException : Exception 8 | { 9 | public TokenNotExpectedException() 10 | { 11 | } 12 | 13 | public TokenNotExpectedException(string message) : base(message) 14 | { 15 | } 16 | 17 | public TokenNotExpectedException(string message, Exception innerException) : base(message, innerException) 18 | { 19 | } 20 | 21 | protected TokenNotExpectedException(SerializationInfo info, StreamingContext context) : base(info, context) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/list_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "TextAlignment": "Left", 5 | "DefaultTextAnchor": "CenterLeft", 6 | "ExtraSize": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 10} 7 | }, 8 | "Targeted": { 9 | }, 10 | "Checked": { 11 | "FillTextureStretched": { 12 | 13 | "SourceRect": {"X": 0, "Y": 80, "Width": 16, "Height": 16}, 14 | "ExtraSize": {"Left": 20, "Right": 10, "Top": 10, "Bottom": 0} 15 | }, 16 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255} 17 | }, 18 | "InterpolateStatesSpeed": 0 19 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/text_input.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "FillTextureFramed": { 5 | 6 | "InternalSourceRect": {"X": 4, "Y": 132, "Width": 88, "Height": 88}, 7 | "ExternalSourceRect": {"X": 0, "Y": 128, "Width": 96, "Height": 96} 8 | }, 9 | "Padding": {"Left": 6, "Right": 6, "Top": 6, "Bottom": 6} 10 | }, 11 | "Targeted": { 12 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255} 13 | }, 14 | "Interacted": { 15 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255} 16 | }, 17 | "DefaultHeight": {"Value": 48, "Units": "Pixels"}, 18 | "InterpolateStatesSpeed": 5 19 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/text_input.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "FillTextureFramed": { 5 | 6 | "InternalSourceRect": {"X": 4, "Y": 132, "Width": 88, "Height": 88}, 7 | "ExternalSourceRect": {"X": 0, "Y": 128, "Width": 96, "Height": 96} 8 | }, 9 | "Padding": {"Left": 6, "Right": 6, "Top": 6, "Bottom": 6} 10 | }, 11 | "Targeted": { 12 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255} 13 | }, 14 | "Interacted": { 15 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255} 16 | }, 17 | "DefaultHeight": {"Value": 48, "Units": "Pixels"}, 18 | "InterpolateStatesSpeed": 5 19 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/color_slider_horizontal.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureStretched": { 4 | "SourceRect": {"X": 128, "Y": 186, "Width": 128, "Height": 6}, 5 | "ExtraSize": {"Left": -10, "Right": -10, "Top": 0, "Bottom": 0} 6 | }, 7 | "Padding": {"Left": 10, "Right": 10, "Top": 0, "Bottom": 0}, 8 | "MarginBefore": {"X": 0, "Y": 18}, 9 | "MarginAfter": {"X": 0, "Y": 18} 10 | }, 11 | "Disabled": { 12 | "EffectIdentifier": "disabled" 13 | }, 14 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 15 | "DefaultHeight": {"Value": 18, "Units": "Pixels"}, 16 | "InterpolateStatesSpeed": 5, 17 | "InterpolateOffsetsSpeed": 10 18 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/color_slider_horizontal.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureStretched": { 4 | "SourceRect": {"X": 128, "Y": 186, "Width": 128, "Height": 6}, 5 | "ExtraSize": {"Left": -10, "Right": -10, "Top": 0, "Bottom": 0} 6 | }, 7 | "Padding": {"Left": 10, "Right": 10, "Top": 0, "Bottom": 0}, 8 | "MarginBefore": {"X": 0, "Y": 18}, 9 | "MarginAfter": {"X": 0, "Y": 18} 10 | }, 11 | "Disabled": { 12 | "EffectIdentifier": "disabled" 13 | }, 14 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 15 | "DefaultHeight": {"Value": 18, "Units": "Pixels"}, 16 | "InterpolateStatesSpeed": 5, 17 | "InterpolateOffsetsSpeed": 10 18 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/scrollbar_vertical.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 192, "Y": 12, "Width": 16, "Height": 72}, 6 | "ExternalSourceRect": {"X": 192, "Y": 0, "Width": 16, "Height": 96} 7 | }, 8 | "Padding": {"Left": 0, "Right": 0, "Top": 70, "Bottom": 70}, 9 | "MarginBefore": {"X": 10, "Y": 10}, 10 | "MarginAfter": {"X": 10, "Y": 10} 11 | }, 12 | "Disabled": { 13 | "EffectIdentifier": "disabled" 14 | }, 15 | "DefaultWidth": {"Value": 32, "Units": "Pixels"}, 16 | "DefaultHeight": {"Value": 100, "Units": "PercentOfParent"}, 17 | "InterpolateStatesSpeed": 5, 18 | "InterpolateOffsetsSpeed": 10 19 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/progress_bar_horizontal.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 101, "Y": 130, "Width": 70, "Height": 12}, 6 | "ExternalSourceRect": {"X": 96, "Y": 128, "Width": 80, "Height": 16} 7 | }, 8 | "Padding": {"Left": 2, "Right": 2, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18} 11 | }, 12 | "Disabled": { 13 | "EffectIdentifier": "disabled" 14 | }, 15 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 16 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 17 | "InterpolateStatesSpeed": 5, 18 | "InterpolateOffsetsSpeed": 10 19 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/scrollbar_vertical.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 192, "Y": 12, "Width": 16, "Height": 72}, 6 | "ExternalSourceRect": {"X": 192, "Y": 0, "Width": 16, "Height": 96} 7 | }, 8 | "Padding": {"Left": 0, "Right": 0, "Top": 70, "Bottom": 70}, 9 | "MarginBefore": {"X": 10, "Y": 10}, 10 | "MarginAfter": {"X": 10, "Y": 10} 11 | }, 12 | "Disabled": { 13 | "EffectIdentifier": "disabled" 14 | }, 15 | "DefaultWidth": {"Value": 32, "Units": "Pixels"}, 16 | "DefaultHeight": {"Value": 100, "Units": "PercentOfParent"}, 17 | "InterpolateStatesSpeed": 5, 18 | "InterpolateOffsetsSpeed": 10 19 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/progress_bar_horizontal.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 101, "Y": 130, "Width": 70, "Height": 12}, 6 | "ExternalSourceRect": {"X": 96, "Y": 128, "Width": 80, "Height": 16} 7 | }, 8 | "Padding": {"Left": 2, "Right": 2, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18} 11 | }, 12 | "Disabled": { 13 | "EffectIdentifier": "disabled" 14 | }, 15 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 16 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 17 | "InterpolateStatesSpeed": 5, 18 | "InterpolateOffsetsSpeed": 10 19 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/text_input.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "FillTextureFramed": { 5 | 6 | "InternalSourceRect": {"X": 4, "Y": 132, "Width": 88, "Height": 88}, 7 | "ExternalSourceRect": {"X": 0, "Y": 128, "Width": 96, "Height": 96} 8 | }, 9 | "Padding": {"Left": 6, "Right": 6, "Top": 6, "Bottom": 6} 10 | }, 11 | "Targeted": { 12 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255} 13 | }, 14 | "Interacted": { 15 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255} 16 | }, 17 | "DefaultHeight": {"Value": 48, "Units": "Pixels"}, 18 | "InterpolateStatesSpeed": 5 19 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/color_slider_horizontal.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureStretched": { 4 | "SourceRect": {"X": 128, "Y": 186, "Width": 128, "Height": 6}, 5 | "ExtraSize": {"Left": -10, "Right": -10, "Top": 0, "Bottom": 0} 6 | }, 7 | "Padding": {"Left": 10, "Right": 10, "Top": 0, "Bottom": 0}, 8 | "MarginBefore": {"X": 0, "Y": 18}, 9 | "MarginAfter": {"X": 0, "Y": 18} 10 | }, 11 | "Disabled": { 12 | "EffectIdentifier": "disabled" 13 | }, 14 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 15 | "DefaultHeight": {"Value": 18, "Units": "Pixels"}, 16 | "InterpolateStatesSpeed": 5, 17 | "InterpolateOffsetsSpeed": 10 18 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/scrollbar_vertical.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 192, "Y": 12, "Width": 16, "Height": 72}, 6 | "ExternalSourceRect": {"X": 192, "Y": 0, "Width": 16, "Height": 96} 7 | }, 8 | "Padding": {"Left": 0, "Right": 0, "Top": 70, "Bottom": 70}, 9 | "MarginBefore": {"X": 10, "Y": 10}, 10 | "MarginAfter": {"X": 10, "Y": 10} 11 | }, 12 | "Disabled": { 13 | "EffectIdentifier": "disabled" 14 | }, 15 | "DefaultWidth": {"Value": 32, "Units": "Pixels"}, 16 | "DefaultHeight": {"Value": 100, "Units": "PercentOfParent"}, 17 | "InterpolateStatesSpeed": 5, 18 | "InterpolateOffsetsSpeed": 10 19 | } -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Particle.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace MonoGo.MercuryParticleEngine 6 | { 7 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 8 | public struct Particle { 9 | public float Inception; 10 | public float Age; 11 | public Vector2 Position; 12 | public Vector2 TriggerPos; 13 | public Vector2 Velocity; 14 | public HSLColor Colour; 15 | public float Opacity; 16 | public Vector2 Scale; 17 | public float Rotation; 18 | public float Mass; 19 | 20 | public static readonly int SizeInBytes = Marshal.SizeOf(typeof(Particle)); 21 | } 22 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/progress_bar_horizontal.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 101, "Y": 130, "Width": 70, "Height": 12}, 6 | "ExternalSourceRect": {"X": 96, "Y": 128, "Width": 80, "Height": 16} 7 | }, 8 | "Padding": {"Left": 2, "Right": 2, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18} 11 | }, 12 | "Disabled": { 13 | "EffectIdentifier": "disabled" 14 | }, 15 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 16 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 17 | "InterpolateStatesSpeed": 5, 18 | "InterpolateOffsetsSpeed": 10 19 | } -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Extensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine; 3 | 4 | namespace MonoGo.MercuryParticleEngine 5 | { 6 | public static class Extensions 7 | { 8 | /// 9 | /// Copies the X and Y components of the vector to the specified memory location. 10 | /// 11 | /// The value of the Vector2 coordinate. 12 | /// The memory location to copy the coordinate to. 13 | public static unsafe void CopyTo(this Vector2 value, float* destination) 14 | { 15 | destination[0] = value.X; 16 | destination[1] = value.Y; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /MonoGo.Engine/MonoGo.Engine.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | false 6 | ..\bin\ 7 | ..\bin\$(AssemblyName).xml 8 | 1701;1702;1591;8618 9 | enable 10 | true 11 | Debug;Release 12 | 13 | 14 | 15 | 16 | All 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /MonoGo.Engine/Utils/CustomCollections/AccumulationBuffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoGo.Engine.Utils.CustomCollections 4 | { 5 | public class AccumulationBuffer where T : struct 6 | { 7 | private T[] buffer; 8 | 9 | 10 | public int Length { get; private set; } 11 | 12 | 13 | public AccumulationBuffer(int capacity = 32) 14 | { 15 | buffer = new T[capacity]; 16 | } 17 | 18 | public ref T this[int i] => ref buffer[i]; 19 | 20 | 21 | public void Add(T obj) 22 | { 23 | if (Length >= buffer.Length) 24 | { 25 | Array.Resize(ref buffer, buffer.Length * 2); 26 | } 27 | buffer[Length] = obj; 28 | Length += 1; 29 | } 30 | 31 | 32 | public void Clear() 33 | { 34 | Length = 0; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Modifiers/OpacityInterpolator2.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.MercuryParticleEngine.Modifiers 2 | { 3 | public class OpacityInterpolator2 : IModifier 4 | { 5 | public string Key { get; set; } 6 | 7 | public float InitialOpacity { get; set; } 8 | public float FinalOpacity { get; set; } 9 | 10 | public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) 11 | { 12 | var delta = FinalOpacity - InitialOpacity; 13 | 14 | while (iterator.HasNext) 15 | { 16 | var particle = iterator.Next(); 17 | particle->Opacity = delta * particle->Age + InitialOpacity; 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Profiles/SprayProfile.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine; 3 | using System; 4 | 5 | namespace MonoGo.MercuryParticleEngine.Profiles 6 | { 7 | public class SprayProfile : Profile 8 | { 9 | public Axis Direction { get; set; } 10 | public float Spread { get; set; } 11 | 12 | public override void GetOffsetAndHeading(out Vector2 offset, out Axis heading) { 13 | var angle = Direction.Map((x, y) => (float)Math.Atan2(y, x)); 14 | 15 | angle = FastRand.NextSingle(angle - Spread / 2f, angle + Spread / 2f); 16 | 17 | offset = Vector2.Zero; 18 | heading = new Axis((float)Math.Cos(angle), (float)Math.Sin(angle)); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Modifiers/ScaleInterpolator2.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace MonoGo.MercuryParticleEngine.Modifiers 4 | { 5 | public class ScaleInterpolator2 : IModifier 6 | { 7 | public string Key { get; set; } 8 | 9 | public Vector2 InitialScale { get; set; } 10 | public Vector2 FinalScale { get; set; } 11 | 12 | public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) 13 | { 14 | var delta = FinalScale - InitialScale; 15 | 16 | while (iterator.HasNext) 17 | { 18 | var particle = iterator.Next(); 19 | particle->Scale = delta * particle->Age + InitialScale; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/progress_bar_horizontal_alt_fill.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 102, "Y": 168, "Width": 14, "Height": 12}, 6 | "ExternalSourceRect": {"X": 96, "Y": 168, "Width": 26, "Height": 12} 7 | }, 8 | "Padding": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18} 11 | }, 12 | "Disabled": { 13 | "EffectIdentifier": "disabled" 14 | }, 15 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 16 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 17 | "InterpolateStatesSpeed": 0, 18 | "InterpolateOffsetsSpeed": 0, 19 | "MinWidth": 30, 20 | "DefaultAnchor": "CenterLeft" 21 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/progress_bar_horizontal_alt_fill.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 102, "Y": 168, "Width": 14, "Height": 12}, 6 | "ExternalSourceRect": {"X": 96, "Y": 168, "Width": 26, "Height": 12} 7 | }, 8 | "Padding": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18} 11 | }, 12 | "Disabled": { 13 | "EffectIdentifier": "disabled" 14 | }, 15 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 16 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 17 | "InterpolateStatesSpeed": 0, 18 | "InterpolateOffsetsSpeed": 0, 19 | "MinWidth": 30, 20 | "DefaultAnchor": "CenterLeft" 21 | } -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Serialization.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine; 2 | using MonoGo.MercuryParticleEngine.Modifiers; 3 | using MonoGo.MercuryParticleEngine.Profiles; 4 | using static MonoGo.Engine.AdditionalConverters; 5 | 6 | namespace MonoGo.MercuryParticleEngine 7 | { 8 | /// 9 | /// JSON converter for Profile types that supports polymorphic serialization. 10 | /// 11 | [MonoGoConverter] 12 | public class ProfileConverter : BaseTypeJsonConverter 13 | { 14 | } 15 | 16 | /// 17 | /// JSON converter for IModifier types that supports polymorphic serialization. 18 | /// 19 | [MonoGoConverter] 20 | public class ModifierConverter : BaseTypeJsonConverter 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /MonoGo.Engine/Collisions/ShapePool.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.Collisions.Shapes; 2 | using MonoGo.Engine.Utils.CustomCollections; 3 | 4 | namespace MonoGo.Engine.Collisions 5 | { 6 | public static class ShapePool 7 | { 8 | private static Pool _circlePool = new Pool(); 9 | private static Pool _polygonPool = new Pool(); 10 | 11 | 12 | public static Circle GetCircle() => 13 | _circlePool.Get(); 14 | 15 | 16 | public static Polygon GetPolygon() => 17 | _polygonPool.Get(); 18 | 19 | 20 | public static void Return(IShape shape) 21 | { 22 | if (shape.Type == ShapeType.Circle) 23 | { 24 | _circlePool.Return((Circle)shape); 25 | } 26 | else 27 | { 28 | _polygonPool.Return((Polygon)shape); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/Objects/TiledRectangleObject.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Tiled.MapStructure.Objects 3 | { 4 | /// 5 | /// Represents a rectangle object in a Tiled map. 6 | /// 7 | public class TiledRectangleObject : TiledObject 8 | { 9 | /// 10 | /// Initializes a new instance of the class. 11 | /// 12 | public TiledRectangleObject() { } 13 | 14 | /// 15 | /// Initializes a new instance of the class by copying another object. 16 | /// 17 | /// The object to copy. 18 | public TiledRectangleObject(TiledObject obj) : base(obj) { } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/progress_bar_horizontal_alt_fill.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 102, "Y": 168, "Width": 14, "Height": 12}, 6 | "ExternalSourceRect": {"X": 96, "Y": 168, "Width": 26, "Height": 12} 7 | }, 8 | "Padding": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18} 11 | }, 12 | "Disabled": { 13 | "EffectIdentifier": "disabled" 14 | }, 15 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 16 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 17 | "InterpolateStatesSpeed": 0, 18 | "InterpolateOffsetsSpeed": 0, 19 | "MinWidth": 30, 20 | "DefaultAnchor": "CenterLeft" 21 | } -------------------------------------------------------------------------------- /Modules/MonoGo.Iguina/Extensions.cs: -------------------------------------------------------------------------------- 1 | using Iguina.Defs; 2 | 3 | namespace MonoGo.Iguina 4 | { 5 | /// 6 | /// Provides extension methods to simplify working with the Iguina UI-System. 7 | /// 8 | public static class Extensions 9 | { 10 | /// 11 | /// Sets the value of a in pixels. 12 | /// 13 | /// The measurement to modify (e.g. Offset). 14 | /// The new value in pixels (could be a fraction of Offset). 15 | public static void SetPixels(this ref Measurement measurement, float value) 16 | { 17 | measurement.Value = value; 18 | measurement.Units = MeasureUnit.Pixels; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MonoGo.Engine/IHaveGUI.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Engine 2 | { 3 | /// 4 | /// General interface for working with GUI libs. 5 | /// 6 | public interface IHaveGUI 7 | { 8 | /// 9 | /// Add UI entities to this GUI root. 10 | /// 11 | void CreateUI(); 12 | 13 | /// 14 | /// Enable or disable this GUI root. 15 | /// 16 | void Enable(bool enable); 17 | 18 | /// 19 | /// Make this GUI root visible or invisible. 20 | /// 21 | void Visible(bool visible); 22 | 23 | /// 24 | /// Removes this GUI root and all of its contents from his parent. 25 | /// 26 | void Clear(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/color_slider_horizontal_handle.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "Icon": { 4 | "SourceRect": {"X": 123, "Y": 144, "Width": 10, "Height": 12}, 5 | "CenterVertically": true 6 | } 7 | }, 8 | "Targeted": { 9 | "Icon": { 10 | "SourceRect": {"X": 123, "Y": 156, "Width": 10, "Height": 12}, 11 | "CenterVertically": true 12 | } 13 | }, 14 | "Interacted": { 15 | "Icon": { 16 | "SourceRect": {"X": 123, "Y": 168, "Width": 10, "Height": 12}, 17 | "CenterVertically": true 18 | } 19 | }, 20 | "Disabled": { 21 | "EffectIdentifier": "disabled" 22 | }, 23 | "DefaultWidth": {"Value": 30, "Units": "Pixels"}, 24 | "DefaultHeight": {"Value": 36, "Units": "Pixels"}, 25 | "InterpolateStatesSpeed": 5, 26 | "InterpolateOffsetsSpeed": 10 27 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/color_slider_horizontal_handle.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "Icon": { 4 | "SourceRect": {"X": 123, "Y": 144, "Width": 10, "Height": 12}, 5 | "CenterVertically": true 6 | } 7 | }, 8 | "Targeted": { 9 | "Icon": { 10 | "SourceRect": {"X": 123, "Y": 156, "Width": 10, "Height": 12}, 11 | "CenterVertically": true 12 | } 13 | }, 14 | "Interacted": { 15 | "Icon": { 16 | "SourceRect": {"X": 123, "Y": 168, "Width": 10, "Height": 12}, 17 | "CenterVertically": true 18 | } 19 | }, 20 | "Disabled": { 21 | "EffectIdentifier": "disabled" 22 | }, 23 | "DefaultWidth": {"Value": 30, "Units": "Pixels"}, 24 | "DefaultHeight": {"Value": 36, "Units": "Pixels"}, 25 | "InterpolateStatesSpeed": 5, 26 | "InterpolateOffsetsSpeed": 10 27 | } -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/Orientation.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Tiled.MapStructure 3 | { 4 | /// 5 | /// Specifies the orientation of a Tiled map. 6 | /// 7 | public enum Orientation : byte 8 | { 9 | /// 10 | /// Orthogonal orientation (grid-based). 11 | /// 12 | Orthogonal = 0, 13 | 14 | /// 15 | /// Isometric orientation (diamond-shaped tiles). 16 | /// 17 | Isometric = 1, 18 | 19 | /// 20 | /// Staggered orientation (hexagonal or staggered isometric tiles). 21 | /// 22 | Staggered = 2, 23 | 24 | /// 25 | /// Hexagonal orientation (hexagonal tiles). 26 | /// 27 | Hexagonal = 3 28 | } 29 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/color_slider_horizontal_handle.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "Icon": { 4 | "SourceRect": {"X": 123, "Y": 144, "Width": 10, "Height": 12}, 5 | "CenterVertically": true 6 | } 7 | }, 8 | "Targeted": { 9 | "Icon": { 10 | "SourceRect": {"X": 123, "Y": 156, "Width": 10, "Height": 12}, 11 | "CenterVertically": true 12 | } 13 | }, 14 | "Interacted": { 15 | "Icon": { 16 | "SourceRect": {"X": 123, "Y": 168, "Width": 10, "Height": 12}, 17 | "CenterVertically": true 18 | } 19 | }, 20 | "Disabled": { 21 | "EffectIdentifier": "disabled" 22 | }, 23 | "DefaultWidth": {"Value": 30, "Units": "Pixels"}, 24 | "DefaultHeight": {"Value": 36, "Units": "Pixels"}, 25 | "InterpolateStatesSpeed": 5, 26 | "InterpolateOffsetsSpeed": 10 27 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/panel_title.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 4, "Y": 98, "Width": 72, "Height": 14}, 6 | "ExternalSourceRect": {"X": 0, "Y": 98, "Width": 80, "Height": 14}, 7 | "Offset": {"X": 0, "Y": 0} 8 | }, 9 | "Padding": {"Left": 6, "Right": 6, "Top": 0, "Bottom": 0}, 10 | "ExtraSize": {"Left": 60, "Right": 60, "Top": 0, "Bottom": 0}, 11 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255}, 12 | "TextOutlineColor": {"R": 0, "G": 0, "B": 0, "A": 255}, 13 | "MarginAfter": {"X": 0, "Y": 20}, 14 | "FontSize": 22, 15 | "TextSpacing": 1.75, 16 | "TextOutlineWidth": 2, 17 | "TextAlignment": "Center" 18 | }, 19 | "Disabled": { 20 | "EffectIdentifier": "disabled" 21 | } 22 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/panel_title.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 4, "Y": 98, "Width": 72, "Height": 14}, 6 | "ExternalSourceRect": {"X": 0, "Y": 98, "Width": 80, "Height": 14}, 7 | "Offset": {"X": 0, "Y": 0} 8 | }, 9 | "Padding": {"Left": 6, "Right": 6, "Top": 0, "Bottom": 0}, 10 | "ExtraSize": {"Left": 60, "Right": 60, "Top": 0, "Bottom": 0}, 11 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255}, 12 | "TextOutlineColor": {"R": 0, "G": 0, "B": 0, "A": 255}, 13 | "MarginAfter": {"X": 0, "Y": 20}, 14 | "FontSize": 22, 15 | "TextSpacing": 1.75, 16 | "TextOutlineWidth": 2, 17 | "TextAlignment": "Center" 18 | }, 19 | "Disabled": { 20 | "EffectIdentifier": "disabled" 21 | } 22 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/progress_bar_horizontal_fill.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 133, "Y": 114, "Width": 70, "Height": 12}, 6 | "ExternalSourceRect": {"X": 128, "Y": 112, "Width": 80, "Height": 16} 7 | }, 8 | "Padding": {"Left": 40, "Right": 40, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18}, 11 | "TintColor": {"R": 155, "G": 255, "B": 255, "A": 255} 12 | }, 13 | "Disabled": { 14 | "EffectIdentifier": "disabled" 15 | }, 16 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 17 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 18 | "InterpolateStatesSpeed": 5, 19 | "InterpolateOffsetsSpeed": 10, 20 | "MinWidth": 30, 21 | "DefaultAnchor": "CenterLeft" 22 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/progress_bar_horizontal_fill.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 133, "Y": 114, "Width": 70, "Height": 12}, 6 | "ExternalSourceRect": {"X": 128, "Y": 112, "Width": 80, "Height": 16} 7 | }, 8 | "Padding": {"Left": 40, "Right": 40, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18}, 11 | "TintColor": {"R": 155, "G": 255, "B": 255, "A": 255} 12 | }, 13 | "Disabled": { 14 | "EffectIdentifier": "disabled" 15 | }, 16 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 17 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 18 | "InterpolateStatesSpeed": 5, 19 | "InterpolateOffsetsSpeed": 10, 20 | "MinWidth": 30, 21 | "DefaultAnchor": "CenterLeft" 22 | } -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/RenderOrder.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Tiled.MapStructure 3 | { 4 | /// 5 | /// Specifies the render order of tiles in a Tiled map. 6 | /// 7 | public enum RenderOrder : byte 8 | { 9 | /// 10 | /// Render tiles from right to left, top to bottom. 11 | /// 12 | RightDown = 0, 13 | 14 | /// 15 | /// Render tiles from right to left, bottom to top. 16 | /// 17 | RightUp = 1, 18 | 19 | /// 20 | /// Render tiles from left to right, top to bottom. 21 | /// 22 | LeftDown = 2, 23 | 24 | /// 25 | /// Render tiles from left to right, bottom to top. 26 | /// 27 | LeftUp = 3 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /MonoGo.Pipeline/SpriteGroup/SpriteGroupData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace MonoGo.Pipeline.SpriteGroup 4 | { 5 | public class SpriteGroupData 6 | { 7 | /// 8 | /// Size of a single texture atlas. Should be power of 2. 9 | /// 10 | public int AtlasSize; 11 | 12 | /// 13 | /// Space between textures on atlas. Will be filled with border pixels. 14 | /// 15 | public int TexturePadding; 16 | 17 | /// 18 | /// Full path to source sprites. 19 | /// 20 | public string RootDir; 21 | 22 | /// 23 | /// Name of sprite group. Equals to file name. 24 | /// 25 | public string GroupName; 26 | 27 | public List Sprites = new List(); 28 | public List SingleTextures = new List(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Profiles/RingProfile.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine; 3 | 4 | namespace MonoGo.MercuryParticleEngine.Profiles 5 | { 6 | public class RingProfile : Profile 7 | { 8 | public float Radius { get; set; } 9 | public CircleRadiation Radiate { get; set; } 10 | 11 | public override void GetOffsetAndHeading(out Vector2 offset, out Axis heading) { 12 | FastRand.NextUnitVector(out heading); 13 | 14 | if (Radiate == CircleRadiation.In) 15 | offset = new Vector2(-heading.X * Radius, -heading.Y * Radius); 16 | else 17 | offset = new Vector2(heading.X * Radius, heading.Y * Radius); 18 | 19 | if (Radiate == CircleRadiation.None) 20 | FastRand.NextUnitVector(out heading); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/TiledMapObjectLayer.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Tiled.MapStructure.Objects; 3 | 4 | namespace MonoGo.Tiled.MapStructure 5 | { 6 | /// 7 | /// Represents an object layer in a Tiled map. 8 | /// 9 | public class TiledMapObjectLayer : TiledMapLayer 10 | { 11 | /// 12 | /// Gets or sets the array of objects in the layer. 13 | /// 14 | public TiledObject[] Objects; 15 | 16 | /// 17 | /// Gets or sets the drawing order of objects in the layer. 18 | /// 19 | public TiledMapObjectDrawingOrder DrawingOrder; 20 | 21 | /// 22 | /// Gets or sets the color of the object layer. 23 | /// 24 | public Color Color; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/panel_title.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 4, "Y": 98, "Width": 72, "Height": 14}, 6 | "ExternalSourceRect": {"X": 0, "Y": 98, "Width": 80, "Height": 14}, 7 | "Offset": {"X": 0, "Y": 0} 8 | }, 9 | "Padding": {"Left": 6, "Right": 6, "Top": 0, "Bottom": 0}, 10 | "ExtraSize": {"Left": 60, "Right": 60, "Top": 0, "Bottom": 0}, 11 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255}, 12 | "TextOutlineColor": {"R": 0, "G": 0, "B": 0, "A": 255}, 13 | "MarginAfter": {"X": 0, "Y": 20}, 14 | "FontSize": 22, 15 | "TextSpacing": 1.75, 16 | "TextOutlineWidth": 2, 17 | "TextAlignment": "Center" 18 | }, 19 | "Disabled": { 20 | "EffectIdentifier": "disabled" 21 | } 22 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/checkbox.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "Icon": { 5 | 6 | "SourceRect": {"X": 80, "Y": 96, "Width": 16, "Height": 16}, 7 | "CenterVertically": true 8 | }, 9 | "TextAlignment": "Left", 10 | "Padding": {"Left": 20, "Right": 0, "Top": 0, "Bottom": 0} 11 | }, 12 | "Targeted": { 13 | "Icon": { 14 | "SourceRect": {"X": 112, "Y": 96, "Width": 16, "Height": 16}, 15 | "CenterVertically": true 16 | } 17 | }, 18 | "TargetedChecked": { 19 | }, 20 | "Interacted": { 21 | "Icon": { 22 | 23 | "SourceRect": {"X": 96, "Y": 96, "Width": 16, "Height": 16}, 24 | "CenterVertically": true 25 | } 26 | }, 27 | "Checked": { 28 | }, 29 | "DefaultTextAnchor": "CenterLeft", 30 | "InterpolateStatesSpeed": 5 31 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/checkbox.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "Icon": { 5 | 6 | "SourceRect": {"X": 80, "Y": 96, "Width": 16, "Height": 16}, 7 | "CenterVertically": true 8 | }, 9 | "TextAlignment": "Left", 10 | "Padding": {"Left": 20, "Right": 0, "Top": 0, "Bottom": 0} 11 | }, 12 | "Targeted": { 13 | "Icon": { 14 | "SourceRect": {"X": 112, "Y": 96, "Width": 16, "Height": 16}, 15 | "CenterVertically": true 16 | } 17 | }, 18 | "TargetedChecked": { 19 | }, 20 | "Interacted": { 21 | "Icon": { 22 | 23 | "SourceRect": {"X": 96, "Y": 96, "Width": 16, "Height": 16}, 24 | "CenterVertically": true 25 | } 26 | }, 27 | "Checked": { 28 | }, 29 | "DefaultTextAnchor": "CenterLeft", 30 | "InterpolateStatesSpeed": 5 31 | } -------------------------------------------------------------------------------- /MonoGo.Engine.DesktopGL/MonoGo.Engine.DesktopGL.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | false 6 | ..\bin\ 7 | ..\bin\$(AssemblyName).xml 8 | 1701;1702;1591 9 | Debug;Release 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /MonoGo.Engine/Drawing/CustomLinePrimitive.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Graphics; 2 | 3 | namespace MonoGo.Engine.Drawing 4 | { 5 | /// 6 | /// Line primitive, which can accept any array of indices. 7 | /// 8 | public class CustomLinePrimitive : Primitive2D 9 | { 10 | protected override PrimitiveType _primitiveType => PrimitiveType.LineList; 11 | 12 | /// 13 | /// Array of primitive indices. They tell primitive what vertices to draw in what order. 14 | /// 15 | public short[] Indices; 16 | 17 | public CustomLinePrimitive(int capacity, short[] indices = null) : base(capacity) 18 | { 19 | Indices = indices; 20 | } 21 | 22 | /// 23 | /// Sets user-defined list of indices for a list of lines. 24 | /// 25 | protected override short[] GetIndices() => 26 | Indices; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /MonoGo.Engine/Utils/Tilemaps/BasicTile.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Engine.Utils.Tilemaps 3 | { 4 | public struct BasicTile : ITile 5 | { 6 | public int Index {get; set;} 7 | public bool IsBlank => Tileset == null || Index == (Tileset.StartingIndex - 1); 8 | 9 | public bool FlipHor {get; set;} 10 | public bool FlipVer {get; set;} 11 | public bool FlipDiag {get; set;} 12 | 13 | public Tileset Tileset; 14 | 15 | public BasicTile(int index, Tileset tileset, bool flipHor = false, bool flipVer = false, bool flipDiag = false) 16 | { 17 | Index = index; 18 | Tileset = tileset; 19 | FlipHor = flipHor; 20 | FlipVer = flipVer; 21 | FlipDiag = flipDiag; 22 | } 23 | 24 | public ITilesetTile GetTilesetTile() 25 | { 26 | if (Tileset == null) 27 | { 28 | return null; 29 | } 30 | return Tileset.GetTilesetTile(Index); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /MonoGo.Samples/SceneFactory.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.Drawing; 2 | using MonoGo.Engine.Resources; 3 | using MonoGo.Engine.SceneSystem; 4 | using System; 5 | 6 | namespace MonoGo.Samples 7 | { 8 | public class SceneFactory 9 | { 10 | public Scene Scene; 11 | public Type Type { get; private set; } 12 | 13 | public SceneFactory(Type type, string description = "") 14 | { 15 | Type = type; 16 | Description = description; 17 | } 18 | 19 | public readonly string Description; 20 | 21 | public void CreateScene() 22 | { 23 | Text.CurrentFont = ResourceHub.GetResource("Fonts", "Default"); 24 | 25 | Scene = SceneMgr.CreateScene(Type.Name); 26 | Scene.CreateLayer("default"); 27 | Activator.CreateInstance(Type, Scene["default"]); 28 | } 29 | 30 | public void DestroyScene() => 31 | SceneMgr.DestroyScene(Scene); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/progress_bar_horizontal_fill.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 133, "Y": 114, "Width": 70, "Height": 12}, 6 | "ExternalSourceRect": {"X": 128, "Y": 112, "Width": 80, "Height": 16} 7 | }, 8 | "Padding": {"Left": 40, "Right": 40, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18}, 11 | "TintColor": {"R": 155, "G": 255, "B": 255, "A": 255} 12 | }, 13 | "Disabled": { 14 | "EffectIdentifier": "disabled" 15 | }, 16 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 17 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 18 | "InterpolateStatesSpeed": 5, 19 | "InterpolateOffsetsSpeed": 10, 20 | "MinWidth": 30, 21 | "DefaultAnchor": "CenterLeft" 22 | } -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/Objects/TiledEllipseObject.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace MonoGo.Tiled.MapStructure.Objects 4 | { 5 | /// 6 | /// Represents an ellipse object in a Tiled map. 7 | /// 8 | public class TiledEllipseObject : TiledObject 9 | { 10 | public Vector2 Center => Position + Size / 2f; 11 | 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public TiledEllipseObject() { } 16 | 17 | /// 18 | /// Initializes a new instance of the class by copying another object. 19 | /// 20 | /// The object to copy. 21 | public TiledEllipseObject(TiledObject obj) : base(obj) { } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Modifiers/HueInterpolator2.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine; 2 | 3 | namespace MonoGo.MercuryParticleEngine.Modifiers 4 | { 5 | public class HueInterpolator2 : IModifier 6 | { 7 | public string Key { get; set; } 8 | 9 | public float InitialHue { get; set; } 10 | public float FinalHue { get; set; } 11 | 12 | public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) 13 | { 14 | var delta = FinalHue - InitialHue; 15 | 16 | while (iterator.HasNext) 17 | { 18 | var particle = iterator.Next(); 19 | particle->Colour = new HSLColor( 20 | delta * particle->Age + InitialHue, 21 | particle->Colour.S, 22 | particle->Colour.L); 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Profiles/CircleProfile.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine; 3 | 4 | namespace MonoGo.MercuryParticleEngine.Profiles 5 | { 6 | public class CircleProfile : Profile 7 | { 8 | public float Radius { get; set; } 9 | public CircleRadiation Radiate { get; set; } 10 | 11 | public override void GetOffsetAndHeading(out Vector2 offset, out Axis heading) { 12 | var dist = FastRand.NextSingle(0f, Radius); 13 | 14 | FastRand.NextUnitVector(out heading); 15 | 16 | offset = Radiate == CircleRadiation.In 17 | ? new Vector2(-heading.X*dist, -heading.Y*dist) 18 | : new Vector2(heading.X*dist, heading.Y*dist); 19 | 20 | if (Radiate == CircleRadiation.None) 21 | FastRand.NextUnitVector(out heading); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /MonoGo.Engine.DesktopGL/MonoGoPlatform.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoGo.Engine.DesktopGL 4 | { 5 | public static class MonoGoPlatform 6 | { 7 | public static void Init() 8 | { 9 | if (Environment.OSVersion.Platform == PlatformID.Win32NT) 10 | { 11 | GameMgr.CurrentPlatform = Platform.Windows; 12 | } 13 | else if (Environment.OSVersion.Platform == PlatformID.Unix) 14 | { 15 | GameMgr.CurrentPlatform = Platform.Linux; 16 | } 17 | else if (Environment.OSVersion.Platform == PlatformID.MacOSX) 18 | { 19 | GameMgr.CurrentPlatform = Platform.MacOS; 20 | } 21 | else 22 | { 23 | GameMgr.CurrentPlatform = Platform.Other; 24 | } 25 | 26 | GameMgr.CurrentGraphicsBackend = GraphicsBackend.OpenGL; 27 | 28 | StuffResolver.AddStuffAs(new AlphaBlendEffectLoaderDesktopGl()); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/checkbox.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "Icon": { 5 | 6 | "SourceRect": {"X": 80, "Y": 96, "Width": 16, "Height": 16}, 7 | "CenterVertically": true 8 | }, 9 | "TextAlignment": "Left", 10 | "Padding": {"Left": 20, "Right": 0, "Top": 0, "Bottom": 0} 11 | }, 12 | "Targeted": { 13 | "Icon": { 14 | "SourceRect": {"X": 112, "Y": 96, "Width": 16, "Height": 16}, 15 | "CenterVertically": true 16 | } 17 | }, 18 | "TargetedChecked": { 19 | }, 20 | "Interacted": { 21 | "Icon": { 22 | 23 | "SourceRect": {"X": 96, "Y": 96, "Width": 16, "Height": 16}, 24 | "CenterVertically": true 25 | } 26 | }, 27 | "Checked": { 28 | }, 29 | "DefaultTextAnchor": "CenterLeft", 30 | "InterpolateStatesSpeed": 5 31 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/paragraph_base_style.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255}, 4 | "TextOutlineColor": {"R": 0, "G": 0, "B": 0, "A": 255}, 5 | "NoValueTextFillColor": {"R": 175, "G": 175, "B": 175, "A": 255}, 6 | "FontSize": 22, 7 | "TextSpacing": 2, 8 | "TextOutlineWidth": 2, 9 | "TextAlignment": "Left" 10 | }, 11 | "Targeted": { 12 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255} 13 | }, 14 | "Interacted": { 15 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255} 16 | }, 17 | "TargetedChecked": { 18 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255} 19 | }, 20 | "Checked": { 21 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255} 22 | }, 23 | "Disabled": { 24 | "EffectIdentifier": "disabled" 25 | } 26 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/paragraph_base_style.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255}, 4 | "TextOutlineColor": {"R": 0, "G": 0, "B": 0, "A": 255}, 5 | "NoValueTextFillColor": {"R": 175, "G": 175, "B": 175, "A": 255}, 6 | "FontSize": 22, 7 | "TextSpacing": 2, 8 | "TextOutlineWidth": 2, 9 | "TextAlignment": "Left" 10 | }, 11 | "Targeted": { 12 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255} 13 | }, 14 | "Interacted": { 15 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255} 16 | }, 17 | "TargetedChecked": { 18 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255} 19 | }, 20 | "Checked": { 21 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255} 22 | }, 23 | "Disabled": { 24 | "EffectIdentifier": "disabled" 25 | } 26 | } -------------------------------------------------------------------------------- /Modules/MonoGo.Iguina/MonoGo.Iguina.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | false 6 | ..\..\bin\ 7 | ..\..\bin\$(AssemblyName).xml 8 | enable 9 | enable 10 | true 11 | Iguina UI-System integration for MonoGo. 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /MonoGo.Engine/Drawing/CustomTrianglePrimitive.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Graphics; 2 | 3 | namespace MonoGo.Engine.Drawing 4 | { 5 | /// 6 | /// Triangle primitive, which can accept any array of indices. 7 | /// 8 | public class CustomTrianglePrimitive : Primitive2D 9 | { 10 | protected override PrimitiveType _primitiveType => PrimitiveType.TriangleList; 11 | 12 | /// 13 | /// Array of primitive indices. They tell primitive what vertices to draw in what order. 14 | /// 15 | public short[] Indices; 16 | 17 | public CustomTrianglePrimitive(int capacity, short[] indices = null) : base(capacity) 18 | { 19 | Indices = indices; 20 | } 21 | 22 | 23 | /// 24 | /// Sets user-defined list of indices for a list of triangles. 25 | /// 26 | protected override short[] GetIndices() => 27 | Indices; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /MonoGo.Engine/Cameras/CameraMgr.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.Utils.CustomCollections; 2 | using System.Collections.Generic; 3 | 4 | namespace MonoGo.Engine.Cameras 5 | { 6 | /// 7 | /// Manages camera priorities. 8 | /// 9 | public static class CameraMgr 10 | { 11 | /// 12 | /// List of all cameras. 13 | /// 14 | public static List Cameras => _cameras.ToList(); 15 | 16 | private static SafeSortedList _cameras = new SafeSortedList(x => x.Priority); 17 | 18 | /// 19 | /// Removes camera from list and adds it again, taking in account its proirity. 20 | /// 21 | internal static void UpdateCameraPriority(Camera camera) 22 | { 23 | _cameras.Remove(camera); 24 | _cameras.Add(camera); 25 | } 26 | 27 | internal static void RemoveCamera(Camera camera) => 28 | _cameras.Remove(camera); 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/progress_bar_horizontal_alt.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 102, "Y": 144, "Width": 14, "Height": 12}, 6 | "ExternalSourceRect": {"X": 96, "Y": 144, "Width": 26, "Height": 12} 7 | }, 8 | "Padding": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18} 11 | }, 12 | "Targeted": { 13 | "FillTextureFramed": { 14 | 15 | "InternalSourceRect": {"X": 102, "Y": 156, "Width": 14, "Height": 12}, 16 | "ExternalSourceRect": {"X": 96, "Y": 156, "Width": 26, "Height": 12} 17 | } 18 | }, 19 | "Disabled": { 20 | "EffectIdentifier": "disabled" 21 | }, 22 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 23 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 24 | "InterpolateStatesSpeed": 5 25 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/progress_bar_horizontal_alt.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 102, "Y": 144, "Width": 14, "Height": 12}, 6 | "ExternalSourceRect": {"X": 96, "Y": 144, "Width": 26, "Height": 12} 7 | }, 8 | "Padding": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18} 11 | }, 12 | "Targeted": { 13 | "FillTextureFramed": { 14 | 15 | "InternalSourceRect": {"X": 102, "Y": 156, "Width": 14, "Height": 12}, 16 | "ExternalSourceRect": {"X": 96, "Y": 156, "Width": 26, "Height": 12} 17 | } 18 | }, 19 | "Disabled": { 20 | "EffectIdentifier": "disabled" 21 | }, 22 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 23 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 24 | "InterpolateStatesSpeed": 5 25 | } -------------------------------------------------------------------------------- /MonoGo.Samples/Misc/Tiled/BotFactory.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.EC; 2 | using MonoGo.Engine.SceneSystem; 3 | using MonoGo.Tiled; 4 | using MonoGo.Tiled.MapStructure.Objects; 5 | using System.Globalization; 6 | 7 | namespace MonoGo.Samples.Misc.Tiled 8 | { 9 | public class BotFactory : ITiledEntityFactory 10 | { 11 | public string Tag => "Bot"; 12 | 13 | public Entity Make(TiledObject obj, Layer layer, MapBuilder map) 14 | { 15 | var tile = (TiledTileObject)obj; 16 | 17 | var entity = new Bot(layer); 18 | var position = entity.GetComponent(); 19 | position.StartingPosition = tile.Position; 20 | position.Position = tile.Position; 21 | 22 | var actor = entity.GetComponent(); 23 | 24 | // Retrieving a custom parameter. 25 | actor.Speed = float.Parse(tile.Properties["Speed"], CultureInfo.InvariantCulture); 26 | 27 | return entity; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/paragraph_base_style.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255}, 4 | "TextOutlineColor": {"R": 0, "G": 0, "B": 0, "A": 255}, 5 | "NoValueTextFillColor": {"R": 175, "G": 175, "B": 175, "A": 255}, 6 | "FontSize": 22, 7 | "TextSpacing": 2, 8 | "TextOutlineWidth": 2, 9 | "TextAlignment": "Left" 10 | }, 11 | "Targeted": { 12 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255} 13 | }, 14 | "Interacted": { 15 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255} 16 | }, 17 | "TargetedChecked": { 18 | "TextFillColor": {"R": 0, "G": 255, "B": 255, "A": 255} 19 | }, 20 | "Checked": { 21 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255} 22 | }, 23 | "Disabled": { 24 | "EffectIdentifier": "disabled" 25 | } 26 | } -------------------------------------------------------------------------------- /MonoGo.Engine/Utils/CustomCollections/Pool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoGo.Engine.Utils.CustomCollections 4 | { 5 | public class Pool where T : IPoolable, new() 6 | { 7 | private UnorderedList _items = new UnorderedList(32); 8 | 9 | public T Get() 10 | { 11 | if (_items.Count > 0) 12 | { 13 | T obj; 14 | obj = _items[_items.Count - 1]; 15 | _items.RemoveLast(); 16 | 17 | obj.OnTakenFromPool(); 18 | obj.InPool = false; 19 | return obj; 20 | } 21 | else 22 | { 23 | T obj = new T(); 24 | obj.OnTakenFromPool(); 25 | obj.InPool = false; 26 | return obj; 27 | } 28 | } 29 | 30 | 31 | public void Return(T obj) 32 | { 33 | if (obj.InPool) 34 | { 35 | throw new InvalidOperationException("Provided object is already in a pool!"); 36 | } 37 | obj.OnReturnedToPool(); 38 | obj.InPool = true; 39 | _items.Add(obj); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/progress_bar_horizontal_alt.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 102, "Y": 144, "Width": 14, "Height": 12}, 6 | "ExternalSourceRect": {"X": 96, "Y": 144, "Width": 26, "Height": 12} 7 | }, 8 | "Padding": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18} 11 | }, 12 | "Targeted": { 13 | "FillTextureFramed": { 14 | 15 | "InternalSourceRect": {"X": 102, "Y": 156, "Width": 14, "Height": 12}, 16 | "ExternalSourceRect": {"X": 96, "Y": 156, "Width": 26, "Height": 12} 17 | } 18 | }, 19 | "Disabled": { 20 | "EffectIdentifier": "disabled" 21 | }, 22 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 23 | "DefaultHeight": {"Value": 32, "Units": "Pixels"}, 24 | "InterpolateStatesSpeed": 5 25 | } -------------------------------------------------------------------------------- /Templates/MonoGo.Templates.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MonoGo.Templates 5 | 1.3.7 6 | MonoGo Engine Templates 7 | Marcel Härtel 8 | Marcel Härtel 9 | https://github.com/BlizzCrafter/MonoGo 10 | 11 | Cross-Platform C# 2D game engine build ontop of MonoGame. 12 | MonoGame MonoGo Engine GameDev 13 | MIT 14 | false 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Modifiers/LinearGravityModifier.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine; 3 | 4 | namespace MonoGo.MercuryParticleEngine.Modifiers 5 | { 6 | public class LinearGravityModifier : IModifier 7 | { 8 | public string Key { get; set; } 9 | 10 | public Axis Direction { get; set; } 11 | public float Strength { get; set; } 12 | 13 | public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) 14 | { 15 | var vector = Direction * (Strength * elapsedSeconds); 16 | 17 | while (iterator.HasNext) 18 | { 19 | var particle = iterator.Next(); 20 | particle->Velocity = new Vector2( 21 | particle->Velocity.X + vector.X * particle->Mass, 22 | particle->Velocity.Y + vector.Y * particle->Mass); 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Content/Assets/Engine/Effects/Disabled.fx: -------------------------------------------------------------------------------- 1 | #if OPENGL 2 | #define SV_POSITION POSITION 3 | #define VS_SHADERMODEL vs_3_0 4 | #define PS_SHADERMODEL ps_3_0 5 | #else 6 | #define VS_SHADERMODEL vs_4_0_level_9_1 7 | #define PS_SHADERMODEL ps_4_0_level_9_1 8 | #endif 9 | 10 | Texture2D SpriteTexture; 11 | 12 | sampler2D SpriteTextureSampler = sampler_state 13 | { 14 | Texture = ; 15 | }; 16 | 17 | struct VertexShaderOutput 18 | { 19 | float4 Position : SV_POSITION; 20 | float4 Color : COLOR0; 21 | float2 TextureCoordinates : TEXCOORD0; 22 | }; 23 | 24 | float4 MainPS(VertexShaderOutput input) : COLOR 25 | { 26 | float4 color = tex2D(SpriteTextureSampler,input.TextureCoordinates) * input.Color; 27 | float value = (color.r + color.g + color.b) / 3; 28 | color.r = color.g = color.b = value; 29 | return color; 30 | } 31 | 32 | technique SpriteDrawing 33 | { 34 | pass P0 35 | { 36 | PixelShader = compile PS_SHADERMODEL MainPS(); 37 | } 38 | }; -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Modifiers/DragModifier.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace MonoGo.MercuryParticleEngine.Modifiers 4 | { 5 | public class DragModifier : IModifier 6 | { 7 | public string Key { get; set; } 8 | 9 | public float DragCoefficient { get; set; } = 0.47f; 10 | public float Density { get; set; } = .5f; 11 | 12 | public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) 13 | { 14 | while (iterator.HasNext) 15 | { 16 | var particle = iterator.Next(); 17 | var drag = -DragCoefficient * Density * particle->Mass * elapsedSeconds; 18 | 19 | particle->Velocity = new Vector2( 20 | particle->Velocity.X + particle->Velocity.X * drag, 21 | particle->Velocity.Y + particle->Velocity.Y * drag); 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Nuget.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | MonoGo.Engine 4 | $(MonoGoVersion) 5 | Marcel Härtel 6 | MonoGo Engine 7 | Cross-Platform C# 2D game engine build ontop of MonoGame. 8 | https://github.com/BlizzCrafter/MonoGo 9 | https://github.com/MonoGo-Engine/MonoGo.git 10 | README.md 11 | LICENSE.txt 12 | Logo_BG_x192.png 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/MonoGo.MercuryParticleEngine.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | false 5 | ..\..\bin\ 6 | ..\..\bin\$(AssemblyName).xml 7 | enable 8 | enable 9 | true 10 | true 11 | Mercury Particle Engine integration for MonoGo. 12 | 13 | 14 | 15 | All 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /MonoGo.Engine/Utils/SlowRotator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoGo.Engine.Utils 4 | { 5 | /// 6 | /// Gradually rotates the angle towards the target. 7 | /// 8 | public class SlowRotator 9 | { 10 | public TimeKeeper Time = TimeKeeper.Global; 11 | 12 | public Angle Direction; 13 | 14 | /// 15 | /// The speed with which rotator will rotate. Measured in deg/sec. 16 | /// 17 | public double RotationSpeed; 18 | 19 | public SlowRotator(double rotationSpeed) 20 | { 21 | RotationSpeed = rotationSpeed; 22 | } 23 | 24 | public void Update(Angle targetDirection) 25 | { 26 | var delta = Direction.Difference(targetDirection); 27 | 28 | var frameTurnSpeed = Time.Time(RotationSpeed); 29 | 30 | if (Math.Abs(delta) > frameTurnSpeed) 31 | { 32 | Direction -= frameTurnSpeed * Math.Sign(delta); 33 | } 34 | else 35 | { 36 | Direction = targetDirection; 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/Effects/Disabled.fx: -------------------------------------------------------------------------------- 1 | #if OPENGL 2 | #define SV_POSITION POSITION 3 | #define VS_SHADERMODEL vs_3_0 4 | #define PS_SHADERMODEL ps_3_0 5 | #else 6 | #define VS_SHADERMODEL vs_4_0_level_9_1 7 | #define PS_SHADERMODEL ps_4_0_level_9_1 8 | #endif 9 | 10 | Texture2D SpriteTexture; 11 | 12 | sampler2D SpriteTextureSampler = sampler_state 13 | { 14 | Texture = ; 15 | }; 16 | 17 | struct VertexShaderOutput 18 | { 19 | float4 Position : SV_POSITION; 20 | float4 Color : COLOR0; 21 | float2 TextureCoordinates : TEXCOORD0; 22 | }; 23 | 24 | float4 MainPS(VertexShaderOutput input) : COLOR 25 | { 26 | float4 color = tex2D(SpriteTextureSampler,input.TextureCoordinates) * input.Color; 27 | float value = (color.r + color.g + color.b) / 3; 28 | color.r = color.g = color.b = value; 29 | return color; 30 | } 31 | 32 | technique SpriteDrawing 33 | { 34 | pass P0 35 | { 36 | PixelShader = compile PS_SHADERMODEL MainPS(); 37 | } 38 | }; -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/TiledMapImageLayer.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace MonoGo.Tiled.MapStructure 5 | { 6 | /// 7 | /// Represents an image layer in a Tiled map. 8 | /// 9 | public class TiledMapImageLayer : TiledMapLayer 10 | { 11 | /// 12 | /// Gets or sets the path to the texture used in the image layer. 13 | /// 14 | public string TexturePath; 15 | 16 | /// 17 | /// Gets or sets the texture used in the image layer. 18 | /// 19 | public Texture2D Texture; 20 | 21 | /// 22 | /// Gets or sets the transparent color for the image layer. 23 | /// 24 | /// 25 | /// Tiled will treat this color as transparent. 26 | /// 27 | public Color TransparentColor; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Content/Assets/Engine/Effects/Silhouette.fx: -------------------------------------------------------------------------------- 1 | #if OPENGL 2 | #define SV_POSITION POSITION 3 | #define VS_SHADERMODEL vs_3_0 4 | #define PS_SHADERMODEL ps_3_0 5 | #else 6 | #define VS_SHADERMODEL vs_4_0_level_9_1 7 | #define PS_SHADERMODEL ps_4_0_level_9_1 8 | #endif 9 | 10 | Texture2D SpriteTexture; 11 | 12 | sampler2D SpriteTextureSampler = sampler_state 13 | { 14 | Texture = ; 15 | }; 16 | 17 | struct VertexShaderOutput 18 | { 19 | float4 Position : SV_POSITION; 20 | float4 Color : COLOR0; 21 | float2 TextureCoordinates : TEXCOORD0; 22 | }; 23 | 24 | float4 MainPS(VertexShaderOutput input) : COLOR 25 | { 26 | float4 color = tex2D(SpriteTextureSampler,input.TextureCoordinates) * input.Color; 27 | color.r = 1 * color.a * input.Color.r; 28 | color.g = 1 * color.a * input.Color.g; 29 | color.b = 1 * color.a * input.Color.b; 30 | return color; 31 | } 32 | 33 | technique SpriteDrawing 34 | { 35 | pass P0 36 | { 37 | PixelShader = compile PS_SHADERMODEL MainPS(); 38 | } 39 | }; -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/Objects/TiledPointObject.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace MonoGo.Tiled.MapStructure.Objects 4 | { 5 | /// 6 | /// Represents a point object in a Tiled map. 7 | /// 8 | public class TiledPointObject : TiledObject 9 | { 10 | /// 11 | /// Gets the size of the point, which is always zero. 12 | /// 13 | public new Vector2 Size => Vector2.Zero; // Points cannot have size. 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | public TiledPointObject() { } 19 | 20 | /// 21 | /// Initializes a new instance of the class by copying another object. 22 | /// 23 | /// The object to copy. 24 | public TiledPointObject(TiledObject obj) : base(obj) { } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled/MonoGo.Tiled.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | false 6 | ..\..\bin\ 7 | ..\..\bin\$(AssemblyName).xml 8 | 1701;1702;1591 9 | Debug;Release;gametest 10 | true 11 | Tiled Map Editor integration for MonoGo. 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | All 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Engine/Effects/Silhouette.fx: -------------------------------------------------------------------------------- 1 | #if OPENGL 2 | #define SV_POSITION POSITION 3 | #define VS_SHADERMODEL vs_3_0 4 | #define PS_SHADERMODEL ps_3_0 5 | #else 6 | #define VS_SHADERMODEL vs_4_0_level_9_1 7 | #define PS_SHADERMODEL ps_4_0_level_9_1 8 | #endif 9 | 10 | Texture2D SpriteTexture; 11 | 12 | sampler2D SpriteTextureSampler = sampler_state 13 | { 14 | Texture = ; 15 | }; 16 | 17 | struct VertexShaderOutput 18 | { 19 | float4 Position : SV_POSITION; 20 | float4 Color : COLOR0; 21 | float2 TextureCoordinates : TEXCOORD0; 22 | }; 23 | 24 | float4 MainPS(VertexShaderOutput input) : COLOR 25 | { 26 | float4 color = tex2D(SpriteTextureSampler,input.TextureCoordinates) * input.Color; 27 | color.r = 1 * color.a * input.Color.r; 28 | color.g = 1 * color.a * input.Color.g; 29 | color.b = 1 * color.a * input.Color.b; 30 | return color; 31 | } 32 | 33 | technique SpriteDrawing 34 | { 35 | pass P0 36 | { 37 | PixelShader = compile PS_SHADERMODEL MainPS(); 38 | } 39 | }; -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/scrollbar_vertical_handle.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "ExternalSourceRect": {"X": 208, "Y": 0, "Width": 16, "Height": 48}, 6 | "InternalSourceRect": {"X": 208, "Y": 12, "Width": 16, "Height": 24} 7 | } 8 | }, 9 | "Targeted": { 10 | "FillTextureFramed": { 11 | 12 | "ExternalSourceRect": {"X": 240, "Y": 0, "Width": 16, "Height": 48}, 13 | "InternalSourceRect": {"X": 240, "Y": 12, "Width": 16, "Height": 24} 14 | } 15 | }, 16 | "Interacted": { 17 | "FillTextureFramed": { 18 | 19 | "ExternalSourceRect": {"X": 240, "Y": 0, "Width": 16, "Height": 48}, 20 | "InternalSourceRect": {"X": 240, "Y": 12, "Width": 16, "Height": 24} 21 | } 22 | }, 23 | "Disabled": { 24 | "EffectIdentifier": "disabled" 25 | }, 26 | "DefaultWidth": {"Value": 32, "Units": "Pixels"}, 27 | "DefaultHeight": {"Value": 80, "Units": "Pixels"}, 28 | "InterpolateStatesSpeed": 5, 29 | "InterpolateOffsetsSpeed": 10 30 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/scrollbar_vertical_handle.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "ExternalSourceRect": {"X": 208, "Y": 0, "Width": 16, "Height": 48}, 6 | "InternalSourceRect": {"X": 208, "Y": 12, "Width": 16, "Height": 24} 7 | } 8 | }, 9 | "Targeted": { 10 | "FillTextureFramed": { 11 | 12 | "ExternalSourceRect": {"X": 240, "Y": 0, "Width": 16, "Height": 48}, 13 | "InternalSourceRect": {"X": 240, "Y": 12, "Width": 16, "Height": 24} 14 | } 15 | }, 16 | "Interacted": { 17 | "FillTextureFramed": { 18 | 19 | "ExternalSourceRect": {"X": 240, "Y": 0, "Width": 16, "Height": 48}, 20 | "InternalSourceRect": {"X": 240, "Y": 12, "Width": 16, "Height": 24} 21 | } 22 | }, 23 | "Disabled": { 24 | "EffectIdentifier": "disabled" 25 | }, 26 | "DefaultWidth": {"Value": 32, "Units": "Pixels"}, 27 | "DefaultHeight": {"Value": 80, "Units": "Pixels"}, 28 | "InterpolateStatesSpeed": 5, 29 | "InterpolateOffsetsSpeed": 10 30 | } -------------------------------------------------------------------------------- /MonoGo.Engine/StuffResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MonoGo.Engine 5 | { 6 | /// 7 | /// Contains (usually platform-specific) stuff. 8 | /// 9 | internal static class StuffResolver 10 | { 11 | private static Dictionary _stuff = new Dictionary(); 12 | 13 | internal static void AddStuffAs(object stuff) 14 | { 15 | var type = typeof(T); 16 | if (!type.IsInterface) 17 | { 18 | throw new Exception("Provided type " + type + " has to be an interface!"); 19 | } 20 | foreach (var i in stuff.GetType().GetInterfaces()) 21 | { 22 | if (type == i) 23 | { 24 | _stuff.Add(type, stuff); 25 | return; 26 | } 27 | } 28 | throw new Exception("Object should implement interface " + type + "!"); 29 | } 30 | 31 | internal static T GetStuff() => 32 | (T)_stuff[typeof(T)]; 33 | 34 | internal static bool StuffExists() => 35 | _stuff.ContainsKey(typeof(T)); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Templates/DesktopGL/.template.config/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/template", 3 | "author": "BlizzCrafter", 4 | "classifications": [ 5 | "MonoGo", "MonoGame", "Games", "Engine", "Desktop", "Windows", "OpenGL" 6 | ], 7 | "name": "MonoGo Cross-Platform Desktop Application", 8 | "identity": "MonoGoGL", 9 | "precedence": 999, 10 | "shortName": "mgogl", 11 | "description": "MonoGo Cross-Platform Desktop Application", 12 | "tags": { 13 | "language": "C#", 14 | "type": "solution" 15 | }, 16 | "primaryOutputs": [ 17 | { 18 | "path": "MGNamespace.csproj" 19 | } 20 | ], 21 | "sourceName": "MGNamespace", 22 | "postActions": [{ 23 | "description": "Restore NuGet packages required by this project.", 24 | "manualInstructions": [{ 25 | "text": "Run 'dotnet restore'" 26 | }], 27 | "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", 28 | "continueOnError": true 29 | }], 30 | "preferNameDirectory": "true" 31 | } -------------------------------------------------------------------------------- /Tests/MonoGo.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | net9.0 6 | 7 | false 8 | 9 | Debug;Release;gametest 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/scrollbar_vertical_handle.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "ExternalSourceRect": {"X": 208, "Y": 0, "Width": 16, "Height": 48}, 6 | "InternalSourceRect": {"X": 208, "Y": 12, "Width": 16, "Height": 24} 7 | } 8 | }, 9 | "Targeted": { 10 | "FillTextureFramed": { 11 | 12 | "ExternalSourceRect": {"X": 240, "Y": 0, "Width": 16, "Height": 48}, 13 | "InternalSourceRect": {"X": 240, "Y": 12, "Width": 16, "Height": 24} 14 | } 15 | }, 16 | "Interacted": { 17 | "FillTextureFramed": { 18 | 19 | "ExternalSourceRect": {"X": 240, "Y": 0, "Width": 16, "Height": 48}, 20 | "InternalSourceRect": {"X": 240, "Y": 12, "Width": 16, "Height": 24} 21 | } 22 | }, 23 | "Disabled": { 24 | "EffectIdentifier": "disabled" 25 | }, 26 | "DefaultWidth": {"Value": 32, "Units": "Pixels"}, 27 | "DefaultHeight": {"Value": 80, "Units": "Pixels"}, 28 | "InterpolateStatesSpeed": 5, 29 | "InterpolateOffsetsSpeed": 10 30 | } -------------------------------------------------------------------------------- /MonoGo.Engine/Cameras/RenderMask.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoGo.Engine.Cameras 4 | { 5 | [Flags] 6 | public enum RenderMask 7 | { 8 | None = 0x00000000, 9 | Default = 0x00000001, 10 | Mask1 = 0x00000001, 11 | Mask2 = 0x00000002, 12 | Mask3 = 0x00000004, 13 | Mask4 = 0x00000008, 14 | Mask5 = 0x00000010, 15 | Mask6 = 0x00000020, 16 | Mask7 = 0x00000040, 17 | Mask8 = 0x00000080, 18 | Mask9 = 0x00000100, 19 | Mask10 = 0x00000200, 20 | Mask11 = 0x00000400, 21 | Mask12 = 0x00000800, 22 | Mask13 = 0x00001000, 23 | Mask14 = 0x00002000, 24 | Mask15 = 0x00004000, 25 | Mask16 = 0x00008000, 26 | Mask17 = 0x00010000, 27 | Mask18 = 0x00020000, 28 | Mask19 = 0x00040000, 29 | Mask20 = 0x00080000, 30 | Mask21 = 0x00100000, 31 | Mask22 = 0x00200000, 32 | Mask23 = 0x00400000, 33 | Mask24 = 0x00800000, 34 | Mask25 = 0x01000000, 35 | Mask26 = 0x02000000, 36 | Mask27 = 0x04000000, 37 | Mask28 = 0x08000000, 38 | Mask29 = 0x10000000, 39 | Mask30 = 0x20000000, 40 | Mask31 = 0x40000000, 41 | All = int.MaxValue, 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /MonoGo.Engine/Collisions/Colliders/LineCollider.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.Collisions.Shapes; 2 | 3 | namespace MonoGo.Engine.Collisions.Colliders 4 | { 5 | /// 6 | /// Represents a simple line that consists of two vertices that form the following shape with its center at vertex 0: 7 | /// 0---1 8 | /// 9 | /// NOTE: While it is possible to directly manipulate vertices of this collider, it is NOT recommended to do unless you really know what you are doing. Use base Collider instead. 10 | /// 11 | public class LineCollider : Collider 12 | { 13 | private Polygon _line => (Polygon)_shapes[0]; 14 | 15 | /// 16 | /// Length of the line, measured in meters. 17 | /// 18 | public float Length 19 | { 20 | get 21 | { 22 | return (_line.RelativeVertices[1] - _line.RelativeVertices[0]).Length(); 23 | } 24 | 25 | set 26 | { 27 | var e = (_line.RelativeVertices[1] - _line.RelativeVertices[0]).SafeNormalize(); 28 | _line.RelativeVertices[1] = _line.RelativeVertices[0] + e * value; 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/Objects/TiledObjectType.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoGo.Tiled.MapStructure.Objects 3 | { 4 | /// 5 | /// Specifies the type of a Tiled object. 6 | /// 7 | internal enum TiledObjectType : byte 8 | { 9 | /// 10 | /// No specific type. 11 | /// 12 | None = 0, 13 | 14 | /// 15 | /// A tile object. 16 | /// 17 | Tile = 1, 18 | 19 | /// 20 | /// A point object. 21 | /// 22 | Point = 2, 23 | 24 | /// 25 | /// A rectangle object. 26 | /// 27 | Rectangle = 3, 28 | 29 | /// 30 | /// An ellipse object. 31 | /// 32 | Ellipse = 4, 33 | 34 | /// 35 | /// A polygon object. 36 | /// 37 | Polygon = 5, 38 | 39 | /// 40 | /// A text object. 41 | /// 42 | Text = 6, 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /MonoGo.Engine/Utils/Tilemaps/Tileset.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace MonoGo.Engine.Utils.Tilemaps 4 | { 5 | public class Tileset 6 | { 7 | public readonly ITilesetTile[] Tiles; 8 | 9 | public readonly int StartingIndex; 10 | 11 | public Vector2 Offset; 12 | 13 | public int Count 14 | { 15 | get 16 | { 17 | if (Tiles != null) 18 | { 19 | return Tiles.Length; 20 | } 21 | return 0; 22 | } 23 | } 24 | 25 | public Tileset(ITilesetTile[] tiles, Vector2 offset, int startingIndex = 1) 26 | { 27 | Tiles = (ITilesetTile[])tiles.Clone(); 28 | Offset = offset; 29 | StartingIndex = startingIndex; 30 | } 31 | 32 | /// 33 | /// Returns tileset tile according to tile index, 34 | /// or null, if index is out of tileset's bounds. 35 | /// 36 | public ITilesetTile GetTilesetTile(int index) 37 | { 38 | if (Tiles == null || index < StartingIndex || index >= StartingIndex + Tiles.Length) 39 | { 40 | return null; 41 | } 42 | return Tiles[index - StartingIndex]; 43 | } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /MonoGo.Samples/Misc/Bot.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine.Drawing; 3 | using MonoGo.Engine.EC; 4 | using MonoGo.Engine.Resources; 5 | using MonoGo.Engine.SceneSystem; 6 | using MonoGo.Engine.Utils; 7 | 8 | namespace MonoGo.Samples.Misc 9 | { 10 | /// 11 | /// Basic position component. 12 | /// 13 | public class Bot : Entity 14 | { 15 | public float TurningSpeed = 60; 16 | 17 | private readonly ActorComponent _actor; 18 | 19 | public Bot(Layer layer) : base(layer) 20 | { 21 | var botSprite = ResourceHub.GetResource("DemoSprites", "Bot"); 22 | 23 | AddComponent(new PositionComponent(Vector2.Zero)); 24 | _actor = AddComponent(new ActorComponent(botSprite)); 25 | 26 | // It is recommended to reuse random objects. 27 | TurningSpeed = GameController.Random.Next(120, 240); 28 | 29 | } 30 | 31 | 32 | public override void Update() 33 | { 34 | base.Update(); 35 | _actor.Move = true; 36 | _actor.Direction += TimeKeeper.Global.Time(TurningSpeed); // ni-ni-ni-ni-ni-ni-ni-ni-ni-ni-ni-ni-ni-ni 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /MonoGo.Samples/Misc/PositionComponent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine; 3 | using MonoGo.Engine.EC; 4 | 5 | namespace MonoGo.Samples.Misc 6 | { 7 | /// 8 | /// Basic position component. 9 | /// 10 | public class PositionComponent : Component, IAmMovable 11 | { 12 | /// 13 | /// Entity position on the scene. 14 | /// 15 | public Vector2 Position 16 | { 17 | get { return _position; } 18 | set 19 | { 20 | PreviousPosition = _position; 21 | _position = value; 22 | } 23 | } 24 | private Vector2 _position; 25 | 26 | /// 27 | /// Starting entity position on the scene. 28 | /// 29 | public Vector2 StartingPosition { get; set; } 30 | 31 | /// 32 | /// Previous position of the entity. 33 | /// 34 | public Vector2 PreviousPosition { get; private set; } 35 | 36 | public PositionComponent(Vector2 position) 37 | { 38 | Position = position; 39 | PreviousPosition = position; 40 | StartingPosition = position; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/button.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "FillTextureFramed": { 5 | 6 | "InternalSourceRect": {"X": 116, "Y": 4, "Width": 72, "Height": 24}, 7 | "ExternalSourceRect": {"X": 112, "Y": 0, "Width": 80, "Height": 32} 8 | }, 9 | "TextAlignment": "Center", 10 | "Padding": {"Left": 8, "Right": 8, "Top": 8, "Bottom": 8} 11 | }, 12 | "Targeted": { 13 | "FillTextureFramed": { 14 | 15 | "InternalSourceRect": {"X": 116, "Y": 36, "Width": 72, "Height": 24}, 16 | "ExternalSourceRect": {"X": 112, "Y": 32, "Width": 80, "Height": 32} 17 | } 18 | }, 19 | "Interacted": { 20 | "FillTextureFramed": { 21 | 22 | "InternalSourceRect": {"X": 116, "Y": 68, "Width": 72, "Height": 24}, 23 | "ExternalSourceRect": {"X": 112, "Y": 64, "Width": 80, "Height": 32} 24 | } 25 | }, 26 | "TargetedChecked": { 27 | }, 28 | "Checked": { 29 | }, 30 | "Disabled": { 31 | "EffectIdentifier": "disabled" 32 | }, 33 | "DefaultTextAnchor": "Center", 34 | "InterpolateStatesSpeed": 5 35 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/button.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "FillTextureFramed": { 5 | 6 | "InternalSourceRect": {"X": 116, "Y": 4, "Width": 72, "Height": 24}, 7 | "ExternalSourceRect": {"X": 112, "Y": 0, "Width": 80, "Height": 32} 8 | }, 9 | "TextAlignment": "Center", 10 | "Padding": {"Left": 8, "Right": 8, "Top": 8, "Bottom": 8} 11 | }, 12 | "Targeted": { 13 | "FillTextureFramed": { 14 | 15 | "InternalSourceRect": {"X": 116, "Y": 36, "Width": 72, "Height": 24}, 16 | "ExternalSourceRect": {"X": 112, "Y": 32, "Width": 80, "Height": 32} 17 | } 18 | }, 19 | "Interacted": { 20 | "FillTextureFramed": { 21 | 22 | "InternalSourceRect": {"X": 116, "Y": 68, "Width": 72, "Height": 24}, 23 | "ExternalSourceRect": {"X": 112, "Y": 64, "Width": 80, "Height": 32} 24 | } 25 | }, 26 | "TargetedChecked": { 27 | }, 28 | "Checked": { 29 | }, 30 | "Disabled": { 31 | "EffectIdentifier": "disabled" 32 | }, 33 | "DefaultTextAnchor": "Center", 34 | "InterpolateStatesSpeed": 5 35 | } -------------------------------------------------------------------------------- /MonoGo.Engine/Drawing/IFont.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.Text; 6 | 7 | namespace MonoGo.Engine.Drawing 8 | { 9 | /// 10 | /// Use for serious graphical user interfaces! 11 | /// 12 | public interface IFont 13 | { 14 | Texture2D Texture {get;} 15 | SpriteFont SpriteFont { get; } 16 | ReadOnlyCollection Characters {get;} 17 | char? DefaultCharacter {get; set;} 18 | int LineSpacing {get; set;} 19 | float Spacing {get; set;} 20 | 21 | Dictionary GetGlyphs(); 22 | Vector2 MeasureString(string text); 23 | Vector2 MeasureString(StringBuilder text); 24 | float MeasureStringWidth(string text); 25 | float MeasureStringWidth(StringBuilder text); 26 | float MeasureStringHeight(string text); 27 | float MeasureStringHeight(StringBuilder text); 28 | 29 | void Draw(string text, Vector2 position, TextAlign halign, TextAlign valign); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/button.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "Default": { 4 | "FillTextureFramed": { 5 | 6 | "InternalSourceRect": {"X": 116, "Y": 4, "Width": 72, "Height": 24}, 7 | "ExternalSourceRect": {"X": 112, "Y": 0, "Width": 80, "Height": 32} 8 | }, 9 | "TextAlignment": "Center", 10 | "Padding": {"Left": 8, "Right": 8, "Top": 8, "Bottom": 8} 11 | }, 12 | "Targeted": { 13 | "FillTextureFramed": { 14 | 15 | "InternalSourceRect": {"X": 116, "Y": 36, "Width": 72, "Height": 24}, 16 | "ExternalSourceRect": {"X": 112, "Y": 32, "Width": 80, "Height": 32} 17 | } 18 | }, 19 | "Interacted": { 20 | "FillTextureFramed": { 21 | 22 | "InternalSourceRect": {"X": 116, "Y": 68, "Width": 72, "Height": 24}, 23 | "ExternalSourceRect": {"X": 112, "Y": 64, "Width": 80, "Height": 32} 24 | } 25 | }, 26 | "TargetedChecked": { 27 | }, 28 | "Checked": { 29 | }, 30 | "Disabled": { 31 | "EffectIdentifier": "disabled" 32 | }, 33 | "DefaultTextAnchor": "Center", 34 | "InterpolateStatesSpeed": 5 35 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/list_item_centered.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "DefaultTextAnchor": "AutoCenter", 4 | "Default": { 5 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255}, 6 | "TextOutlineColor": {"R": 0, "G": 0, "B": 0, "A": 255}, 7 | "NoValueTextFillColor": {"R": 175, "G": 175, "B": 175, "A": 255}, 8 | "FontSize": 26, 9 | "FontIdentifier": "Default", 10 | "TextSpacing": 2, 11 | "TextOutlineWidth": 2, 12 | "TextAlignment": "Center", 13 | "ExtraSize": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 10} 14 | }, 15 | "Targeted": { 16 | "TextFillColor": {"R": 0, "G": 230, "B": 225, "A": 255} 17 | }, 18 | "Checked": { 19 | "FillTextureStretched": { 20 | "SourceRect": {"X": 0, "Y": 80, "Width": 16, "Height": 16}, 21 | "ExtraSize": {"Left": 20, "Right": 10, "Top": 10, "Bottom": 0} 22 | }, 23 | "TextFillColor": {"R": 0, "G": 230, "B": 225, "A": 255} 24 | }, 25 | "Disabled": { 26 | "EffectIdentifier": "disabled" 27 | }, 28 | "InterpolateStatesSpeed": 0 29 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/list_item_centered.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "DefaultTextAnchor": "AutoCenter", 4 | "Default": { 5 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255}, 6 | "TextOutlineColor": {"R": 0, "G": 0, "B": 0, "A": 255}, 7 | "NoValueTextFillColor": {"R": 175, "G": 175, "B": 175, "A": 255}, 8 | "FontSize": 26, 9 | "FontIdentifier": "Default", 10 | "TextSpacing": 2, 11 | "TextOutlineWidth": 2, 12 | "TextAlignment": "Center", 13 | "ExtraSize": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 10} 14 | }, 15 | "Targeted": { 16 | "TextFillColor": {"R": 0, "G": 230, "B": 225, "A": 255} 17 | }, 18 | "Checked": { 19 | "FillTextureStretched": { 20 | "SourceRect": {"X": 0, "Y": 80, "Width": 16, "Height": 16}, 21 | "ExtraSize": {"Left": 20, "Right": 10, "Top": 10, "Bottom": 0} 22 | }, 23 | "TextFillColor": {"R": 0, "G": 230, "B": 225, "A": 255} 24 | }, 25 | "Disabled": { 26 | "EffectIdentifier": "disabled" 27 | }, 28 | "InterpolateStatesSpeed": 0 29 | } -------------------------------------------------------------------------------- /MonoGo.Engine/Drawing/Vertex.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace MonoGo.Engine.Drawing 4 | { 5 | public struct Vertex 6 | { 7 | public Vector3 Position; 8 | public Color Color; 9 | public Vector2 TexturePosition; 10 | 11 | public Vertex(Vector2 position) 12 | : this(position.ToVector3()) 13 | { } 14 | public Vertex(Vector2 position, Color color) 15 | : this(position.ToVector3(), color) 16 | { } 17 | public Vertex(Vector2 position, Color color, Vector2 texturePosition) 18 | : this(position.ToVector3(), color, texturePosition) 19 | { } 20 | 21 | 22 | 23 | public Vertex(Vector3 position) 24 | { 25 | Position = position; 26 | Color = GraphicsMgr.CurrentColor; 27 | TexturePosition = Vector2.Zero; 28 | } 29 | 30 | public Vertex(Vector3 position, Color color) 31 | { 32 | Position = position; 33 | Color = color; 34 | TexturePosition = Vector2.Zero; 35 | } 36 | 37 | public Vertex(Vector3 position, Color color, Vector2 texturePosition) 38 | { 39 | Position = position; 40 | Color = color; 41 | TexturePosition = texturePosition; 42 | } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/MonoGo.Tiled.MapStructure.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 785e8147-0e69-45df-92f7-b4f315739d0c 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/list_item_centered.json: -------------------------------------------------------------------------------- 1 | { 2 | "InheritFrom": "paragraph_base_style.json", 3 | "DefaultTextAnchor": "AutoCenter", 4 | "Default": { 5 | "TextFillColor": {"R": 255, "G": 255, "B": 255, "A": 255}, 6 | "TextOutlineColor": {"R": 0, "G": 0, "B": 0, "A": 255}, 7 | "NoValueTextFillColor": {"R": 175, "G": 175, "B": 175, "A": 255}, 8 | "FontSize": 26, 9 | "FontIdentifier": "Default", 10 | "TextSpacing": 2, 11 | "TextOutlineWidth": 2, 12 | "TextAlignment": "Center", 13 | "ExtraSize": {"Left": 0, "Right": 0, "Top": 0, "Bottom": 10} 14 | }, 15 | "Targeted": { 16 | "TextFillColor": {"R": 0, "G": 230, "B": 225, "A": 255} 17 | }, 18 | "Checked": { 19 | "FillTextureStretched": { 20 | "SourceRect": {"X": 0, "Y": 80, "Width": 16, "Height": 16}, 21 | "ExtraSize": {"Left": 20, "Right": 10, "Top": 10, "Bottom": 0} 22 | }, 23 | "TextFillColor": {"R": 0, "G": 230, "B": 225, "A": 255} 24 | }, 25 | "Disabled": { 26 | "EffectIdentifier": "disabled" 27 | }, 28 | "InterpolateStatesSpeed": 0 29 | } -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/Objects/TiledPolygonObject.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace MonoGo.Tiled.MapStructure.Objects 4 | { 5 | /// 6 | /// Represents a polygon object in a Tiled map. 7 | /// 8 | public class TiledPolygonObject : TiledObject 9 | { 10 | /// 11 | /// Gets or sets a value indicating whether the polygon is closed. 12 | /// 13 | public bool Closed; 14 | 15 | /// 16 | /// Gets or sets the points that define the polygon. 17 | /// 18 | public Vector2[] Points; 19 | 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | public TiledPolygonObject() { } 24 | 25 | /// 26 | /// Initializes a new instance of the class by copying another object. 27 | /// 28 | /// The object to copy. 29 | public TiledPolygonObject(TiledObject obj) : base(obj) { } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/slider_horizontal.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 5, "Y": 112, "Width": 70, "Height": 7}, 6 | "ExternalSourceRect": {"X": 0, "Y": 112, "Width": 80, "Height": 7} 7 | }, 8 | "Padding": {"Left": 40, "Right": 40, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18} 11 | }, 12 | "Targeted": { 13 | "FillTextureFramed": { 14 | 15 | "InternalSourceRect": {"X": 5, "Y": 119, "Width": 70, "Height": 7}, 16 | "ExternalSourceRect": {"X": 0, "Y": 119, "Width": 80, "Height": 7} 17 | } 18 | }, 19 | "Interacted": { 20 | "FillTextureFramed": { 21 | 22 | "InternalSourceRect": {"X": 5, "Y": 119, "Width": 70, "Height": 7}, 23 | "ExternalSourceRect": {"X": 0, "Y": 119, "Width": 80, "Height": 7} 24 | } 25 | }, 26 | "Disabled": { 27 | "EffectIdentifier": "disabled" 28 | }, 29 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 30 | "DefaultHeight": {"Value": 14, "Units": "Pixels"}, 31 | "InterpolateStatesSpeed": 5, 32 | "InterpolateOffsetsSpeed": 10 33 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/slider_horizontal.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 5, "Y": 112, "Width": 70, "Height": 7}, 6 | "ExternalSourceRect": {"X": 0, "Y": 112, "Width": 80, "Height": 7} 7 | }, 8 | "Padding": {"Left": 40, "Right": 40, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18} 11 | }, 12 | "Targeted": { 13 | "FillTextureFramed": { 14 | 15 | "InternalSourceRect": {"X": 5, "Y": 119, "Width": 70, "Height": 7}, 16 | "ExternalSourceRect": {"X": 0, "Y": 119, "Width": 80, "Height": 7} 17 | } 18 | }, 19 | "Interacted": { 20 | "FillTextureFramed": { 21 | 22 | "InternalSourceRect": {"X": 5, "Y": 119, "Width": 70, "Height": 7}, 23 | "ExternalSourceRect": {"X": 0, "Y": 119, "Width": 80, "Height": 7} 24 | } 25 | }, 26 | "Disabled": { 27 | "EffectIdentifier": "disabled" 28 | }, 29 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 30 | "DefaultHeight": {"Value": 14, "Units": "Pixels"}, 31 | "InterpolateStatesSpeed": 5, 32 | "InterpolateOffsetsSpeed": 10 33 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/DefaultTheme/Styles/slider_vertical.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 215, "Y": 53, "Width": 7, "Height": 70}, 6 | "ExternalSourceRect": {"X": 215, "Y": 48, "Width": 7, "Height": 80} 7 | }, 8 | "Padding": {"Left": 0, "Right": 0, "Top": 40, "Bottom": 40}, 9 | "MarginBefore": {"X": 18, "Y": 10}, 10 | "MarginAfter": {"X": 18, "Y": 10} 11 | }, 12 | "Targeted": { 13 | "FillTextureFramed": { 14 | 15 | "InternalSourceRect": {"X": 208, "Y": 53, "Width": 7, "Height": 70}, 16 | "ExternalSourceRect": {"X": 208, "Y": 48, "Width": 7, "Height": 80} 17 | } 18 | }, 19 | "Interacted": { 20 | "FillTextureFramed": { 21 | 22 | "InternalSourceRect": {"X": 208, "Y": 53, "Width": 7, "Height": 70}, 23 | "ExternalSourceRect": {"X": 208, "Y": 48, "Width": 7, "Height": 80} 24 | } 25 | }, 26 | "Disabled": { 27 | "EffectIdentifier": "disabled" 28 | }, 29 | "DefaultWidth": {"Value": 14, "Units": "Pixels"}, 30 | "DefaultHeight": {"Value": 100, "Units": "PercentOfParent"}, 31 | "InterpolateStatesSpeed": 5, 32 | "InterpolateOffsetsSpeed": 10 33 | } -------------------------------------------------------------------------------- /Content/Assets/Demo/GUI/MonoGoTheme/Styles/slider_vertical.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 215, "Y": 53, "Width": 7, "Height": 70}, 6 | "ExternalSourceRect": {"X": 215, "Y": 48, "Width": 7, "Height": 80} 7 | }, 8 | "Padding": {"Left": 0, "Right": 0, "Top": 40, "Bottom": 40}, 9 | "MarginBefore": {"X": 18, "Y": 10}, 10 | "MarginAfter": {"X": 18, "Y": 10} 11 | }, 12 | "Targeted": { 13 | "FillTextureFramed": { 14 | 15 | "InternalSourceRect": {"X": 208, "Y": 53, "Width": 7, "Height": 70}, 16 | "ExternalSourceRect": {"X": 208, "Y": 48, "Width": 7, "Height": 80} 17 | } 18 | }, 19 | "Interacted": { 20 | "FillTextureFramed": { 21 | 22 | "InternalSourceRect": {"X": 208, "Y": 53, "Width": 7, "Height": 70}, 23 | "ExternalSourceRect": {"X": 208, "Y": 48, "Width": 7, "Height": 80} 24 | } 25 | }, 26 | "Disabled": { 27 | "EffectIdentifier": "disabled" 28 | }, 29 | "DefaultWidth": {"Value": 14, "Units": "Pixels"}, 30 | "DefaultHeight": {"Value": 100, "Units": "PercentOfParent"}, 31 | "InterpolateStatesSpeed": 5, 32 | "InterpolateOffsetsSpeed": 10 33 | } -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/slider_horizontal.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 5, "Y": 112, "Width": 70, "Height": 7}, 6 | "ExternalSourceRect": {"X": 0, "Y": 112, "Width": 80, "Height": 7} 7 | }, 8 | "Padding": {"Left": 40, "Right": 40, "Top": 0, "Bottom": 0}, 9 | "MarginBefore": {"X": 0, "Y": 18}, 10 | "MarginAfter": {"X": 0, "Y": 18} 11 | }, 12 | "Targeted": { 13 | "FillTextureFramed": { 14 | 15 | "InternalSourceRect": {"X": 5, "Y": 119, "Width": 70, "Height": 7}, 16 | "ExternalSourceRect": {"X": 0, "Y": 119, "Width": 80, "Height": 7} 17 | } 18 | }, 19 | "Interacted": { 20 | "FillTextureFramed": { 21 | 22 | "InternalSourceRect": {"X": 5, "Y": 119, "Width": 70, "Height": 7}, 23 | "ExternalSourceRect": {"X": 0, "Y": 119, "Width": 80, "Height": 7} 24 | } 25 | }, 26 | "Disabled": { 27 | "EffectIdentifier": "disabled" 28 | }, 29 | "DefaultWidth": {"Value": 100, "Units": "PercentOfParent"}, 30 | "DefaultHeight": {"Value": 14, "Units": "Pixels"}, 31 | "InterpolateStatesSpeed": 5, 32 | "InterpolateOffsetsSpeed": 10 33 | } -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Modifiers/VortexModifier.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine; 3 | 4 | namespace MonoGo.MercuryParticleEngine.Modifiers 5 | { 6 | public class VortexModifier : IModifier 7 | { 8 | public string Key { get; set; } 9 | 10 | public Vector2 Position { get; set; } 11 | public float Mass { get; set; } 12 | public float MaxSpeed { get; set; } 13 | 14 | // Note: not the real-life one 15 | private const float GravConst = 100000f; 16 | 17 | public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) 18 | { 19 | while (iterator.HasNext) 20 | { 21 | var particle = iterator.Next(); 22 | var diff = Position + particle->TriggerPos - particle->Position; 23 | 24 | var distance2 = diff.LengthSquared(); 25 | 26 | var speedGain = GravConst * Mass / distance2 * elapsedSeconds; 27 | // normalize distances and multiply by speedGain 28 | particle->Velocity += diff.ToAxis() * speedGain; 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /MonoGo.Engine.WindowsDX/MonoGo.Engine.WindowsDX.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0-windows 5 | false 6 | ..\bin\ 7 | ..\bin\$(AssemblyName).xml 8 | 1701;1702;1591 9 | true 10 | Debug;Release 11 | 12 | 13 | 14 | 15 | 16 | runtime; build; native; contentfiles; analyzers; buildtransitive 17 | all 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Assets/Game/GUI/MonoGoTheme/Styles/slider_vertical.json: -------------------------------------------------------------------------------- 1 | { 2 | "Default": { 3 | "FillTextureFramed": { 4 | 5 | "InternalSourceRect": {"X": 215, "Y": 53, "Width": 7, "Height": 70}, 6 | "ExternalSourceRect": {"X": 215, "Y": 48, "Width": 7, "Height": 80} 7 | }, 8 | "Padding": {"Left": 0, "Right": 0, "Top": 40, "Bottom": 40}, 9 | "MarginBefore": {"X": 18, "Y": 10}, 10 | "MarginAfter": {"X": 18, "Y": 10} 11 | }, 12 | "Targeted": { 13 | "FillTextureFramed": { 14 | 15 | "InternalSourceRect": {"X": 208, "Y": 53, "Width": 7, "Height": 70}, 16 | "ExternalSourceRect": {"X": 208, "Y": 48, "Width": 7, "Height": 80} 17 | } 18 | }, 19 | "Interacted": { 20 | "FillTextureFramed": { 21 | 22 | "InternalSourceRect": {"X": 208, "Y": 53, "Width": 7, "Height": 70}, 23 | "ExternalSourceRect": {"X": 208, "Y": 48, "Width": 7, "Height": 80} 24 | } 25 | }, 26 | "Disabled": { 27 | "EffectIdentifier": "disabled" 28 | }, 29 | "DefaultWidth": {"Value": 14, "Units": "Pixels"}, 30 | "DefaultHeight": {"Value": 100, "Units": "PercentOfParent"}, 31 | "InterpolateStatesSpeed": 5, 32 | "InterpolateOffsetsSpeed": 10 33 | } -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled/ITiledEntityFactory.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.EC; 2 | using MonoGo.Engine.SceneSystem; 3 | using MonoGo.Tiled.MapStructure.Objects; 4 | 5 | namespace MonoGo.Tiled 6 | { 7 | /// 8 | /// Defines a factory interface for creating entities from Tiled object structures. 9 | /// 10 | public interface ITiledEntityFactory 11 | { 12 | /// 13 | /// Gets the identifying tag for the factory. 14 | /// 15 | /// 16 | /// All factory tags must be unique to ensure proper identification. 17 | /// 18 | string Tag { get; } 19 | 20 | /// 21 | /// Creates an entity from a Tiled object on a specified layer. 22 | /// 23 | /// The Tiled object to convert into an entity. 24 | /// The layer where the entity will be placed. 25 | /// The map builder instance used for additional context. 26 | /// The created entity. 27 | Entity Make(TiledObject obj, Layer layer, MapBuilder map); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Profiles/BoxUniformProfile.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine; 3 | 4 | namespace MonoGo.MercuryParticleEngine.Profiles 5 | { 6 | public class BoxUniformProfile : Profile 7 | { 8 | public float Width { get; set; } 9 | public float Height { get; set; } 10 | 11 | public override void GetOffsetAndHeading(out Vector2 offset, out Axis heading) 12 | { 13 | var rand = FastRand.NextInteger((int) (2*Width + 2*Height)); 14 | if (rand < Width) // Top 15 | offset = new Vector2(FastRand.NextSingle(Width * -0.5f, Width * 0.5f), Height * -0.5f); 16 | else if (rand < 2*Width) // Bottom 17 | offset = new Vector2(FastRand.NextSingle(Width * -0.5f, Width * 0.5f), Height * 0.5f); 18 | else if (rand < 2*Width + Height) // Left 19 | offset = new Vector2(Width * -0.5f, FastRand.NextSingle(Height * -0.5f, Height * 0.5f)); 20 | else // Right 21 | offset = new Vector2(Width * 0.5f, FastRand.NextSingle(Height * -0.5f, Height * 0.5f)); 22 | 23 | FastRand.NextUnitVector(out heading); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/ReleaseParameters.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine; 2 | using Range = MonoGo.Engine.Range; 3 | 4 | namespace MonoGo.MercuryParticleEngine 5 | { 6 | public class ReleaseParameters 7 | { 8 | //Json ctr 9 | protected ReleaseParameters(bool json) { } 10 | 11 | public ReleaseParameters() 12 | { 13 | Quantity = 2; 14 | Speed = RangeF.Parse("[10.0,30.0]"); 15 | Colour = new HSLRange(new HSLColor(0f, 0.5f, 0.5f), new HSLColor(359f, 0.5f, 0.5f)); 16 | Opacity = RangeF.Parse("[1.0,1.0]"); 17 | Scale = RangeF.Parse("[5.0,10.0]"); 18 | Rotation = RangeF.Parse("[-3.14159,3.14159]"); 19 | Mass = 1f; 20 | } 21 | 22 | public Range Quantity { get; set; } 23 | public RangeF Speed { get; set; } 24 | public HSLRange Colour { get; set; } 25 | public RangeF Opacity { get; set; } 26 | public RangeF Scale { get; set; } 27 | public RangeF Rotation { get; set; } 28 | public RangeF Mass { get; set; } 29 | 30 | public override string ToString() 31 | { 32 | return GetType().ToString(); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /MonoGo.Samples/Misc/Tiled/PlayerFactory.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.EC; 2 | using MonoGo.Engine.SceneSystem; 3 | using MonoGo.Tiled; 4 | using MonoGo.Tiled.MapStructure.Objects; 5 | 6 | 7 | namespace MonoGo.Samples.Misc.Tiled 8 | { 9 | // Factories are used by map builder to create actual entities out of 10 | // Tiled templates. 11 | 12 | public class PlayerFactory : ITiledEntityFactory 13 | { 14 | // Tag should be the same as Type property of the template. 15 | public string Tag => "Player"; 16 | 17 | public Entity Make(TiledObject obj, Layer layer, MapBuilder map) 18 | { 19 | var tile = (TiledTileObject)obj; 20 | 21 | // Note that tile.Tileset will be null. Template tileset is not needed in the game itself, 22 | // so it is ignored by the map loader. Set __ignoreTileset property to False in tileset 23 | // properties in Tiled to make map loader load that tileset. 24 | // You can also add __ignoreTilesetTexture to the properties instead and set it to True 25 | // to not load only tileset texture. 26 | 27 | var entity = new Player(layer, tile.Position); 28 | 29 | // Adding a collider component 30 | entity.AddComponent(new TileCollisionComponent()); 31 | 32 | return entity; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Game/SplashScreen.cs: -------------------------------------------------------------------------------- 1 | using Iguina.Defs; 2 | using Iguina.Entities; 3 | using MonoGo.Engine.EC; 4 | using MonoGo.Engine.SceneSystem; 5 | using MonoGo.Iguina; 6 | using System.Reflection; 7 | 8 | namespace MGNamespace 9 | { 10 | public class SplashScreen : GUIEntity 11 | { 12 | private CameraController _cameraController; 13 | 14 | public SplashScreen(CameraController cameraController) : base(SceneMgr.DefaultLayer) 15 | { 16 | _cameraController = cameraController; 17 | } 18 | 19 | public override void CreateUI() 20 | { 21 | base.CreateUI(); 22 | 23 | var panel = new Panel(GUIMgr.System, null!) 24 | { 25 | Anchor = Anchor.Center, 26 | AutoHeight = true, 27 | OverflowMode = OverflowMode.HideOverflow 28 | }; 29 | AddGUIEntity(panel); 30 | 31 | var welcomeText = new Paragraph(GUIMgr.System, @$"MonoGo Engine ${{FC:FFDB5F}}v.{Assembly.GetAssembly(typeof(MonoGo.Engine.EC.Entity)).GetName().Version}${{RESET}}"); 32 | welcomeText.OverrideStyles.FontSize = 28; 33 | panel.AddChild(welcomeText); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /MonoGo.Engine/Drawing/LineShape.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Xna.Framework; 3 | using Microsoft.Xna.Framework.Graphics; 4 | 5 | namespace MonoGo.Engine.Drawing 6 | { 7 | /// 8 | /// Drawable line shape. 9 | /// NOTE: The line has no width. 10 | /// 11 | public static class LineShape 12 | { 13 | private static VertexPositionColorTexture[] _lineVertices = new VertexPositionColorTexture[2]; 14 | private static short[] _lineIndices = { 0, 1 }; 15 | 16 | /// 17 | /// Draws a line. 18 | /// 19 | public static void Draw(Vector2 p1, Vector2 p2) => 20 | Draw(p1, p2, GraphicsMgr.CurrentColor, GraphicsMgr.CurrentColor); 21 | 22 | /// 23 | /// Draws a line with specified colors. 24 | /// 25 | public static void Draw(Vector2 p1, Vector2 p2, Color c1, Color c2, float zDepth = 0) 26 | { 27 | _lineVertices[0].Position = new Vector3(p1, zDepth); 28 | _lineVertices[0].Color = c1; 29 | _lineVertices[1].Position = new Vector3(p2, zDepth); 30 | _lineVertices[1].Color = c2; 31 | 32 | GraphicsMgr.VertexBatch.Texture = null; 33 | GraphicsMgr.VertexBatch.AddPrimitive(PrimitiveType.LineList, _lineVertices, _lineIndices); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Modules/MonoGo.Tiled.MapStructure/TiledMapLayer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Xna.Framework; 3 | 4 | namespace MonoGo.Tiled.MapStructure 5 | { 6 | /// 7 | /// Represents a generic layer in a Tiled map. 8 | /// 9 | public abstract class TiledMapLayer 10 | { 11 | /// 12 | /// Gets or sets the name of the layer. 13 | /// 14 | public string Name; 15 | 16 | /// 17 | /// Gets or sets the unique ID of the layer. 18 | /// 19 | public int ID; 20 | 21 | /// 22 | /// Gets or sets a value indicating whether the layer is visible. 23 | /// 24 | public bool Visible; 25 | 26 | /// 27 | /// Gets or sets the opacity of the layer. 28 | /// 29 | public float Opacity; 30 | 31 | /// 32 | /// Gets or sets the offset of the layer in pixels. 33 | /// 34 | public Vector2 Offset; 35 | 36 | /// 37 | /// Gets or sets the custom properties of the layer. 38 | /// 39 | public Dictionary Properties; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /MonoGo.Engine/Collisions/Shapes/Circle.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine.Utils; 3 | using MonoGo.Engine.Utils.CustomCollections; 4 | 5 | namespace MonoGo.Engine.Collisions.Shapes 6 | { 7 | /// 8 | /// Defines a perfect circle with a positive radius. 9 | /// 10 | public class Circle : IShape, IPoolable 11 | { 12 | public ShapeType Type => ShapeType.Circle; 13 | 14 | 15 | /// 16 | /// Radius of the circle, measured in meters. 17 | /// 18 | public float Radius; 19 | 20 | /// 21 | /// Absolute position of the shape, measured in meters. 22 | /// 23 | public Vector2 Position; 24 | 25 | /// 26 | /// NOTE: It is recommended to use ShapePool to get new instances of this class. 27 | /// 28 | public Circle() { } 29 | 30 | public AABB GetBoundingBox() 31 | { 32 | return new AABB(Position - new Vector2(Radius, Radius), Position + new Vector2(Radius, Radius)); 33 | } 34 | 35 | /// 36 | public bool InPool { get; set; } 37 | 38 | /// 39 | public void OnTakenFromPool() {} 40 | 41 | /// 42 | public void OnReturnedToPool() 43 | { 44 | Position = Vector2.Zero; 45 | Radius = 0; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /MonoGo.Engine/Utils/Coroutines/Coroutine.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | namespace MonoGo.Engine.Utils.Coroutines 6 | { 7 | public class Coroutine : IDisposable 8 | { 9 | public bool Paused; 10 | 11 | public event Action OnFinish; 12 | 13 | internal virtual void Reset(IEnumerator routine) 14 | { 15 | RoutinesStack.Clear(); 16 | RoutinesStack.Push(routine); 17 | Paused = false; 18 | } 19 | 20 | 21 | internal virtual bool Update() 22 | { 23 | if (Paused) 24 | { 25 | return true; 26 | } 27 | 28 | if (RoutinesStack.Peek().MoveNext()) 29 | { 30 | if (RoutinesStack.Peek().Current is IEnumerator enumerator) 31 | { 32 | RoutinesStack.Push(enumerator); 33 | } 34 | } 35 | else 36 | { 37 | RoutinesStack.Pop(); 38 | if (RoutinesStack.Count == 0) 39 | { 40 | OnFinish?.Invoke(); 41 | return false; 42 | } 43 | } 44 | 45 | return true; 46 | } 47 | 48 | 49 | internal readonly Stack RoutinesStack = new Stack(1); 50 | 51 | 52 | public virtual void Dispose() 53 | { 54 | foreach (var routine in RoutinesStack) 55 | { 56 | routine.Reset(); 57 | } 58 | RoutinesStack.Clear(); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /MonoGo.Samples/Misc/ActorComponent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGo.Engine; 3 | using MonoGo.Engine.Drawing; 4 | using MonoGo.Engine.EC; 5 | using MonoGo.Engine.Utils; 6 | 7 | namespace MonoGo.Samples.Misc 8 | { 9 | /// 10 | /// Actor component. Actors can move in some direction. 11 | /// NOTE: PositionComponent is required. 12 | /// 13 | public class ActorComponent : Component 14 | { 15 | public bool Move = false; 16 | 17 | public Angle Direction; 18 | public float Speed = 150; 19 | 20 | public Sprite Sprite; 21 | 22 | public ActorComponent(Sprite sprite) 23 | { 24 | Visible = true; // Components are not visible by default. 25 | 26 | Sprite = sprite; 27 | } 28 | 29 | public override void Update() 30 | { 31 | base.Update(); 32 | if (Move) 33 | { 34 | // Retrieving the position component from entity. 35 | var position = Owner.GetComponent(); 36 | position.Position += TimeKeeper.Global.Time(Speed) * Direction.ToVector2(); 37 | } 38 | } 39 | 40 | public override void Draw() 41 | { 42 | base.Draw(); 43 | var position = Owner.GetComponent(); 44 | 45 | GraphicsMgr.CurrentColor = Color.White; 46 | 47 | Sprite.Draw(position.Position); 48 | } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /MonoGo.Engine/Collisions/ColliderPool.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.Collisions.Colliders; 2 | using MonoGo.Engine.Utils.CustomCollections; 3 | 4 | namespace MonoGo.Engine.Collisions 5 | { 6 | public static class ColliderPool 7 | { 8 | private static Pool _colliderPool = new Pool(); 9 | private static Pool _circleColliderPool = new Pool(); 10 | private static Pool _rectangleColliderPool = new Pool(); 11 | private static Pool _lineColliderPool = new Pool(); 12 | 13 | 14 | public static Collider GetCollider() => _colliderPool.Get(); 15 | public static CircleCollider GetCircleCollider() => _circleColliderPool.Get(); 16 | public static RectangleCollider GetRectangleCollider() => _rectangleColliderPool.Get(); 17 | public static LineCollider GetLineCollider() => _lineColliderPool.Get(); 18 | 19 | 20 | public static void Return(Collider collider) => _colliderPool.Return(collider); 21 | public static void Return(CircleCollider collider) => _circleColliderPool.Return(collider); 22 | public static void Return(RectangleCollider collider) => _rectangleColliderPool.Return(collider); 23 | public static void Return(LineCollider collider) => _lineColliderPool.Return(collider); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Content/Content.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | net9.0 5 | false 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | All 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Modules/MonoGo.Iguina/UIController.cs: -------------------------------------------------------------------------------- 1 | using MonoGo.Engine.EC; 2 | using MonoGo.Engine.SceneSystem; 3 | 4 | namespace MonoGo.Iguina 5 | { 6 | /// 7 | /// The UIController class is responsible for managing the user interface (UI) system. 8 | /// It updates and renders UI elements by interacting with the GUI manager. 9 | /// 10 | internal class UIController : Entity 11 | { 12 | /// 13 | /// Initializes a new instance of the UIController class and assigns it to the GUI layer. 14 | /// 15 | internal UIController() : base(SceneMgr.GUILayer) { } 16 | 17 | /// 18 | /// Updates the state of the UI system. This method is called once per frame. 19 | /// 20 | public override void Update() 21 | { 22 | base.Update(); 23 | 24 | // Updates the GUI manager. 25 | GUIMgr.Update(); 26 | } 27 | 28 | /// 29 | /// Draws the UI elements managed by the GUI manager. This method is called once per frame. 30 | /// 31 | public override void Draw() 32 | { 33 | base.Draw(); 34 | 35 | // Draws the GUI elements. 36 | GUIMgr.Draw(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /MonoGo.Pipeline/Tiled/TiledMapImporter.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content.Pipeline; 2 | using MonoGo.Tiled.MapStructure; 3 | using System.IO; 4 | using System.Xml; 5 | 6 | namespace MonoGo.Pipeline.Tiled 7 | { 8 | [ContentImporter(".tmx", DefaultProcessor = "PassThroughProcessor", 9 | DisplayName = "Tiled Map Importer - MonoGo")] 10 | public class TiledMapImporter : ContentImporter 11 | { 12 | /// 13 | /// Directory of the .tmx file. 14 | /// 15 | public static string TmxRootDir; 16 | public static string TmxFilename; 17 | 18 | /// 19 | /// Current root directory. 20 | /// 21 | public static string CurrentRootDir; 22 | 23 | 24 | public override TiledMap Import(string filename, ContentImporterContext context) 25 | { 26 | //Logger.Init("map.log"); 27 | TmxRootDir = Path.GetDirectoryName(filename) + '/'; 28 | TmxFilename = filename; 29 | CurrentRootDir = TmxRootDir; 30 | //Logger.LogLine("ROOT:" + TmxRootDir); 31 | try 32 | { 33 | var xml = new XmlDocument(); 34 | xml.Load(filename); 35 | 36 | return MapParser.Parse(xml); 37 | } 38 | catch(System.Exception e) 39 | { 40 | throw new System.Exception("Failed to import the map! " + e.Message + " " + e.StackTrace); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /MonoGo.Engine/Resources/SpriteGroupResourceBox.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | using MonoGo.Engine.Drawing; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | 6 | namespace MonoGo.Engine.Resources 7 | { 8 | public class SpriteGroupResourceBox : ResourceBox 9 | { 10 | private ContentManager _content = new ContentManager(GameMgr.Game.Services); 11 | 12 | private readonly string _resourcePath; 13 | 14 | public SpriteGroupResourceBox(string name, string spriteGroupPath) : base(name) 15 | { 16 | _resourcePath = spriteGroupPath; 17 | } 18 | 19 | public override void Load() 20 | { 21 | if (Loaded) 22 | { 23 | return; 24 | } 25 | Loaded = true; 26 | var graphicsPath = Path.Combine(ResourceInfoMgr.ContentDir, _resourcePath); 27 | var sprites = _content.Load>(graphicsPath); 28 | 29 | foreach (var spritePair in sprites) 30 | { 31 | try 32 | { 33 | spritePair.Value.Name = Name + "/" + spritePair.Value.Name; 34 | AddResource(Path.GetFileNameWithoutExtension(spritePair.Key), spritePair.Value); 35 | } 36 | catch { } 37 | } 38 | } 39 | 40 | public override void Unload() 41 | { 42 | if (!Loaded) 43 | { 44 | return; 45 | } 46 | Loaded = false; 47 | _content.Unload(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /MonoGo.Engine/Collisions/CollisionSettings.cs: -------------------------------------------------------------------------------- 1 | namespace MonoGo.Engine.Collisions 2 | { 3 | public static class CollisionSettings 4 | { 5 | public const float Epsilon = 1.192092896e-07f; 6 | 7 | /// 8 | /// The maximum number of vertices on a convex polygon. It is recommended to keep this number low for performance reasons. 9 | /// NOTE: Settign this value below 4 will result in collider logic breaking. 10 | /// 11 | public static int MaxPolygonVertices = 8; 12 | 13 | /// 14 | /// This value signifies how many pixels there are in one meter. 15 | /// Making colliders too large will result in performance issues, that's why collider sizes are downscaled and measured in meters. 16 | /// 17 | public static float WorldScale 18 | { 19 | get => _worldScale; 20 | set 21 | { 22 | _worldScale = value; 23 | OneOverWorldScale = 1 / _worldScale; 24 | } 25 | } 26 | private static float _worldScale = 64f; 27 | 28 | /// 29 | /// This value signifies how many meters there are in one pixel. 30 | /// Making colliders too large will result in performance issues, that's why collider sizes are downscaled and measured in meters. 31 | /// 32 | public static float OneOverWorldScale { get; private set; } = 1 / _worldScale; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Content/Content.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | net9.0 5 | false 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | All 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /MonoGo.Engine/Drawing/TriangleFanPrimitive.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Graphics; 2 | using System.Collections.Generic; 3 | 4 | namespace MonoGo.Engine.Drawing 5 | { 6 | /// 7 | /// Drawable triangle fan primitive. 8 | /// Draws a bunch of triangles, all of which begin at the first vertex. 9 | /// 10 | /// 11 | /// Pattern: 12 | /// 1 - 2 13 | /// | / | 14 | /// 0 - 3 15 | /// | \ | 16 | /// 5 - 4 17 | /// 18 | public class TriangleFanPrimitive : Primitive2D 19 | { 20 | 21 | protected override PrimitiveType _primitiveType => PrimitiveType.TriangleList; 22 | 23 | 24 | public TriangleFanPrimitive(int capacity) : base(capacity) 25 | { 26 | } 27 | 28 | /// 29 | /// Sets indexes according to trianglefan pattern. 30 | /// NOTE: Use counter-clockwise culling. 31 | /// 32 | protected override short[] GetIndices() 33 | { 34 | // 1 - 2 35 | // | / | 36 | // 0 - 3 37 | // | \ | 38 | // 5 - 4 39 | 40 | var indices = new List(); 41 | 42 | for(var i = 1; i < Vertices.Length - 1; i += 1) 43 | { 44 | indices.Add(0); 45 | indices.Add((short)i); 46 | indices.Add((short)(i + 1)); 47 | } 48 | 49 | return indices.ToArray(); 50 | } 51 | 52 | 53 | 54 | 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Templates/DesktopGL/Game/Game1.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Input; 3 | using MonoGo.Engine; 4 | using MonoGo.Iguina; 5 | using System.IO; 6 | 7 | namespace MGNamespace 8 | { 9 | // Inherit from MonoGoGame to start using the MonoGo Engine! 10 | public class Game1 : MonoGoGame 11 | { 12 | protected override void Initialize() 13 | { 14 | base.Initialize(); 15 | 16 | // This is just a sample. 17 | // Remove or modify the GameController as you wish! 18 | new GameController(); 19 | } 20 | 21 | protected override void LoadContent() 22 | { 23 | // IMPORTANT: Don't delete! It loads engine specific stuff. 24 | LoadEngineContent(); 25 | 26 | GUIMgr.Init(Path.Combine(ResourceInfoMgr.ContentDir, "Game/GUI"), "MonoGoTheme"); 27 | } 28 | 29 | protected override void Update(GameTime gameTime) 30 | { 31 | if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) 32 | Exit(); 33 | 34 | base.Update(gameTime); 35 | } 36 | 37 | protected override void Draw(GameTime gameTime) 38 | { 39 | base.Draw(gameTime); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /MonoGo.Engine/Drawing/LineStripPrimitive.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Graphics; 2 | using System.Collections.Generic; 3 | 4 | namespace MonoGo.Engine.Drawing 5 | { 6 | /// 7 | /// Drawable line strip primitive. Draws a bunch of connected lines. Can be looped. 8 | /// 9 | /// 10 | /// Pattern: 0 - 1 - 2 - 3 11 | /// 12 | public class LineStripPrimitive : Primitive2D 13 | { 14 | 15 | protected override PrimitiveType _primitiveType => PrimitiveType.LineList; 16 | 17 | /// 18 | /// If true, a line between first and last vertex will be drawn. 19 | /// 20 | public bool Looped; 21 | 22 | public LineStripPrimitive(int capacity, bool looped = false) : base(capacity) 23 | { 24 | Looped = looped; 25 | } 26 | 27 | /// 28 | /// Sets indices according to line strip pattern. 29 | /// 30 | protected override short[] GetIndices() 31 | { 32 | // 0 - 1 - 2 - 3 33 | 34 | var indices = new List(); 35 | 36 | for(var i = 0; i < Vertices.Length - 1; i += 1) 37 | { 38 | indices.Add((short)i); 39 | indices.Add((short)(i + 1)); 40 | } 41 | if (Looped) 42 | { 43 | indices.Add((short)(Vertices.Length - 1)); 44 | indices.Add(0); 45 | } 46 | 47 | return indices.ToArray(); 48 | } 49 | 50 | 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /MonoGo.Engine/EC/IEntityMethods.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace MonoGo.Engine.EC 4 | { 5 | /// 6 | /// Methods for working with entities. 7 | /// 8 | /// NOTE: Methods should return all entities regardless of if they are enabled. 9 | /// 10 | interface IEntityMethods 11 | { 12 | /// 13 | /// Returns list of entities of certain type. 14 | /// 15 | List GetEntityList() where T : Entity; 16 | 17 | /// 18 | /// Checks if any instances of an entity exist. 19 | /// 20 | bool EntityExists() where T : Entity; 21 | 22 | /// 23 | /// Finds first entity of given type. 24 | /// 25 | T FindEntity() where T : Entity; 26 | 27 | 28 | /// 29 | /// Returns list of entities, which have component - enabled or disabled - of given type. 30 | /// 31 | List GetEntityListByComponent() where T : Component; 32 | 33 | /// 34 | /// Finds first entity, which has component - enabled or disabled - of given type. 35 | /// 36 | Entity FindEntityByComponent() where T : Component; 37 | 38 | 39 | 40 | /// 41 | /// Returns list of components - enabled and disabled - of given type. 42 | /// 43 | List GetComponentList() where T : Component; 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Modules/MonoGo.MercuryParticleEngine/Modifiers/VelocityHueModifier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Xna.Framework; 3 | using MonoGo.Engine; 4 | 5 | namespace MonoGo.MercuryParticleEngine.Modifiers 6 | { 7 | public class VelocityHueModifier : IModifier 8 | { 9 | public string Key { get; set; } 10 | 11 | public float StationaryHue { get; set; } 12 | public float VelocityHue { get; set; } 13 | public float VelocityThreshold { get; set; } 14 | 15 | public unsafe void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) 16 | { 17 | var velocityThreshold2 = VelocityThreshold * VelocityThreshold; 18 | 19 | while (iterator.HasNext) 20 | { 21 | var particle = iterator.Next(); 22 | var velocity2 = particle->Velocity.LengthSquared(); 23 | 24 | float h; 25 | if (velocity2 >= velocityThreshold2) 26 | { 27 | h = VelocityHue; 28 | } 29 | else 30 | { 31 | var t = (float)Math.Sqrt(velocity2) / VelocityThreshold; 32 | h = MathHelper.Lerp(StationaryHue, VelocityHue, t); 33 | } 34 | particle->Colour = new HSLColor(h, particle->Colour.S, particle->Colour.L); 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /MonoGo.Engine/Drawing/TriangleStripPrimitive.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Graphics; 2 | using System.Collections.Generic; 3 | 4 | namespace MonoGo.Engine.Drawing 5 | { 6 | /// 7 | /// Drawable triangle strip primitive. Draws a strip of triangles. 8 | /// 9 | /// 10 | /// Pattern: 11 | /// 0 - 2 - 4 12 | /// \ / \ / 13 | /// 1 - 3 14 | /// 15 | public class TriangleStripPrimitive : Primitive2D 16 | { 17 | protected override PrimitiveType _primitiveType => PrimitiveType.TriangleList; 18 | 19 | public TriangleStripPrimitive(int capacity) : base(capacity) { } 20 | 21 | /// 22 | /// Sets indices according to trianglestrip pattern. 23 | /// NOTE: Use counter-clockwise culling. 24 | /// 25 | protected override short[] GetIndices() 26 | { 27 | var indices = new List(); 28 | 29 | var flip = true; 30 | for(var i = 0; i < Vertices.Length - 2; i += 1) 31 | { 32 | indices.Add((short)i); 33 | if (flip) // Taking in account counter-clockwise culling. 34 | { 35 | indices.Add((short)(i + 2)); 36 | indices.Add((short)(i + 1)); 37 | } 38 | else 39 | { 40 | indices.Add((short)(i + 1)); 41 | indices.Add((short)(i + 2)); 42 | } 43 | flip = !flip; 44 | } 45 | 46 | return indices.ToArray(); 47 | } 48 | 49 | 50 | 51 | } 52 | } 53 | --------------------------------------------------------------------------------