make work
This commit is contained in:
parent
ee4b04c24d
commit
5f38a9d116
|
@ -134,7 +134,7 @@ func (r *Term) Run(ctx *Context) error {
|
||||||
g.ShowError(err.Error())
|
g.ShowError(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return g.Run()
|
return g.Run(conf)
|
||||||
}
|
}
|
||||||
func getImageFromFilePath(filePath string) (image.Image, error) {
|
func getImageFromFilePath(filePath string) (image.Image, error) {
|
||||||
f, err := os.Open(filePath)
|
f, err := os.Open(filePath)
|
||||||
|
|
|
@ -13,6 +13,8 @@ type Config struct {
|
||||||
Opacity float64 `json:"opacity"`
|
Opacity float64 `json:"opacity"`
|
||||||
Font Font `json:"font"`
|
Font Font `json:"font"`
|
||||||
Cursor Cursor `json:"cursor"`
|
Cursor Cursor `json:"cursor"`
|
||||||
|
|
||||||
|
Vsync bool `json:"vsync"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Font struct {
|
type Font struct {
|
||||||
|
|
|
@ -106,7 +106,7 @@ func (m *Manager) createFace(f *opentype.Font) (font.Face, error) {
|
||||||
return opentype.NewFace(f, &opentype.FaceOptions{
|
return opentype.NewFace(f, &opentype.FaceOptions{
|
||||||
Size: m.size,
|
Size: m.size,
|
||||||
DPI: m.dpi,
|
DPI: m.dpi,
|
||||||
Hinting: font.HintingFull,
|
Hinting: font.HintingNone,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/v2"
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
|
"tuxpa.in/t/erm/app/darktile/config"
|
||||||
"tuxpa.in/t/erm/app/darktile/font"
|
"tuxpa.in/t/erm/app/darktile/font"
|
||||||
"tuxpa.in/t/erm/app/darktile/gui/popup"
|
"tuxpa.in/t/erm/app/darktile/gui/popup"
|
||||||
"tuxpa.in/t/erm/app/darktile/hinters"
|
"tuxpa.in/t/erm/app/darktile/hinters"
|
||||||
|
@ -73,7 +74,7 @@ func New(terminal *termutil2.Terminal, options ...Option) (*GUI, error) {
|
||||||
return g, nil
|
return g, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GUI) Run() error {
|
func (g *GUI) Run(c *config.Config) error {
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if err := g.terminal.Run(g.updateChan, uint16(g.size.X), uint16(g.size.Y)); err != nil {
|
if err := g.terminal.Run(g.updateChan, uint16(g.size.X), uint16(g.size.Y)); err != nil {
|
||||||
|
@ -83,11 +84,17 @@ func (g *GUI) Run() error {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
ebiten.SetWindowTitle("darktile")
|
||||||
ebiten.SetScreenTransparent(true)
|
ebiten.SetScreenTransparent(true)
|
||||||
ebiten.SetScreenClearedEveryFrame(true)
|
ebiten.SetScreenClearedEveryFrame(true)
|
||||||
ebiten.SetWindowResizable(true)
|
ebiten.SetWindowResizable(true)
|
||||||
ebiten.SetRunnableOnUnfocused(true)
|
ebiten.SetRunnableOnUnfocused(true)
|
||||||
ebiten.SetFPSMode(ebiten.FPSModeVsyncOffMinimum)
|
ebiten.SetMaxTPS(120)
|
||||||
|
if c.Vsync {
|
||||||
|
ebiten.SetFPSMode(ebiten.FPSModeVsyncOn)
|
||||||
|
} else {
|
||||||
|
ebiten.SetFPSMode(ebiten.FPSModeVsyncOffMinimum)
|
||||||
|
}
|
||||||
|
|
||||||
for _, f := range g.startupFuncs {
|
for _, f := range g.startupFuncs {
|
||||||
go f(g)
|
go f(g)
|
||||||
|
|
Loading…
Reference in New Issue