From f3d001cecf6d9e324fea18c10bd107712106711e Mon Sep 17 00:00:00 2001 From: Pk11 Date: Thu, 14 Jan 2021 12:42:26 -0600 Subject: [PATCH] Remove "channel" from draws and clang format --- include/image.hpp | 6 ++---- source/font.cpp | 5 +++-- source/graphics.cpp | 10 ++++------ source/image.cpp | 8 ++++---- source/sprite.cpp | 13 +++++++++---- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/include/image.hpp b/include/image.hpp index 54ced8a..91954b6 100644 --- a/include/image.hpp +++ b/include/image.hpp @@ -72,10 +72,9 @@ public: * @param y The Y position to draw at * @param top Whether to draw on teh top or bottom screen, not used for sprites * @param layer (Optional) The layer to draw on, not used for sprites - * @param channel (Optional) The DMA channel to use * @param copyPal (Optional) Whether to copy the image's palette into palette VRAM */ - void draw(int x, int y, bool top, int layer = 3, int channel = 0, bool copyPal = true); + void draw(int x, int y, bool top, int layer = 3, bool copyPal = true); /** * @brief Draws the image to a background layer, slower but can skip alpha, scale, and offset the palette @@ -100,10 +99,9 @@ public: * @param h The height to draw * @param top Whether to draw on the top or bottom screen * @param layer (Optional) Which background layer to draw on - * @param channel (Optional) The DMA channel to use * @param copyPal (Optional) Whether to copy the image's palette into palette VRAM */ - void drawSegment(int x, int y, int imageX, int imageY, int w, int h, bool top, int layer = 3, int channel = 0, bool copyPal = true); + void drawSegment(int x, int y, int imageX, int imageY, int w, int h, bool top, int layer = 3, bool copyPal = true); /** * @brief Draws a segment of an image to a background layer, slower but can skip alpha, scale, and offset the palette diff --git a/source/font.cpp b/source/font.cpp index 63fb1ed..3d31bc9 100644 --- a/source/font.cpp +++ b/source/font.cpp @@ -334,7 +334,8 @@ ITCM_CODE void Font::print(std::u16string_view text, int x, int y, bool top, int for(int i = 0; i < tileHeight; i++) { for(int j = 0; j < tileWidth; j++) { u8 px = fontTiles[(index * tileSize) + (i * tileWidth + j) / 4] >> - ((3 - ((i * tileWidth + j) % 4)) * 2) & 3; + ((3 - ((i * tileWidth + j) % 4)) * 2) & + 3; if(px) { #ifdef TEXT_BUFFERED dst[i * 256 + j] = px + (color * 4); @@ -348,7 +349,7 @@ ITCM_CODE void Font::print(std::u16string_view text, int x, int y, bool top, int for(int i = 0; i < tileHeight * scaleY; i++) { for(int j = 0; j < tileWidth * scaleX; j++) { u8 loc = int(i / scaleY) * tileWidth + int(j / scaleX); - u8 px = fontTiles[index * tileSize + loc / 4] >> ((3 - (loc % 4)) * 2) & 3; + u8 px = fontTiles[index * tileSize + loc / 4] >> ((3 - (loc % 4)) * 2) & 3; if(px) { #ifdef TEXT_BUFFERED dst[i * 256 + j] = px + (color * 4); diff --git a/source/graphics.cpp b/source/graphics.cpp index eec6c9d..ce6393b 100644 --- a/source/graphics.cpp +++ b/source/graphics.cpp @@ -93,20 +93,18 @@ void Graphics::drawRectangle(int x, int y, int w, int h, u8 color1, u8 color2, b } void Graphics::drawScreen() { - if (!screens.empty()) + if(!screens.empty()) screens.top()->Draw(); } void Graphics::screenLogic(u32 hDown, u32 hHeld, touchPosition touch) { - if (!screens.empty()) + if(!screens.empty()) screens.top()->Logic(hDown, hHeld, touch); } -void Graphics::setScreen(std::unique_ptr screen) { - screens.push(std::move(screen)); -} +void Graphics::setScreen(std::unique_ptr screen) { screens.push(std::move(screen)); } void Graphics::screenBack() { - if (screens.size() > 0) + if(screens.size() > 0) screens.pop(); } \ No newline at end of file diff --git a/source/image.cpp b/source/image.cpp index c2713fb..ceebf64 100644 --- a/source/image.cpp +++ b/source/image.cpp @@ -84,7 +84,7 @@ Image::Image(FILE *file) { fclose(file); } -void Image::draw(int x, int y, bool top, int layer, int channel, bool copyPal) { +void Image::draw(int x, int y, bool top, int layer, bool copyPal) { if(copyPal) tonccpy((top ? BG_PALETTE : BG_PALETTE_SUB) + _palOfs, _palette.data(), _palette.size() * 2); @@ -128,13 +128,13 @@ void Image::drawSpecial(int x, int y, bool top, int layer, float scaleX, float s } } -void Image::drawSegment(int x, int y, int imageX, int imageY, int w, int h, bool top, int layer, int channel, - bool copyPal) { +void Image::drawSegment(int x, int y, int imageX, int imageY, int w, int h, bool top, int layer, bool copyPal) { if(copyPal) tonccpy((top ? BG_PALETTE : BG_PALETTE_SUB) + _palOfs, _palette.data(), _palette.size() * 2); for(int i = 0; i < h; i++) { - tonccpy((u8 *)bgGetGfxPtr(top ? layer : layer + 4) + (y + i) * 256 + x, _bitmap.data() + (imageY + i) * _width + imageX, w); + tonccpy((u8 *)bgGetGfxPtr(top ? layer : layer + 4) + (y + i) * 256 + x, + _bitmap.data() + (imageY + i) * _width + imageX, w); } } diff --git a/source/sprite.cpp b/source/sprite.cpp index f08146e..fbce45c 100644 --- a/source/sprite.cpp +++ b/source/sprite.cpp @@ -98,8 +98,10 @@ Sprite::Sprite(bool top, SpriteSize size, SpriteColorFormat format, int x, int y vFlip, hFlip, mosaic); } -Sprite::Sprite(const Sprite &sprite) : _top(sprite._top), _oam(sprite._oam), _size(sprite._size), _format(sprite._format), _x(sprite._x), _y(sprite._y), _priority(sprite._priority), - _id(sprite._id), _rotationIndex(sprite._rotationIndex), _paletteAlpha(sprite._paletteAlpha), _visibility(sprite._visibility) { +Sprite::Sprite(const Sprite &sprite) + : _top(sprite._top), _oam(sprite._oam), _size(sprite._size), _format(sprite._format), _x(sprite._x), _y(sprite._y), + _priority(sprite._priority), _id(sprite._id), _rotationIndex(sprite._rotationIndex), + _paletteAlpha(sprite._paletteAlpha), _visibility(sprite._visibility) { _assigned[_top][_id]++; } @@ -161,7 +163,8 @@ void Sprite::drawImage(int x, int y, const Image &image, float scaleX, float sca } else { for(int i = 0; i < image.height() * scaleY; i++) { for(int j = 0; j < image.width() * scaleX; j++) { - u16 px = image.palette()[image.bitmap()[int(i / scaleY) * image.width() + int(j / scaleX)] - image.palOfs()]; + u16 px = + image.palette()[image.bitmap()[int(i / scaleY) * image.width() + int(j / scaleX)] - image.palOfs()]; if(px & 0x8000) toncset16(_gfx + (y + i) * _height + j + x, px, 1); } @@ -183,7 +186,9 @@ void Sprite::drawImageSegment(int x, int y, int imageX, int imageY, int w, int h } else { for(int i = 0; i < h * scaleY; i++) { for(int j = 0; j < w * scaleX; j++) { - u16 px = image.palette()[image.bitmap()[(imageY + int(i / scaleY)) * image.width() + imageX + int(j / scaleX)] - image.palOfs()]; + u16 px = image.palette()[image.bitmap()[(imageY + int(i / scaleY)) * image.width() + imageX + + int(j / scaleX)] - + image.palOfs()]; if(px & 0x8000) toncset16(_gfx + (y + i) * _height + x + j, px, 1); }