foxygit / fake-08-xbox360 Log in
commit 5afb7f50a38494c61ca9a812c3d210c4798c9f18
Author:     jtothebell <j.to.the.bell@gmail.com>
AuthorDate: Sun Aug 23 11:34:37 2020 -0600
Commit:     jtothebell <j.to.the.bell@gmail.com>
CommitDate: Tue Sep 15 17:09:08 2020 -0600

    Set default clip in graphics constructor
---
 source/graphics.cpp    | 4 +++-
 test/graphicstests.cpp | 7 +++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/source/graphics.cpp b/source/graphics.cpp
index 9cb797d..8da35ab 100644
--- a/source/graphics.cpp
+++ b/source/graphics.cpp
@@ -24,7 +24,6 @@ Graphics::Graphics(std::string fontdata, PicoRam* memory) {

 	copy_string_to_sprite_memory(fontSpriteData, fontdata);

-
 	_paletteColors[0] = COLOR_00;
 	_paletteColors[1] = COLOR_01;
 	_paletteColors[2] = COLOR_02;
@@ -41,6 +40,9 @@ Graphics::Graphics(std::string fontdata, PicoRam* memory) {
 	_paletteColors[13] = COLOR_13;
 	_paletteColors[14] = COLOR_14;
 	_paletteColors[15] = COLOR_15;
+
+	//set default clip
+	clip();
 }


diff --git a/test/graphicstests.cpp b/test/graphicstests.cpp
index 9fd0c7c..735d2e2 100644
--- a/test/graphicstests.cpp
+++ b/test/graphicstests.cpp
@@ -55,6 +55,13 @@ TEST_CASE("graphics class behaves as expected") {
         testColor = {255, 204, 170, 255};
         CHECK(colorsEqual(& palette[15], & testColor) == true);
     }
+    SUBCASE("Constructor sets default clip") {
+        CHECK(picoRam._gfxState_clip_xb == 0);
+        CHECK(picoRam._gfxState_clip_yb == 0);
+        CHECK(picoRam._gfxState_clip_xe == 127);
+        CHECK(picoRam._gfxState_clip_ye == 127);
+    }
+    //check palette maps are set to default values

     //general teardown
     delete graphics;