vchelaru/flatredball2/content-and-assets
Claude Code and agent skill by vchelaru/flatredball2
- community
Checking that the SKILL.md file is still in the repository.
Content and Assets in FlatRedBall2. Use when working with loading textures, fonts, sprites, content pipeline, .mgcb setup, or ContentLoader. Also trigger when the user asks about displaying text (use Gum Labels) or graphics without custom art (use Shapes).
Install
npx vskill@latest install vchelaru/flatredball2/content-and-assetsSKILL.md
Content and Assets in FlatRedBall2
Decision: Shapes, Sprites, or Gum?
| Need | Use | Content files required? | |
|---|---|---|---|
| Simple geometry (paddles, walls, bullets) | Shapes (AARect, Circle, Polygon) | No | |
| Textured game objects (ships, characters) | Sprite with Texture2D | Yes (.mgcb pipeline) | |
| On-screen text (scores, labels, menus) | Gum Label or TextRuntime | No (default font auto-loaded) |
Text / Fonts — Use Gum Labels
Gum's default font is loaded automatically — no .mgcb setup required. See the gum-integration skill for Label examples and full layout details.
Graphics Without Art — Use Shapes
Shapes require no content files and are ready to use immediately.
See the shapes skill for all shape types and visual properties.
Sprites and Textures
Load textures via the XNA content pipeline (KNI) and render them with Sprite.
Loading a Texture
Load<Texture2D> routes on the presence of a file extension:
- Bare name → the xnb pipeline (requires a
.mgcbentry). Not hot-reloadable. - Path with extension → loaded directly from disk via
Texture2D.FromFile, tracked for hot-reload. Requires the file to be copied to the build output (see Content Pipeline Setup below or use a<Content Include="Content/*.png" CopyToOutputDirectory="PreserveNewest" />item).
Creating a Sprite
TextureScale vs Explicit Sizing
TextureScale (default 1f) controls how sprite dimensions are derived:
- Non-null (default) —
Width = textureWidth * TextureScale,Height = textureHeight * TextureScale. SettingWidth/Heightdirectly is a no-op whileTextureScaleis set. - Null — explicit mode. Set
TextureScale = nullfirst, then setWidth/Heightfreely.
Sprite Sheets (SourceRectangle)
Use SourceRectangle to render a sub-region of a texture:
When TextureScale is non-null, dimensions are recalculated from the source rectangle size.
Sprite Properties
| Property | Default | Notes | |
|---|---|---|---|
IsVisible | true | Shapes default to false; Sprite defaults to true | |
Color | Color.White | Tint color — White means no tint | |
Alpha | 1f | Opacity (0 = transparent, 1 = opaque) | |
Rotation | 0 | Uses Angle type, same as entities | |
FlipHorizontal | false | Mirror horizontally | |
FlipVertical | false | Mirror vertically |
Cleanup
Content Pipeline Setup (.mgcb)
To use textures, you need a Content/Content.mgcb file in your sample project.
Which project owns it? The flat samples/* layout keeps the .mgcb in the single game project (shown below). The frb2-desktop / frb2-multiplatform templates split into *.Common + *.Desktop: there the .mgcb and its pipeline source files live in the `.Desktop` head, because only the head runs the content builder, so a mgcb added to Common is silently never built. Common/Content holds raw, runtime-loaded assets (png-with-extension, tmx, achx, audio), which are linked into the head's output. See multiplatform-conversion.
The templates ship no .mgcb. To build XNBs, add nkast.Xna.Framework.Content.Pipeline.Builder and <KniContentReference Include="Content/Content.mgcb" /> to the head's .csproj; the builder does not find .mgcb files by itself. Output goes to Content/bin/DesktopGL/ and is copied beside the exe.
1. Create the Content directory and .mgcb file
Minimal .mgcb content:
2. Add a texture
Place the .png file in Content/, then add an entry to the .mgcb:
3. Load in code
Gotchas
- `IsVisible` defaults differ — Sprite defaults to
true; shapes default tofalse. ForgettingIsVisible = trueon a shape is a common source of invisible objects. - `TextureScale` wins over explicit `Width`/`Height` — If you set
Widthand it doesn't take effect, check thatTextureScaleisnull. - Content not found at runtime — Verify the asset name matches the
.mgcbentry (case-sensitive on Linux), and thatContent.RootDirectory = "Content"is set inGame1. - For sprite animation, see the
animationskill —Sprite.PlayAnimation,AnimationChainListSave, and.achxloading are fully implemented. - Each screen gets its own ContentLoader — assets are unloaded when the screen transitions. Re-load textures in each screen's
CustomInitializeif needed.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingfrb-skills/content-and-assets/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/vchelaru/flatredball2/content-and-assets)