Skip to content

Commit a5817e6

Browse files
Sample Migration (#255)
* Update checkouts * Sample migration
1 parent 58886ac commit a5817e6

521 files changed

Lines changed: 8793 additions & 11 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

articles/toc.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,29 @@ items:
165165
href: tutorials/building_2d_games/26_publish_to_itch/index.md
166166
- name: "27: Conclusion and Next Steps"
167167
href: tutorials/building_2d_games/27_conclusion/index.md
168+
- name: 2D Shaders
169+
href: tutorials/advanced/2d_shaders/index.md
170+
items:
171+
- name: "01: Introduction"
172+
href: tutorials/advanced/2d_shaders/01_introduction/index.md
173+
- name: "02: Hot Reload"
174+
href: tutorials/advanced/2d_shaders/02_hot_reload/index.md
175+
- name: "03: The Material Class"
176+
href: tutorials/advanced/2d_shaders/03_the_material_class/index.md
177+
- name: "04: Debug UI"
178+
href: tutorials/advanced/2d_shaders/04_debug_ui/index.md
179+
- name: "05: Transition Effect"
180+
href: tutorials/advanced/2d_shaders/05_transition_effect/index.md
181+
- name: "06: Color Swap Effect"
182+
href: tutorials/advanced/2d_shaders/06_color_swap_effect/index.md
183+
- name: "07: Sprite Vertex Effect"
184+
href: tutorials/advanced/2d_shaders/07_sprite_vertex_effect/index.md
185+
- name: "08: Light Effect"
186+
href: tutorials/advanced/2d_shaders/08_light_effect/index.md
187+
- name: "09: Shadow Effect"
188+
href: tutorials/advanced/2d_shaders/09_shadows_effect/index.md
189+
- name: "10: Next Steps"
190+
href: tutorials/advanced/2d_shaders/10_next_steps/index.md
168191
- name: Console Access
169192
href: console_access.md
170193
- name: Help and Support
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: "Chapter 01: Getting Started"
3+
description: "Prepare your project and get ready"
4+
---
5+
6+
Welcome to the advanced 2D shaders tutorial! The goal of this series is to explore several concepts in MonoGame's 2D graphics capabilities, specifically with respect to shaders.
7+
8+
## The Starting Code
9+
10+
This tutorial series builds directly on top of the final code from the [Building 2D Games](https://docs.monogame.net/articles/tutorials/building_2d_games/index.html) tutorial. It is essential that you start with this project.
11+
12+
> [!note]
13+
> You can get the complete starting source code for this tutorial here:
14+
> [Chapter 27 source code from Building 2D Games tutorial](https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/Tutorials/learn-monogame-2d/src/27-Conclusion/)
15+
16+
Once you have the code downloaded, open it in your IDE and run the `DungeonSlime` project to make sure everything is working correctly. You should see the title screen from the previous tutorial.
17+
18+
## Project Structure
19+
20+
The solution is currently organized into two main projects:
21+
22+
- **`DungeonSlime`**: The main game project. This contains our game logic and game-specific content.
23+
- **`MonoGameLibrary`**: Our reusable class library. We will be adding new, generic helper classes here that could be used in any of your future MonoGame projects.
24+
25+
Most of our shader files (`.fx`) will be created in the `Content/effects` folder within the `DungeonSlime` project to start, and later within the `MonoGameLibrary` for shared effects.
26+
27+
## What is Next
28+
29+
Now that our project is set up, we can get to work. The focus for the first several chapters will be to create a workflow for developing shaders in MonoGame. Once we have a hot-reload system, a class to manage the effects, and a debug UI ready, we will carry on and build up 5 effects. The effects will range from simple pixel shaders and vertex shaders up to rendering techniques. As we develop these shaders together, we will build an intuition for how to tackle shader development.
30+
31+
Continue to the next chapter, [Chapter 02: Hot Reload](../02_hot_reload/index.md).
52.8 KB
Loading
57.3 KB
Loading

articles/tutorials/advanced/2d_shaders/02_hot_reload/index.md

Lines changed: 388 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ItemGroup>
2+
<PackageReference Include="Gum.MonoGame" Version="2025.12.9.1" />
3+
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.*" />
4+
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.*" />
5+
</ItemGroup>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#region declaration
2+
using System;
3+
using Microsoft.Xna.Framework.Content;
4+
5+
namespace MonoGameLibrary.Content;
6+
7+
public class WatchedAsset<T>
8+
{
9+
10+
}
11+
12+
#endregion
13+
{
14+
#region members
15+
/// <summary>
16+
/// The latest version of the asset.
17+
/// </summary>
18+
public T Asset { get; set; }
19+
20+
/// <summary>
21+
/// The last time the <see cref="Asset"/> was loaded into memory.
22+
/// </summary>
23+
public DateTimeOffset UpdatedAt { get; set; }
24+
25+
/// <summary>
26+
/// The name of the <see cref="Asset"/>. This is the name used to load the asset from disk.
27+
/// </summary>
28+
public string AssetName { get; init; }
29+
30+
/// <summary>
31+
/// The <see cref="ContentManager"/> instance that loaded the asset.
32+
/// </summary>
33+
public ContentManager Owner { get; init; }
34+
#endregion
35+
36+
#region methods
37+
public bool TryRefresh(out T oldAsset)
38+
{
39+
return Owner.TryRefresh(this, out oldAsset);
40+
}
41+
#endregion
42+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"dotnet-mgcb": {
6+
"version": "3.8.4",
7+
"commands": [
8+
"mgcb"
9+
]
10+
},
11+
"dotnet-mgcb-editor": {
12+
"version": "3.8.4",
13+
"commands": [
14+
"mgcb-editor"
15+
]
16+
},
17+
"dotnet-mgcb-editor-linux": {
18+
"version": "3.8.4",
19+
"commands": [
20+
"mgcb-editor-linux"
21+
]
22+
},
23+
"dotnet-mgcb-editor-windows": {
24+
"version": "3.8.4",
25+
"commands": [
26+
"mgcb-editor-windows"
27+
]
28+
},
29+
"dotnet-mgcb-editor-mac": {
30+
"version": "3.8.4",
31+
"commands": [
32+
"mgcb-editor-mac"
33+
]
34+
}
35+
}
36+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Target
2+
Name="IncludeContent"
3+
DependsOnTargets="RunContentBuilder"
4+
Condition="('$(EnableMGCBItems)' == 'true' OR '@(MonoGameContentReference)' != '') And '$(DesignTimeBuild)' != 'true'"
5+
Outputs="%(ExtraContent.RecursiveDir)%(ExtraContent.Filename)%(ExtraContent.Extension)"
6+
BeforeTargets="BeforeCompile"
7+
AfterTargets="ResolveProjectReferences">
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dotnet build -t:IncludeContent

0 commit comments

Comments
 (0)