mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-04-02 10:42:14 -04:00
byuu says: - bsnes: added video filters from bsnes v082 - bsnes: added ZSNES snow effect option when games paused or unloaded (no, I'm not joking) - bsnes: added 7-zip support (LZMA 19.00 SDK) [Recent higan WIPs have also mentioned bsnes changes, although the higan code no longer includes the bsnes code. These changes include: - higan, bsnes: added EXLOROM, EXLOROM-RAM, EXHIROM mappings - higan, bsnes: focus the viewport after leaving fullscreen exclusive mode - bsnes: re-added mightymo's cheat code database - bsnes: improved make install rules for the game and cheat code databases - bsnes: delayed construction of hiro::Window objects to properly show bsnes window icons - Ed.]
50 lines
1.6 KiB
C++
50 lines
1.6 KiB
C++
#if defined(Hiro_VerticalResizeGrip)
|
|
|
|
mVerticalResizeGrip::mVerticalResizeGrip() {
|
|
image icon;
|
|
icon.allocate(15, 5);
|
|
for(uint x : range(icon.width())) {
|
|
auto data = icon.data() + x * icon.stride();
|
|
icon.write(data, 0x00000000); data += icon.pitch();
|
|
icon.write(data, 0xff9f9f9f); data += icon.pitch();
|
|
icon.write(data, 0x00000000); data += icon.pitch();
|
|
icon.write(data, 0xff9f9f9f); data += icon.pitch();
|
|
icon.write(data, 0x00000000); data += icon.pitch();
|
|
}
|
|
mCanvas::setIcon(icon);
|
|
mCanvas::setMouseCursor(MouseCursor::VerticalResize);
|
|
mCanvas::onMousePress([&](auto button) {
|
|
if(button == Mouse::Button::Left && !state.timer.enabled()) {
|
|
doActivate();
|
|
state.offset = 0;
|
|
state.origin = Mouse::position();
|
|
state.timer.setEnabled();
|
|
}
|
|
});
|
|
state.timer.setInterval(10).onActivate([&] {
|
|
if(!Mouse::pressed(Mouse::Button::Left)) return (void)state.timer.setEnabled(false);
|
|
auto position = Mouse::position();
|
|
auto offset = position.y() - state.origin.y();
|
|
if(offset != state.offset) doResize(offset), offset = state.offset;
|
|
});
|
|
}
|
|
|
|
auto mVerticalResizeGrip::doActivate() const -> void {
|
|
if(state.onActivate) state.onActivate();
|
|
}
|
|
|
|
auto mVerticalResizeGrip::doResize(int offset) const -> void {
|
|
if(state.onResize) state.onResize(offset);
|
|
}
|
|
|
|
auto mVerticalResizeGrip::onActivate(const function<void ()>& callback) -> type& {
|
|
state.onActivate = callback;
|
|
return *this;
|
|
}
|
|
|
|
auto mVerticalResizeGrip::onResize(const function<void (int)>& callback) -> type& {
|
|
state.onResize = callback;
|
|
return *this;
|
|
}
|
|
|
|
#endif
|