bsnes/higan/video/sprite.cpp

21 lines
471 B
C++
Raw Normal View History

Update to v098r12 release. byuu says: Changelog: - higan/video: added support for Emulator::Sprite - higan/resource: a new system for accessing embedded binary files inside the emulation cores; holds the sprites - higan/sfc/superscope,justifier: re-enabled display of crosshairs - higan/sfc/superscope: fixed turbo toggle (also shows different crosshair color when in turbo mode) - higan/sfc/ppu: always outputs at 512x480 resolution now - causes a slight speed-hit from ~127fps to ~125fps; - but allows high-resolution 32x32 cursors that look way better; - also avoids the need to implement sprite scaling logic Right now, the PPU code to always output at 480-height is a really gross hack. Don't worry, I'll make that nicer before release. Also, superscope.cpp and justifier.cpp are built around a 256x240 screen. But since we now have 512x480, we can make the cursor's movement much smoother by doubling the resolution on both axes. The actual games won't see any accuracy improvements when firing the light guns, but the cursors will animate nicer so I think it's still worth it. I'll work on that before the next release as well. The current 32x32 cursors are nicer, but we can do better now with full 24-bit color. So feel free to submit alternatives. I'll probably reject them, but you can always try :D The sprites don't support alpha blending, just color keying (0x00000000 = transparent; anything else is 0xff......). We can revisit that later if necessary. The way I have it designed, the only files that do anything with Emulator::Sprite at all are the superscope and justifier folders. I didn't have to add any hooks anywhere else. Rendering the sprite is a lot cleaner than the old code, too.
2016-05-26 11:20:15 +00:00
Sprite::Sprite(uint width, uint height) : width(width), height(height) {
pixels = new uint32[width * height]();
}
Sprite::~Sprite() {
delete[] pixels;
}
auto Sprite::setPixels(const nall::image& image) -> void {
memory::copy(this->pixels, width * height * sizeof(uint32), image.data(), image.size());
}
auto Sprite::setVisible(bool visible) -> void {
this->visible = visible;
}
auto Sprite::setPosition(int x, int y) -> void {
this->x = x;
this->y = y;
}