Skip to content

Commit f1f237f

Browse files
Merge branch 'main' into fix-doc-typos
2 parents 21800f8 + 65e2f64 commit f1f237f

File tree

10 files changed

+199
-37
lines changed

10 files changed

+199
-37
lines changed

articles/getting_to_know/whatis/graphics/WhatIs_Sprite.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Sprites are 2D bitmaps that are drawn directly to a render target without using
1717

1818
## Overview
1919

20-
Sprites are positioned on the screen by coordinates. The width and height of the screen is the same as the back buffer. The x-axis represents the screen width and the y-axis represents the screen height. The y-axis is measured from the top of the screen and increases as you move **down** the screen, and the x-axis is measured from left to right. For example, when the graphics back buffer is 800×600, 0,0 is the upper left of the screen, and 800,600 is the lower right of the screen.
20+
Sprites are positioned on the screen by coordinates. The width and height of the screen is the same as the back buffer. The x-axis represents the screen width and the y-axis represents the screen height. The y-axis is measured from the top of the screen and increases as you move **down** the screen, and the x-axis is measured from left to right. For example, when the graphics back buffer is 800×600, the top left corner is at (0,0) and the bottom-right pixel is at (799,599).
2121

2222
To draw a sprite, create a [SpriteBatch](xref:Microsoft.Xna.Framework.Graphics.SpriteBatch) object, initialize it by calling [Begin](/api/Microsoft.Xna.Framework.Graphics.SpriteBatch.html#Microsoft_Xna_Framework_Graphics_SpriteBatch_Begin_Microsoft_Xna_Framework_Graphics_SpriteSortMode_Microsoft_Xna_Framework_Graphics_BlendState_Microsoft_Xna_Framework_Graphics_SamplerState_Microsoft_Xna_Framework_Graphics_DepthStencilState_Microsoft_Xna_Framework_Graphics_RasterizerState_Microsoft_Xna_Framework_Graphics_Effect_System_Nullable_Microsoft_Xna_Framework_Matrix__), and then call [Draw](/api/Microsoft.Xna.Framework.Graphics.SpriteBatch.html#Microsoft_Xna_Framework_Graphics_SpriteBatch_Draw_Microsoft_Xna_Framework_Graphics_Texture2D_Microsoft_Xna_Framework_Rectangle_Microsoft_Xna_Framework_Color_) for each sprite. The bitmap data for a sprite is taken from a [Texture2D](xref:Microsoft.Xna.Framework.Graphics.Texture2D) object. The texture may contain alpha channel information to make part of the texture transparent or semi-transparent. You can tint, rotate, or scale sprites by using [Draw](/api/Microsoft.Xna.Framework.Graphics.SpriteBatch.html#Microsoft_Xna_Framework_Graphics_SpriteBatch_Draw_Microsoft_Xna_Framework_Graphics_Texture2D_Microsoft_Xna_Framework_Rectangle_Microsoft_Xna_Framework_Color_). This method also gives you the option of drawing only part of the texture on the screen. After you draw a sprite, call [End](/api/Microsoft.Xna.Framework.Graphics.SpriteBatch.html#Microsoft_Xna_Framework_Graphics_SpriteBatch_End) before calling [Present](xref:Microsoft.Xna.Framework.Graphics.GraphicsDevice.Present).
2323

articles/samples.md

Lines changed: 162 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,173 @@
11
---
22
title: Samples & Demos
3-
description: Recommended samples and demos for learning how to use MonoGame.
3+
description: The recommended samples and demos for learning how to use MonoGame.
44
---
55

6-
The samples and demos below are recommended for learning how to use MonoGame.
7-
8-
## Official MonoGame tutorial source
9-
10-
- [Building 2D Games](https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/Tutorials/learn-monogame-2d)
11-
126
## Official MonoGame Samples
137

14-
These are [the official samples](https://github.com/MonoGame/MonoGame.Samples) that contain the following:
8+
These are [the official samples](https://github.com/MonoGame/MonoGame.Samples):
9+
10+
## 2D Samples
11+
12+
<section class="container-xxl mb-5">
13+
<div class="row">
14+
<div class="col-12 col-lg-4 mb-5">
15+
<div class="mg-card mg-box-shadow h-100">
16+
<a target="_self"
17+
href="https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/AutoPong"
18+
class="mg-no-link">
19+
<div class="mg-card-body d-flex flex-column h-100">
20+
<div class="mg-card-title"><i class="bi bi-arrow-bar-right"></i> AutoPong Sample 2D</div>
21+
<p>
22+
This project shows you how to make the classic game of pong, with basic soundfx, in 300 lines of code.
23+
The sample has no content and no content manager use, just code!
24+
</p>
25+
<p class="mt-auto">Check out the AutoPong sample</p>
26+
</div>
27+
</a>
28+
</div>
29+
</div>
30+
<div class="col-12 col-lg-4 mb-5">
31+
<div class="mg-card mg-box-shadow h-100">
32+
<a target="_self"
33+
href="https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/Platformer2D"
34+
class="mg-no-link">
35+
<div class="mg-card-body d-flex flex-column h-100">
36+
<div class="mg-card-title"><i class="bi bi-body-text"></i> Platformer Sample 2D</div>
37+
<p>
38+
The Platformer Starter Kit is a near-complete, self-contained game solution that includes both game code and game assets. The game is a standard 2D platformer with levels, enemies, and collectable gems.
39+
\nThis sample is also available as a full cross-platform project template `mg2dstartkit`.
40+
</p>
41+
<p class="mt-auto">Check out the Platformer sample</p>
42+
</div>
43+
</a>
44+
</div>
45+
</div>
46+
<div class="col-12 col-lg-4 mb-5">
47+
<div class="mg-card mg-box-shadow h-100">
48+
<a target="_self"
49+
href="https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/NeonShooter"
50+
class="mg-no-link">
51+
<div class="mg-card-body d-flex flex-column h-100">
52+
<div class="mg-card-title"><i class="bi bi-battery-charging"></i> NeonShooter Sample 2D</div>
53+
<p>
54+
This project shows you how to make a Geometry Wars-inspired twin-stick shooter, with neon graphics, crazy particle effects, and awesome music.
55+
</p>
56+
<p class="mt-auto">Check out the NeonShooter sample</p>
57+
</div>
58+
</a>
59+
</div>
60+
</div>
61+
</div>
62+
</section>
63+
64+
## 3D Samples
65+
66+
<section class="container-xxl mb-5">
67+
<div class="row">
68+
<div class="col-12 col-lg-4 mb-5">
69+
<div class="mg-card mg-box-shadow h-100">
70+
<a target="_self"
71+
href="https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/FuelCell"
72+
class="mg-no-link">
73+
<div class="mg-card-body d-flex flex-column h-100">
74+
<div class="mg-card-title"><i class="bi bi-bandaid-fill"></i> FuelCell Sample 3D</div>
75+
<p>
76+
FuelCell is designed around a central concept providing basic gameplay mechanisms that are easily extensible. The FUelCell sample also includes a complete developer diary documenting its construction.
77+
</p>
78+
<p class="mt-auto">Click to view 3D FuelCell sample</p>
79+
</div>
80+
</a>
81+
</div>
82+
</div>
83+
<div class="col-12 col-lg-4 mb-5">
84+
<div class="mg-card mg-box-shadow h-100">
85+
<a target="_self"
86+
href="https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/ShipGame"
87+
class="mg-no-link">
88+
<div class="mg-card-body d-flex flex-column h-100">
89+
<div class="mg-card-title"><i class="bi bi-rocket-takeoff-fill"></i> ShipGame Sample 3D</div>
90+
<p>
91+
Ship Game is a 3D spaceship combat game set inside a complex tunnel system featuring advanced lighting and textures, a full GPU particle system, and physics.
92+
</p>
93+
<p class="mt-auto">Click to view 3D ShipGame sample</p>
94+
</div>
95+
</a>
96+
</div>
97+
</div>
98+
<div class="col-12 col-lg-4 mb-5">
99+
<div class="mg-card mg-box-shadow h-100">
100+
<a target="_self"
101+
href="/articles/samples.html"
102+
class="mg-no-link">
103+
<div class="mg-card-body d-flex flex-column h-100">
104+
<div class="mg-card-title"><i class="bi bi-lightbulb"></i> Coming Soon</div>
105+
<p>
106+
More 3D sample projects coming soon.
107+
</p>
108+
<p class="mt-auto">See what is coming</p>
109+
</div>
110+
</a>
111+
</div>
112+
</div>
113+
</div>
114+
</section>
115+
116+
## Community delivered full sample projects
117+
118+
<section class="container-xxl mb-5">
119+
<div class="row">
120+
<div class="col-12 col-lg-4 mb-5">
121+
<div class="mg-card mg-box-shadow h-100">
122+
<a target="_self"
123+
href="https://github.com/FlyingOakGames/GreedyKid"
124+
class="mg-no-link">
125+
<div class="mg-card-body d-flex flex-column h-100">
126+
<div class="mg-card-title"><i class="bi bi-files"></i> GreedyKid</div>
127+
<p>
128+
The repository for "Boo! Greedy Kid" on all platforms (Windows, macOS, and Linux) and its level editor (Windows-only).
129+
</p>
130+
<p class="mt-auto">Click to browse the GreedyKid Source</p>
131+
</div>
132+
</a>
133+
</div>
134+
</div>
135+
<div class="col-12 col-lg-4 mb-5">
136+
<div class="mg-card mg-box-shadow h-100">
137+
<a target="_self"
138+
href="https://github.com/ZenithMoonStudios/OldSchoolAdventure"
139+
class="mg-no-link">
140+
<div class="mg-card-body d-flex flex-column h-100">
141+
<div class="mg-card-title"><i class="bi bi-badge-ad-fill"></i> Old School Adventure</div>
142+
<p>
143+
The repository for "Old School Adventure" which was originally published using XNA on Xbox (XBLIG) and Windows Phone.
144+
</p>
145+
<p class="mt-auto">Click to browse the Old School Adventure Source</p>
146+
</div>
147+
</a>
148+
</div>
149+
</div>
150+
<div class="col-12 col-lg-4 mb-5">
151+
<div class="mg-card mg-box-shadow h-100">
152+
<a target="_self"
153+
href="/articles/samples.html"
154+
class="mg-no-link">
155+
<div class="mg-card-body d-flex flex-column h-100">
156+
<div class="mg-card-title"><i class="bi bi-lightbulb"></i> Coming Soon</div>
157+
<p>
158+
More full sample projects coming soon.
159+
</p>
160+
<p class="mt-auto">See what is coming</p>
161+
</div>
162+
</a>
163+
</div>
164+
</div>
165+
</div>
166+
</section>
15167

16-
### 2D Samples
17-
18-
- [AutoPong](https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/AutoPong)
19-
- [Platformer 2D](https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/Platformer2D)
20-
- [NeonShooter](https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/NeonShooter)
21-
22-
### 3D Samples
168+
## Official MonoGame tutorial source
23169

24-
- [FuelCell](https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/FuelCell)
25-
- [ShipGame](https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/ShipGame)
170+
- [Building 2D Games](https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/Tutorials/learn-monogame-2d)
26171

27172
## XNA Game Studio Archive
28173

articles/tutorials/building_2d_games/04_creating_a_class_library/snippets/core.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public Core(string title, int width, int height, bool fullScreen)
6666
// Set the window title.
6767
Window.Title = title;
6868

69-
// Set the core's content manager to a reference of hte base Game's
69+
// Set the core's content manager to a reference of the base Game's
7070
// content manager.
7171
Content = base.Content;
7272

@@ -88,4 +88,4 @@ protected override void Initialize()
8888
// Create the sprite batch instance.
8989
SpriteBatch = new SpriteBatch(GraphicsDevice);
9090
}
91-
}
91+
}

