2019-04-07 03:42:55 +02:00
|
|
|
// Copyright 2019 The Ebiten Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package driver
|
|
|
|
|
2019-04-07 03:54:05 +02:00
|
|
|
import (
|
|
|
|
"errors"
|
2019-04-07 03:42:55 +02:00
|
|
|
"image"
|
2019-04-07 03:54:05 +02:00
|
|
|
)
|
|
|
|
|
2019-04-09 05:21:37 +02:00
|
|
|
type UIContext interface {
|
2020-04-02 17:06:42 +02:00
|
|
|
Update() error
|
2020-03-31 19:55:48 +02:00
|
|
|
Draw() error
|
2019-12-09 18:37:10 +01:00
|
|
|
Layout(outsideWidth, outsideHeight float64)
|
|
|
|
AdjustPosition(x, y float64) (float64, float64)
|
2019-04-07 03:42:55 +02:00
|
|
|
}
|
2019-04-07 03:54:05 +02:00
|
|
|
|
|
|
|
// RegularTermination represents a regular termination.
|
|
|
|
// Run can return this error, and if this error is received,
|
|
|
|
// the game loop should be terminated as soon as possible.
|
|
|
|
var RegularTermination = errors.New("regular termination")
|
2019-04-07 03:42:55 +02:00
|
|
|
|
|
|
|
type UI interface {
|
2020-01-03 09:32:46 +01:00
|
|
|
Run(context UIContext) error
|
2020-02-11 15:19:43 +01:00
|
|
|
RunWithoutMainLoop(context UIContext)
|
2019-11-30 14:37:53 +01:00
|
|
|
|
2019-04-07 03:42:55 +02:00
|
|
|
DeviceScaleFactor() float64
|
2020-03-20 16:08:40 +01:00
|
|
|
IsFocused() bool
|
2019-04-07 03:42:55 +02:00
|
|
|
ScreenSizeInFullscreen() (int, int)
|
2020-04-02 17:06:42 +02:00
|
|
|
ResetForFrame()
|
2019-11-30 14:37:53 +01:00
|
|
|
|
2020-04-01 14:28:00 +02:00
|
|
|
CursorMode() CursorMode
|
2019-12-14 04:30:03 +01:00
|
|
|
SetCursorMode(mode CursorMode)
|
2020-04-01 14:28:00 +02:00
|
|
|
|
|
|
|
IsFullscreen() bool
|
2019-04-07 03:42:55 +02:00
|
|
|
SetFullscreen(fullscreen bool)
|
2020-04-01 14:28:00 +02:00
|
|
|
|
|
|
|
IsRunnableOnUnfocused() bool
|
2020-03-20 16:34:12 +01:00
|
|
|
SetRunnableOnUnfocused(runnableOnUnfocused bool)
|
2020-04-01 14:28:00 +02:00
|
|
|
|
|
|
|
IsVsyncEnabled() bool
|
2019-04-07 03:42:55 +02:00
|
|
|
SetVsyncEnabled(enabled bool)
|
2020-04-01 14:28:00 +02:00
|
|
|
|
|
|
|
IsScreenTransparent() bool
|
2019-11-30 16:07:41 +01:00
|
|
|
SetScreenTransparent(transparent bool)
|
2019-11-30 14:37:53 +01:00
|
|
|
|
2019-04-07 11:28:50 +02:00
|
|
|
Input() Input
|
2019-12-24 16:05:56 +01:00
|
|
|
Window() Window
|
2020-01-03 09:32:46 +01:00
|
|
|
Graphics() Graphics
|
2019-12-24 16:05:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type Window interface {
|
|
|
|
IsDecorated() bool
|
|
|
|
SetDecorated(decorated bool)
|
|
|
|
|
|
|
|
IsResizable() bool
|
|
|
|
SetResizable(resizable bool)
|
|
|
|
|
|
|
|
Position() (int, int)
|
|
|
|
SetPosition(x, y int)
|
|
|
|
|
|
|
|
Size() (int, int)
|
|
|
|
SetSize(width, height int)
|
|
|
|
|
2020-03-20 13:46:23 +01:00
|
|
|
IsFloating() bool
|
|
|
|
SetFloating(floating bool)
|
|
|
|
|
2020-03-21 11:26:28 +01:00
|
|
|
Maximize()
|
|
|
|
IsMaximized() bool
|
|
|
|
|
|
|
|
Minimize()
|
|
|
|
IsMinimized() bool
|
|
|
|
|
2019-12-24 16:05:56 +01:00
|
|
|
SetIcon(iconImages []image.Image)
|
|
|
|
SetTitle(title string)
|
2020-03-21 11:26:28 +01:00
|
|
|
Restore()
|
2019-04-07 03:42:55 +02:00
|
|
|
}
|