Overhauled event system
This commit is contained in:
+7
-24
@@ -14,17 +14,17 @@ import "github.com/jezek/xgbutil/xgraphics"
|
||||
import "git.tebibyte.media/sashakoshka/stone"
|
||||
|
||||
type Backend struct {
|
||||
application *stone.Application
|
||||
config *stone.Config
|
||||
connection *xgbutil.XUtil
|
||||
window *xwindow.Window
|
||||
canvas *xgraphics.Image
|
||||
channel chan(stone.Event)
|
||||
application *stone.Application
|
||||
config *stone.Config
|
||||
callbackManager *stone.CallbackManager
|
||||
connection *xgbutil.XUtil
|
||||
window *xwindow.Window
|
||||
canvas *xgraphics.Image
|
||||
|
||||
drawCellBounds bool
|
||||
drawBufferBounds bool
|
||||
|
||||
drawLock sync.Mutex
|
||||
lock sync.Mutex
|
||||
|
||||
font struct {
|
||||
face font.Face
|
||||
@@ -114,23 +114,6 @@ func (backend *Backend) calculateBufferSize () (width, height int) {
|
||||
return
|
||||
}
|
||||
|
||||
func (backend *Backend) reallocateCanvas () {
|
||||
if backend.canvas != nil {
|
||||
backend.canvas.Destroy()
|
||||
}
|
||||
backend.canvas = xgraphics.New (
|
||||
backend.connection,
|
||||
image.Rect (
|
||||
0, 0,
|
||||
backend.metrics.windowWidth,
|
||||
backend.metrics.windowHeight))
|
||||
backend.canvas.For (func (x, y int) xgraphics.BGRA {
|
||||
return backend.colors[stone.ColorBackground]
|
||||
})
|
||||
|
||||
backend.canvas.XSurfaceSet(backend.window.Id)
|
||||
}
|
||||
|
||||
func (backend *Backend) cellAt (onScreen image.Point) (x, y int) {
|
||||
x = (onScreen.X - backend.metrics.paddingX) / backend.metrics.cellWidth
|
||||
y = (onScreen.Y - backend.metrics.paddingY) / backend.metrics.cellHeight
|
||||
|
||||
Reference in New Issue
Block a user