-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wip] tests/pong-mode0: Add mode 0 pong example
- Loading branch information
Showing
16 changed files
with
708 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
#include <libgba-cpp/arch/display/objects.h> | ||
#include <libgba-cpp/arch/display/tilemap.h> | ||
|
||
using gba::display::Color; | ||
using gba::display::RawPalette; | ||
|
||
namespace { | ||
|
||
static auto const obj_palette_address = reinterpret_cast<RawPalette<256>*>(0x0500'0200); | ||
static auto& obj_palette = | ||
*new (obj_palette_address) RawPalette<256>{}; | ||
static auto const obj_palette_address = | ||
reinterpret_cast<RawPalette<256>*>(0x0500'0200); | ||
static auto& obj_palette = *new (obj_palette_address) RawPalette<256>{}; | ||
|
||
} | ||
static auto& oam = *new (reinterpret_cast<void*>(0x0700'0000)) | ||
std::array<gba::display::OAMEntry, 128>{}; | ||
static auto& sprite_tiles = *new (reinterpret_cast<void*>(0x0601'0000)) std::array<gba::display::map::Tile, 256>{}; | ||
// auto oam_map = array<pair<optional<Sprite&>, int>, 128>{}; | ||
|
||
namespace gba { | ||
} // namespace | ||
|
||
RawPalette<256>& display::obj_palette() { | ||
auto gba::display::obj_palette() -> RawPalette<256>& { | ||
return ::obj_palette; | ||
} | ||
|
||
auto gba::display::oam_entry(int index) -> OAMEntry& { | ||
return ::oam[index]; | ||
} | ||
|
||
auto gba::display::sprite_tile(int index) -> gba::display::map::Tile& { | ||
return sprite_tiles[index]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.