You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.2 KiB
68 lines
1.2 KiB
10 years ago
|
package mightypork.gamecore.gui.events;
|
||
10 years ago
|
|
||
10 years ago
|
|
||
10 years ago
|
import mightypork.gamecore.eventbus.BusEvent;
|
||
|
import mightypork.gamecore.eventbus.event_flags.NonConsumableEvent;
|
||
|
import mightypork.gamecore.util.math.constraints.vect.Vect;
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
/**
|
||
|
* Screen resolution or mode was changed
|
||
|
*
|
||
|
* @author MightyPork
|
||
|
*/
|
||
10 years ago
|
@NonConsumableEvent
|
||
|
public class ViewportChangeEvent extends BusEvent<ViewportChangeListener> {
|
||
10 years ago
|
|
||
10 years ago
|
private final boolean fullscreen;
|
||
10 years ago
|
private final Vect screenSize;
|
||
10 years ago
|
private final boolean fsChanged;
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
/**
|
||
|
* @param fsChanged fullscreen change triggered the event
|
||
|
* @param fullscreen is now fullscreen
|
||
|
* @param size new screen size
|
||
|
*/
|
||
10 years ago
|
public ViewportChangeEvent(boolean fsChanged, boolean fullscreen, Vect size)
|
||
|
{
|
||
10 years ago
|
this.fullscreen = fullscreen;
|
||
|
this.screenSize = size;
|
||
|
this.fsChanged = fsChanged;
|
||
|
}
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
/**
|
||
|
* @return true if screen is now fullscreen
|
||
|
*/
|
||
10 years ago
|
public boolean isFullscreen()
|
||
|
{
|
||
|
return fullscreen;
|
||
|
}
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
/**
|
||
|
* @return true if event was triggered by fullscreen toggle
|
||
|
*/
|
||
10 years ago
|
public boolean fullscreenChanged()
|
||
|
{
|
||
|
return fsChanged;
|
||
|
}
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
/**
|
||
|
* @return new screen size
|
||
|
*/
|
||
10 years ago
|
public Vect getScreenSize()
|
||
10 years ago
|
{
|
||
10 years ago
|
return screenSize;
|
||
10 years ago
|
}
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
@Override
|
||
10 years ago
|
public void handleBy(ViewportChangeListener handler)
|
||
10 years ago
|
{
|
||
10 years ago
|
handler.onViewportChanged(this);
|
||
10 years ago
|
}
|
||
|
}
|