Skip to content

Commit

Permalink
"Static Sprite" sample (#52)
Browse files Browse the repository at this point in the history
This puts a ©️ character on the screen at 40,40.

Something isn't quite right, as the background color is wrong.

Then fixed with:

    if (UsedMethods is not null && UsedMethods.Contains(nameof(oam_spr)))
    {
        ByteArrayOffset += 44;
    }

This fixes the new sample! LOL!
  • Loading branch information
jonathanpeppers authored Sep 18, 2024
1 parent 42a71c7 commit ab52c03
Show file tree
Hide file tree
Showing 10 changed files with 606 additions and 0 deletions.
6 changes: 6 additions & 0 deletions samples/samples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "hello", "hello\hello.csproj
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "attributetable", "attributetable\attributetable.csproj", "{3764B6FE-87F1-4DAF-A6AB-460C67B97E66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "staticsprite", "staticsprite\staticsprite.csproj", "{904B645D-7F5E-4C34-9A37-DF224FB20AAC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +23,10 @@ Global
{3764B6FE-87F1-4DAF-A6AB-460C67B97E66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3764B6FE-87F1-4DAF-A6AB-460C67B97E66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3764B6FE-87F1-4DAF-A6AB-460C67B97E66}.Release|Any CPU.Build.0 = Release|Any CPU
{904B645D-7F5E-4C34-9A37-DF224FB20AAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{904B645D-7F5E-4C34-9A37-DF224FB20AAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{904B645D-7F5E-4C34-9A37-DF224FB20AAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{904B645D-7F5E-4C34-9A37-DF224FB20AAC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
19 changes: 19 additions & 0 deletions samples/staticsprite/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
byte[] PALETTE = new byte[32] {
0x01, // screen color

0x11,0x30,0x27,0x0, // background palette 0
0x1c,0x20,0x2c,0x0, // background palette 1
0x00,0x10,0x20,0x0, // background palette 2
0x06,0x16,0x26,0x0, // background palette 3

0x16,0x35,0x24,0x0, // sprite palette 0
0x00,0x37,0x25,0x0, // sprite palette 1
0x0d,0x2d,0x3a,0x0, // sprite palette 2
0x0d,0x27,0x2a // sprite palette 3
};

pal_all(PALETTE);
oam_spr(40, 40, 0x10, 3, 0);
ppu_on_all();

while (true) ;
Loading

0 comments on commit ab52c03

Please sign in to comment.