redo-event-system #1
@ -1,6 +1,5 @@
 | 
			
		||||
package stone
 | 
			
		||||
 | 
			
		||||
import "time"
 | 
			
		||||
import "image/color"
 | 
			
		||||
 | 
			
		||||
// Application represents an application.
 | 
			
		||||
@ -12,12 +11,6 @@ type Application struct {
 | 
			
		||||
	config Config
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SetSize sets the application's buffer size. This may or may not change the
 | 
			
		||||
// size of the window, depending on the backend used.
 | 
			
		||||
func (application *Application) SetSize (width, height int) {
 | 
			
		||||
	application.DamageBuffer.SetSize(width, height)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SetTitle sets the application's title. If in a window, it will appear as the
 | 
			
		||||
// window's name.
 | 
			
		||||
func (application *Application) SetTitle (title string) {
 | 
			
		||||
@ -55,68 +48,3 @@ func (application *Application) Run (
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Await blocks until an event is recieved, or until the specified timeout has
 | 
			
		||||
// elapsed. If the timeout is zero, it will wait forever. This function returns
 | 
			
		||||
// true if the backend is still active, and false if it has closed.
 | 
			
		||||
func (application *Application) Await (timeout time.Duration) (keepRunning bool) {
 | 
			
		||||
	keepRunning = application.backend.Await(timeout)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Poll updates the window and checks for new events. This function returns true
 | 
			
		||||
// if the backend is still active, and false if it has closed.
 | 
			
		||||
func (application *Application) Poll () (keepRunning bool) {
 | 
			
		||||
	keepRunning = application.backend.Poll()
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Title returns the application's title.
 | 
			
		||||
func (application *Application) Title () (title string) {
 | 
			
		||||
	title = application.title
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Config returns a pointer to the application's configuration.
 | 
			
		||||
func (application *Application) Config () (config *Config) {
 | 
			
		||||
	config = &application.config
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// JustPressed returns true if the specified button is pressed, but was not
 | 
			
		||||
// pressed the last time events were checked.
 | 
			
		||||
func (application *Application) JustPressed (button Button) (pressed  bool) {
 | 
			
		||||
	pressed = application.backend.JustPressed(button)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// JustReleased returns true if the specified button
 | 
			
		||||
func (application *Application) JustReleased (button Button) (released bool) {
 | 
			
		||||
	released = application.backend.JustReleased(button)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (application *Application) Pressed (button Button) (pressed  bool) {
 | 
			
		||||
	pressed = application.backend.Pressed(button)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (application *Application) Repeated (button Button) (repeated bool) {
 | 
			
		||||
	repeated = application.backend.Repeated(button)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (application *Application) Typed () (text string) {
 | 
			
		||||
	text = application.backend.Typed()
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (application *Application) Resized () (resized bool) {
 | 
			
		||||
	resized = application.backend.Resized()
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (application *Application) MousePosition () (x, y int) {
 | 
			
		||||
	x, y = application.backend.MousePosition()
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user