Remove "channel" from draws and clang format

This commit is contained in:
Pk11
2021-01-14 12:42:26 -06:00
parent e663a46a57
commit f3d001cecf
5 changed files with 22 additions and 20 deletions
+2 -4
View File
@@ -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
+3 -2
View File
@@ -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);
+4 -6
View File
@@ -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> screen) {
screens.push(std::move(screen));
}
void Graphics::setScreen(std::unique_ptr<Screen> screen) { screens.push(std::move(screen)); }
void Graphics::screenBack() {
if (screens.size() > 0)
if(screens.size() > 0)
screens.pop();
}
+4 -4
View File
@@ -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);
}
}
+9 -4
View File
@@ -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);
}