articles/tutorials/building_2d_games/11_input_management/snippets/core.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public Core(string title, int width, int height, bool fullScreen)
7878
// Set the window title.
7979
Window.Title = title;
8080

81-
// Set the core's content manager to a reference of hte base Game's
81+
// Set the core's content manager to a reference of the base Game's
8282
// content manager.
8383
Content = base.Content;
8484

@@ -116,4 +116,4 @@ protected override void Update(GameTime gameTime)
116116

117117
base.Update(gameTime);
118118
}
119-
}
119+
}

articles/tutorials/building_2d_games/13_working_with_tilemaps/snippets/tilemap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public TextureRegion GetTile(int index)
108108
/// column and row.
109109
/// </summary>
110110
/// <param name="column">The column of the tile in this tilemap.</param>
111-
/// <param name="row">The row of hte tile in this tilemap.</param>
111+
/// <param name="row">The row of the tile in this tilemap.</param>
112112
/// <returns>The texture region of the tile from this tilemap at the specified column and row.</returns>
113113
public TextureRegion GetTile(int column, int row)
114114
{

articles/tutorials/building_2d_games/15_audio_controller/snippets/audiocontroller.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,18 @@ public AudioController()
110110
/// </summary>
111111
public void Update()
112112
{
113-
int index = 0;
114-
115-
while (index < _activeSoundEffectInstances.Count)
113+
for (int i = _activeSoundEffectInstances.Count - 1; i >= 0; i--)
116114
{
117-
SoundEffectInstance instance = _activeSoundEffectInstances[index];
115+
SoundEffectInstance instance = _activeSoundEffectInstances[i];
118116

119-
if (instance.State == SoundState.Stopped && !instance.IsDisposed)
117+
if (instance.State == SoundState.Stopped)
120118
{
121-
instance.Dispose();
119+
if (!instance.IsDisposed)
120+
{
121+
instance.Dispose();
122+
}
123+
_activeSoundEffectInstances.RemoveAt(i);
122124
}
123-
124-
_activeSoundEffectInstances.RemoveAt(index);
125125
}
126126
}
127127
#endregion

articles/tutorials/building_2d_games/15_audio_controller/snippets/core.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public Core(string title, int width, int height, bool fullScreen)
8484
// Set the window title.
8585
Window.Title = title;
8686

87-
// Set the core's content manager to a reference of hte base Game's
87+
// Set the core's content manager to a reference of the base Game's
8888
// content manager.
8989
Content = base.Content;
9090

@@ -136,4 +136,4 @@ protected override void Update(GameTime gameTime)
136136

137137
base.Update(gameTime);
138138
}
139-
}
139+
}

