diff --git a/docs/articles/drawing-your-first-sprite.md b/docs/articles/drawing-your-first-sprite.md new file mode 100644 index 0000000..33473bf --- /dev/null +++ b/docs/articles/drawing-your-first-sprite.md @@ -0,0 +1,13 @@ +# Drawing Your First Sprite + +## Preloading Your Sprite + + +## Retrieving Your Sprite + + +## Drawing Your Sprite + + +## Moving, Squishing, Spinning, Stretching + diff --git a/docs/articles/getting-started-old.md b/docs/articles/getting-started-old.md new file mode 100644 index 0000000..cc2d330 --- /dev/null +++ b/docs/articles/getting-started-old.md @@ -0,0 +1,135 @@ +# Getting started + +> [!WARNING] +> This documentation is currently out-of-date! +> This will be resolved ASAP. To some degree this might still work for you. +> Do make sure to take a look at the [Example Project](https://github.com/Naamloos/Axolotl2D/tree/master/Axolotl2D.Example) + + +To create a new Axolotl2D game, you'll want to reference the Axolotl2D library and create a new class inheriting the abstract `Game` class. This is very much prone to changes and may or may not be outdated at the time of reading! Once Axolotl2D is more ready for "general use", a proper documentation will be written. + +```cs +using System.Numerics; +using Microsoft.Extensions.Logging; +using Axolotl2D.Drawable; +using Axolotl2D.Entities; +using Axolotl2D.Input; + +public class MyGame : Game +{ + // Our services + private Mouse? _mouse; + private ILogger _logger; + + // Our resources / drawables + private Sprite? _sprite; + + // You are required to pass the IServiceProvider service as a + // dependency to the base Game class. + // Other things like the Mouse, or the ILogger are free to + // inject as needed, if they're defined in your services. + + // You are also able to set the max framerate and max update rate + // through the base constructor. + // These will later be changeable at runtime, but for the time being + // these can only be updated as your game gets constructed. + public ExampleGame(IServiceProvider services, Mouse mouse, + ILogger logger) + : base(services, maxDrawRate: 240, maxUpdateRate: 240) + { + // Set a title for the window + Title = "Axolotl2D Game"; + // Set a clear color + ClearColor = Color.FromHTML("#0088FF"); + // These can be changed at any time in your game loop. + + // Axolotl2D uses events for it's game loop. You'll want to hook + // these manually as you see fit. + OnLoad += Load; + OnUpdate += Update; + OnDraw += Draw; + OnResize += Resize; + + // Assigning properties from dependencies as needed. + this._logger = logger; + this._mouse = mouse; + } + + // This is the place where you would pre-load all your assets. + public void Load() + { + // We can load sprites from embedded resources. + // You'll have to mark your texture as an Embedded Resource + _sprite = Sprite.FromManifestResource(this, + "MyAwesomeGame.Sprites.MySprite.png"); + // Of course, it is also possible to load a Sprite from any other + // type of Stream. + // This is done with Sprites constructor: + // _sprite = new Sprite(this, imageStream); + _logger.LogInformation("Loaded Game Assets"); + } + + // This is our draw method. You'll want to draw your sprites here. + public void Draw(double frameDelta, double frameRate) + { + // This will draw your sprite at coordinates 50, 50 + // with a size of 50x50 + _sprite.Draw(50, 50, 50, 50); + } + + // This is our update method. We can use this method to + // update values without interrupting our draw loop. + // For example, you'll want to manipulate your Sprite's + // position and size here. + public void Update(double frameDelta) + { + + } + + // This is the Resize method. + // It is called when the game window resizes. + public void Resize(Vector2D size) + { + } + + // When your game is closed, + // you'll want to clean up everything nicely. + // This can be done right here. + public override void Cleanup() + { + _logger.LogInformation("Cleaned up events and unloading game..."); + // unhook events + OnLoad -= Load; + OnUpdate -= Update; + OnDraw -= Draw; + OnResize -= Resize; + } +} +``` + +Once you're done creating your Game class, you'll want to create a Host that houses your game and injects dependencies where you need them. +You'll want to do this in your Program.cs. + +```cs +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Axolotl2D; + +internal class Program +{ + static void Main(string[] args) + { + var host = Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddGame(); + services.UseMouse(); + services.AddLogging(); + }) + .Build(); + + host.Start(); + } +} +``` +As of right now, the engine is very barebones. More to come in the near future! diff --git a/docs/articles/getting-started.md b/docs/articles/getting-started.md index cc2d330..6691f24 100644 --- a/docs/articles/getting-started.md +++ b/docs/articles/getting-started.md @@ -1,135 +1,20 @@ -# Getting started +# Getting Started with Axolotl2D -> [!WARNING] -> This documentation is currently out-of-date! -> This will be resolved ASAP. To some degree this might still work for you. -> Do make sure to take a look at the [Example Project](https://github.com/Naamloos/Axolotl2D/tree/master/Axolotl2D.Example) +*[Old article](./getting-started-old.md)* +To get started working with Axolotl2D, you will first need to set up your project. This guide will walk you through the necessary steps to configure your project, and run a simple example to ensure everything is working correctly. By the end of this guide, you should be ready to start developing your own projects. -To create a new Axolotl2D game, you'll want to reference the Axolotl2D library and create a new class inheriting the abstract `Game` class. This is very much prone to changes and may or may not be outdated at the time of reading! Once Axolotl2D is more ready for "general use", a proper documentation will be written. +## Creating a new project +// TODO -```cs -using System.Numerics; -using Microsoft.Extensions.Logging; -using Axolotl2D.Drawable; -using Axolotl2D.Entities; -using Axolotl2D.Input; +## Creating a GenericHost +// TODO -public class MyGame : Game -{ - // Our services - private Mouse? _mouse; - private ILogger _logger; +## Creating your game skeleton +// TODO - // Our resources / drawables - private Sprite? _sprite; +## Registering your game and services into the host +// TODO - // You are required to pass the IServiceProvider service as a - // dependency to the base Game class. - // Other things like the Mouse, or the ILogger are free to - // inject as needed, if they're defined in your services. - - // You are also able to set the max framerate and max update rate - // through the base constructor. - // These will later be changeable at runtime, but for the time being - // these can only be updated as your game gets constructed. - public ExampleGame(IServiceProvider services, Mouse mouse, - ILogger logger) - : base(services, maxDrawRate: 240, maxUpdateRate: 240) - { - // Set a title for the window - Title = "Axolotl2D Game"; - // Set a clear color - ClearColor = Color.FromHTML("#0088FF"); - // These can be changed at any time in your game loop. - - // Axolotl2D uses events for it's game loop. You'll want to hook - // these manually as you see fit. - OnLoad += Load; - OnUpdate += Update; - OnDraw += Draw; - OnResize += Resize; - - // Assigning properties from dependencies as needed. - this._logger = logger; - this._mouse = mouse; - } - - // This is the place where you would pre-load all your assets. - public void Load() - { - // We can load sprites from embedded resources. - // You'll have to mark your texture as an Embedded Resource - _sprite = Sprite.FromManifestResource(this, - "MyAwesomeGame.Sprites.MySprite.png"); - // Of course, it is also possible to load a Sprite from any other - // type of Stream. - // This is done with Sprites constructor: - // _sprite = new Sprite(this, imageStream); - _logger.LogInformation("Loaded Game Assets"); - } - - // This is our draw method. You'll want to draw your sprites here. - public void Draw(double frameDelta, double frameRate) - { - // This will draw your sprite at coordinates 50, 50 - // with a size of 50x50 - _sprite.Draw(50, 50, 50, 50); - } - - // This is our update method. We can use this method to - // update values without interrupting our draw loop. - // For example, you'll want to manipulate your Sprite's - // position and size here. - public void Update(double frameDelta) - { - - } - - // This is the Resize method. - // It is called when the game window resizes. - public void Resize(Vector2D size) - { - } - - // When your game is closed, - // you'll want to clean up everything nicely. - // This can be done right here. - public override void Cleanup() - { - _logger.LogInformation("Cleaned up events and unloading game..."); - // unhook events - OnLoad -= Load; - OnUpdate -= Update; - OnDraw -= Draw; - OnResize -= Resize; - } -} -``` - -Once you're done creating your Game class, you'll want to create a Host that houses your game and injects dependencies where you need them. -You'll want to do this in your Program.cs. - -```cs -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.DependencyInjection; -using Axolotl2D; - -internal class Program -{ - static void Main(string[] args) - { - var host = Host.CreateDefaultBuilder(args) - .ConfigureServices((hostContext, services) => - { - services.AddGame(); - services.UseMouse(); - services.AddLogging(); - }) - .Build(); - - host.Start(); - } -} -``` -As of right now, the engine is very barebones. More to come in the near future! +## Initializing and running your game +// TODO diff --git a/docs/articles/introduction.md b/docs/articles/introduction.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/articles/toc.yml b/docs/articles/toc.yml index 458a591..58f2911 100644 --- a/docs/articles/toc.yml +++ b/docs/articles/toc.yml @@ -1,2 +1,4 @@ - name: Getting Started - href: getting-started.md \ No newline at end of file + href: getting-started.md +- name: Drawing Your First Sprite + href: drawing-your-first-sprite.md \ No newline at end of file diff --git a/docs/docfx.json b/docs/docfx.json index 633d0fb..b6903f8 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -26,7 +26,7 @@ } ], "output": "_site", - "template": ["default", "modern", "memberpage", "templates/material"], + "template": ["default", "modern", "templates/material"], "postProcessors": [ "ExtractSearchIndex" ], @@ -35,6 +35,7 @@ "_appTitle": "Axolotl2D", "_appLogoPath": "images/logo_small.png", "_appFaviconPath": "images/favicon.ico", + "_appFooter": "© 2025 Ryan de Jonge (Naamloos)", "_enableSearch": true, "pdf": false } diff --git a/docs/index.md b/docs/index.md index ac65a6a..3104cc5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,6 +3,11 @@ uid: index title: Axolotl2D Documentation --- +> [!NOTE] +> Axolotl2D is curently in early development, thus this documentation WILL be out-of-date quickly! +> If you run into any issues during development, feel free to ask any questions on [Discord](https://discord.gg/hMRWUTa). +> Do make sure to take a look at the [Example Project](https://github.com/Naamloos/Axolotl2D/tree/master/Axolotl2D.Example) as well, as this example is more likely to be up-to-date with the rest of the project! + ![medium sized logo](images/logo_mid.png) # Axolotl2D Axolotl2D is a small lightweight 2D game engine based on [Silk.NET](https://github.com/dotnet/Silk.NET). diff --git a/docs/templates/material/public/main.css b/docs/templates/material/public/main.css index e29b19c..9cc07f9 100644 --- a/docs/templates/material/public/main.css +++ b/docs/templates/material/public/main.css @@ -4,7 +4,7 @@ --bs-font-sans-serif: 'Roboto'; --bs-border-radius: 10px; - --border-radius-button: 40px; + --border-radius-button: 10px; --card-box-shadow: 0 1px 2px 0 #3d41440f, 0 1px 3px 1px #3d414429; --material-yellow-light: #e6dfbf; @@ -20,13 +20,19 @@ --material-warning-background: #f6e8bd; --material-warning-background-dark: #57502c; - --material-info-header: #1976d21a; - --material-info-background: #e3f2fd; - --material-info-background-dark: #2c4557; + --material-info-header: #d66f76; + --material-info-background: #ffd7da; + --material-info-background-dark: #ea99a0; --material-danger-header: #d32f2f1a; --material-danger-background: #ffebee; --material-danger-background-dark: #572c2c; + + --axolotl-color: #ea99a0; + --axolotl-darker-color: #d66f76; + --bs-primary-border-subtle: var(--axolotl-color); + --bs-link-hover-color: #ffffff; + --bs-primary-bg-subtle: #ffd7da; } /* HEADINGS */ @@ -84,6 +90,10 @@ img { background-color: var(--bs-tertiary-bg); } +nav.navbar{ + border-bottom: var(--axolotl-color) 1px solid; +} + .navbar-nav > li > a { border-radius: var(--border-radius-button); transition: 200ms; @@ -96,7 +106,12 @@ img { .navbar-nav .nav-link.active, .navbar-nav .nav-link.show { - color: var(--bs-link-hover-color); + color: var(--axolotl-darker-color); +} + +[data-bs-theme='light'] .navbar-nav .nav-link.active, +[data-bs-theme='light'] .navbar-nav .nav-link.show { + color: #444; } /** SEARCH AND FILTER **/ @@ -136,11 +151,6 @@ form.filter { background-color: var(--material-info-background); } -[data-bs-theme='dark'] .alert-info { - color: var(--material-blue-light); - background-color: var(--material-info-background-dark); -} - .alert-info > h5 { background-color: var(--material-info-header); } @@ -183,4 +193,12 @@ code { .container-xxl { max-width: 1320px; +} + +a { + color: var(--axolotl-darker-color); +} + +[data-bs-theme='light'] a { + color: var(--axolotl-darker-color); } \ No newline at end of file