2020-05-08 16:38:26 +00:00
|
|
|
package tins2020
|
|
|
|
|
2020-05-17 08:56:56 +00:00
|
|
|
// import (
|
|
|
|
// rice "github.com/GeertJohan/go.rice"
|
|
|
|
// "github.com/veandco/go-sdl2/sdl"
|
|
|
|
// )
|
2020-05-08 16:38:26 +00:00
|
|
|
|
2020-05-17 08:56:56 +00:00
|
|
|
// type Context struct {
|
|
|
|
// Renderer *sdl.Renderer
|
|
|
|
// Fonts Fonts
|
|
|
|
// Resources Resources
|
|
|
|
// Textures Textures
|
|
|
|
// Settings Settings
|
|
|
|
// MousePosition geom.Point
|
|
|
|
// ShouldQuit bool
|
|
|
|
// }
|
2020-05-08 16:38:26 +00:00
|
|
|
|
2020-05-17 08:56:56 +00:00
|
|
|
// func NewContext(res *rice.Box) (ui.Context, error) {
|
|
|
|
// ctx := &Context{}
|
|
|
|
// err := ctx.Settings.Init()
|
|
|
|
// if err != nil {
|
|
|
|
// return nil, err
|
|
|
|
// }
|
|
|
|
// err = ctx.Resources.Open(res)
|
|
|
|
// if err != nil {
|
|
|
|
// return nil, err
|
|
|
|
// }
|
|
|
|
// return ctx, nil
|
|
|
|
// }
|
2020-05-08 16:38:26 +00:00
|
|
|
|
2020-05-17 08:56:56 +00:00
|
|
|
// func (c ui.Context) Destroy() {
|
|
|
|
// c.Fonts.Destroy()
|
|
|
|
// c.Resources.Destroy()
|
|
|
|
// c.Textures.Destroy()
|
|
|
|
// c.Settings.Store()
|
|
|
|
// }
|
2020-05-09 11:55:37 +00:00
|
|
|
|
2020-05-17 08:56:56 +00:00
|
|
|
// func (c ui.Context) Init(renderer *sdl.Renderer) {
|
|
|
|
// c.Renderer = renderer
|
|
|
|
// c.Fonts.Init(c.Resources.Copy())
|
|
|
|
// c.Textures.Init(renderer, c.Resources.Copy())
|
2020-05-09 20:50:11 +00:00
|
|
|
|
2020-05-17 08:56:56 +00:00
|
|
|
// c.Renderer.SetDrawBlendMode(sdl.BLENDMODE_BLEND)
|
|
|
|
// }
|
2020-05-09 11:55:37 +00:00
|
|
|
|
2020-05-17 08:56:56 +00:00
|
|
|
// func (c ui.Context) Quit() { c.ShouldQuit = true }
|