make work

This commit is contained in:
a 2023-01-16 00:32:17 -06:00
parent ee4b04c24d
commit 5f38a9d116
5 changed files with 13 additions and 4 deletions

0
a.out Normal file
View File

View File

@ -134,7 +134,7 @@ func (r *Term) Run(ctx *Context) error {
g.ShowError(err.Error())
}
return g.Run()
return g.Run(conf)
}
func getImageFromFilePath(filePath string) (image.Image, error) {
f, err := os.Open(filePath)

View File

@ -13,6 +13,8 @@ type Config struct {
Opacity float64 `json:"opacity"`
Font Font `json:"font"`
Cursor Cursor `json:"cursor"`
Vsync bool `json:"vsync"`
}
type Font struct {

View File

@ -106,7 +106,7 @@ func (m *Manager) createFace(f *opentype.Font) (font.Face, error) {
return opentype.NewFace(f, &opentype.FaceOptions{
Size: m.size,
DPI: m.dpi,
Hinting: font.HintingFull,
Hinting: font.HintingNone,
})
}

View File

@ -9,6 +9,7 @@ import (
"time"
"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/gui/popup"
"tuxpa.in/t/erm/app/darktile/hinters"
@ -73,7 +74,7 @@ func New(terminal *termutil2.Terminal, options ...Option) (*GUI, error) {
return g, nil
}
func (g *GUI) Run() error {
func (g *GUI) Run(c *config.Config) error {
go func() {
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)
}()
ebiten.SetWindowTitle("darktile")
ebiten.SetScreenTransparent(true)
ebiten.SetScreenClearedEveryFrame(true)
ebiten.SetWindowResizable(true)
ebiten.SetRunnableOnUnfocused(true)
ebiten.SetMaxTPS(120)
if c.Vsync {
ebiten.SetFPSMode(ebiten.FPSModeVsyncOn)
} else {
ebiten.SetFPSMode(ebiten.FPSModeVsyncOffMinimum)
}
for _, f := range g.startupFuncs {
go f(g)