mirror of
https://github.com/DarkStore-3DS/Universal-Core.git
synced 2026-07-06 08:49:06 +00:00
Remove "channel" from draws and clang format
This commit is contained in:
+2
-4
@@ -72,10 +72,9 @@ public:
|
|||||||
* @param y The Y position to draw at
|
* @param y The Y position to draw at
|
||||||
* @param top Whether to draw on teh top or bottom screen, not used for sprites
|
* @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 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
|
* @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
|
* @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 h The height to draw
|
||||||
* @param top Whether to draw on the top or bottom screen
|
* @param top Whether to draw on the top or bottom screen
|
||||||
* @param layer (Optional) Which background layer to draw on
|
* @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
|
* @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
|
* @brief Draws a segment of an image to a background layer, slower but can skip alpha, scale, and offset the palette
|
||||||
|
|||||||
+3
-2
@@ -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 i = 0; i < tileHeight; i++) {
|
||||||
for(int j = 0; j < tileWidth; j++) {
|
for(int j = 0; j < tileWidth; j++) {
|
||||||
u8 px = fontTiles[(index * tileSize) + (i * tileWidth + j) / 4] >>
|
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) {
|
if(px) {
|
||||||
#ifdef TEXT_BUFFERED
|
#ifdef TEXT_BUFFERED
|
||||||
dst[i * 256 + j] = px + (color * 4);
|
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 i = 0; i < tileHeight * scaleY; i++) {
|
||||||
for(int j = 0; j < tileWidth * scaleX; j++) {
|
for(int j = 0; j < tileWidth * scaleX; j++) {
|
||||||
u8 loc = int(i / scaleY) * tileWidth + int(j / scaleX);
|
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) {
|
if(px) {
|
||||||
#ifdef TEXT_BUFFERED
|
#ifdef TEXT_BUFFERED
|
||||||
dst[i * 256 + j] = px + (color * 4);
|
dst[i * 256 + j] = px + (color * 4);
|
||||||
|
|||||||
+4
-6
@@ -93,20 +93,18 @@ void Graphics::drawRectangle(int x, int y, int w, int h, u8 color1, u8 color2, b
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::drawScreen() {
|
void Graphics::drawScreen() {
|
||||||
if (!screens.empty())
|
if(!screens.empty())
|
||||||
screens.top()->Draw();
|
screens.top()->Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::screenLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void Graphics::screenLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (!screens.empty())
|
if(!screens.empty())
|
||||||
screens.top()->Logic(hDown, hHeld, touch);
|
screens.top()->Logic(hDown, hHeld, touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::setScreen(std::unique_ptr<Screen> screen) {
|
void Graphics::setScreen(std::unique_ptr<Screen> screen) { screens.push(std::move(screen)); }
|
||||||
screens.push(std::move(screen));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Graphics::screenBack() {
|
void Graphics::screenBack() {
|
||||||
if (screens.size() > 0)
|
if(screens.size() > 0)
|
||||||
screens.pop();
|
screens.pop();
|
||||||
}
|
}
|
||||||
+4
-4
@@ -84,7 +84,7 @@ Image::Image(FILE *file) {
|
|||||||
fclose(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)
|
if(copyPal)
|
||||||
tonccpy((top ? BG_PALETTE : BG_PALETTE_SUB) + _palOfs, _palette.data(), _palette.size() * 2);
|
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,
|
void Image::drawSegment(int x, int y, int imageX, int imageY, int w, int h, bool top, int layer, bool copyPal) {
|
||||||
bool copyPal) {
|
|
||||||
if(copyPal)
|
if(copyPal)
|
||||||
tonccpy((top ? BG_PALETTE : BG_PALETTE_SUB) + _palOfs, _palette.data(), _palette.size() * 2);
|
tonccpy((top ? BG_PALETTE : BG_PALETTE_SUB) + _palOfs, _palette.data(), _palette.size() * 2);
|
||||||
|
|
||||||
for(int i = 0; i < h; i++) {
|
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
@@ -98,8 +98,10 @@ Sprite::Sprite(bool top, SpriteSize size, SpriteColorFormat format, int x, int y
|
|||||||
vFlip, hFlip, mosaic);
|
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),
|
Sprite::Sprite(const Sprite &sprite)
|
||||||
_id(sprite._id), _rotationIndex(sprite._rotationIndex), _paletteAlpha(sprite._paletteAlpha), _visibility(sprite._visibility) {
|
: _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]++;
|
_assigned[_top][_id]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,7 +163,8 @@ void Sprite::drawImage(int x, int y, const Image &image, float scaleX, float sca
|
|||||||
} else {
|
} else {
|
||||||
for(int i = 0; i < image.height() * scaleY; i++) {
|
for(int i = 0; i < image.height() * scaleY; i++) {
|
||||||
for(int j = 0; j < image.width() * scaleX; j++) {
|
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)
|
if(px & 0x8000)
|
||||||
toncset16(_gfx + (y + i) * _height + j + x, px, 1);
|
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 {
|
} else {
|
||||||
for(int i = 0; i < h * scaleY; i++) {
|
for(int i = 0; i < h * scaleY; i++) {
|
||||||
for(int j = 0; j < w * scaleX; j++) {
|
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)
|
if(px & 0x8000)
|
||||||
toncset16(_gfx + (y + i) * _height + x + j, px, 1);
|
toncset16(_gfx + (y + i) * _height + x + j, px, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user