articles/tutorials/building_2d_games/16_working_with_spritefonts/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ Next, open the *04B_30.spritefont* file in your code editor and make the followi
210210

211211
The key changes here are:
212212

213-
1. The `<FontName>` element was updated to `04B_11.ttf`, the exact filename with extension of the TTF font we just downloaded.
213+
1. The `<FontName>` element was updated to `04B_30.ttf`, the exact filename with extension of the TTF font we just downloaded.
214214
2. The `<Size>` element was updated to be `17.5`.
215215

216216
### Updating the Game

articles/tutorials/building_2d_games/17_scenes/snippets/core.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,4 @@ private static void TransitionScene()
203203
s_activeScene.Initialize();
204204
}
205205
}
206-
}
206+
}

index.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ description: MonoGame Documentation Hub
77
<section class="container-xxl my-5">
88
<h1 id="monogame-documentation" class="fw-bold"><a href="#monogame-documentation">MonoGame Documentation</a></h1>
99
<p>
10-
Whether you are just starting out with MonoGame or you've been using it for years, you can find all documentation and
10+
Whether you are just starting out with MonoGame or you have been using it for years, you can find all documentation and
1111
tutorials here.
1212
</p>
1313
</section>
14-
<section class="container-xxl mb-5">
14+
<section class="container-xxl mb-5" >
1515
<div class="row">
1616
<div class="col-12 col-lg-4 mb-5">
1717
<div class="mg-card mg-box-shadow h-100">
@@ -44,6 +44,8 @@ description: MonoGame Documentation Hub
4444
</a>
4545
</div>
4646
</div>
47+
</div>
48+
<div class="row">
4749
<div class="col-12 col-lg-4 mb-5">
4850
<div class="mg-card mg-box-shadow h-100">
4951
<a target="_self"
@@ -60,6 +62,21 @@ description: MonoGame Documentation Hub
6062
</a>
6163
</div>
6264
</div>
65+
<div class="col-12 col-lg-4 mb-5">
66+
<div class="mg-card mg-box-shadow h-100">
67+
<a target="_self"
68+
href="/articles/samples.html"
69+
class="mg-no-link">
70+
<div class="mg-card-body d-flex flex-column h-100">
71+
<div class="mg-card-title"><i class="bi bi-arrow-down-circle"></i> Samples</div>
72+
<p>
73+
Check out the MonoGame samples collection, showcasing some awesome projects made with MonoGame.
74+
</p>
75+
<p class="mt-auto">Click to view samples</p>
76+
</div>
77+
</a>
78+
</div>
79+
</div>
6380
</div>
6481
</section>
6582
<section class="container-xxl mb-5">

0 commit comments

Comments
 (0)