mirror of
https://github.com/make-42/xyosc
synced 2024-11-23 01:30:09 +01:00
feat: various fixes
This commit is contained in:
parent
63d987ff10
commit
53022419cf
@ -16,6 +16,7 @@ import (
|
|||||||
type ConfigS struct {
|
type ConfigS struct {
|
||||||
FPSCounter bool
|
FPSCounter bool
|
||||||
ShowMPRIS bool
|
ShowMPRIS bool
|
||||||
|
MPRISTextOpacity uint8
|
||||||
TargetFPS int32
|
TargetFPS int32
|
||||||
WindowWidth int32
|
WindowWidth int32
|
||||||
WindowHeight int32
|
WindowHeight int32
|
||||||
@ -25,6 +26,7 @@ type ConfigS struct {
|
|||||||
ReadBufferSize uint32
|
ReadBufferSize uint32
|
||||||
Gain float32
|
Gain float32
|
||||||
LineOpacity uint8
|
LineOpacity uint8
|
||||||
|
LineBrightness float64
|
||||||
LineThickness float32
|
LineThickness float32
|
||||||
LineInvSqrtOpacityControl bool
|
LineInvSqrtOpacityControl bool
|
||||||
}
|
}
|
||||||
@ -32,6 +34,7 @@ type ConfigS struct {
|
|||||||
var DefaultConfig = ConfigS{
|
var DefaultConfig = ConfigS{
|
||||||
FPSCounter: false,
|
FPSCounter: false,
|
||||||
ShowMPRIS: true,
|
ShowMPRIS: true,
|
||||||
|
MPRISTextOpacity: 255,
|
||||||
TargetFPS: 240,
|
TargetFPS: 240,
|
||||||
WindowWidth: 1300,
|
WindowWidth: 1300,
|
||||||
WindowHeight: 1300,
|
WindowHeight: 1300,
|
||||||
@ -40,7 +43,8 @@ var DefaultConfig = ConfigS{
|
|||||||
RingBufferSize: 9600,
|
RingBufferSize: 9600,
|
||||||
ReadBufferSize: 9600,
|
ReadBufferSize: 9600,
|
||||||
Gain: 1,
|
Gain: 1,
|
||||||
LineOpacity: 100,
|
LineOpacity: 200,
|
||||||
|
LineBrightness: 1,
|
||||||
LineThickness: 3,
|
LineThickness: 3,
|
||||||
LineInvSqrtOpacityControl: false,
|
LineInvSqrtOpacityControl: false,
|
||||||
}
|
}
|
||||||
@ -50,6 +54,7 @@ var Config ConfigS
|
|||||||
var AccentColor color.RGBA
|
var AccentColor color.RGBA
|
||||||
var FirstColor color.RGBA
|
var FirstColor color.RGBA
|
||||||
var ThirdColor color.RGBA
|
var ThirdColor color.RGBA
|
||||||
|
var ThirdColorAdj color.RGBA
|
||||||
|
|
||||||
var watcher *fsnotify.Watcher
|
var watcher *fsnotify.Watcher
|
||||||
|
|
||||||
@ -119,6 +124,7 @@ func updatePywalColors() {
|
|||||||
AccentColor = color.RGBA{255, 0, 0, Config.LineOpacity}
|
AccentColor = color.RGBA{255, 0, 0, Config.LineOpacity}
|
||||||
FirstColor = color.RGBA{255, 120, 120, Config.LineOpacity}
|
FirstColor = color.RGBA{255, 120, 120, Config.LineOpacity}
|
||||||
ThirdColor = color.RGBA{255, 0, 0, Config.LineOpacity}
|
ThirdColor = color.RGBA{255, 0, 0, Config.LineOpacity}
|
||||||
|
ThirdColorAdj = color.RGBA{uint8(255 * Config.LineBrightness), 0, 0, Config.LineOpacity}
|
||||||
} else {
|
} else {
|
||||||
fh, err := os.Open(walFile)
|
fh, err := os.Open(walFile)
|
||||||
utils.CheckError(err)
|
utils.CheckError(err)
|
||||||
@ -141,6 +147,7 @@ func updatePywalColors() {
|
|||||||
rgbaColor, err = ParseHexColor(scanner.Text())
|
rgbaColor, err = ParseHexColor(scanner.Text())
|
||||||
utils.CheckError(err)
|
utils.CheckError(err)
|
||||||
ThirdColor = color.RGBA{rgbaColor.R, rgbaColor.G, rgbaColor.B, Config.LineOpacity}
|
ThirdColor = color.RGBA{rgbaColor.R, rgbaColor.G, rgbaColor.B, Config.LineOpacity}
|
||||||
|
ThirdColorAdj = color.RGBA{uint8(float64(rgbaColor.R) * Config.LineBrightness), uint8(float64(rgbaColor.G) * Config.LineBrightness), uint8(float64(rgbaColor.B) * Config.LineBrightness), Config.LineOpacity}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
line++
|
line++
|
||||||
|
12
main.go
12
main.go
@ -45,10 +45,10 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
if config.Config.LineInvSqrtOpacityControl {
|
if config.Config.LineInvSqrtOpacityControl {
|
||||||
|
|
||||||
inv := fastsqrt.FastInvSqrt32((fBX-fAX)*(fBX-fAX) + (fBY-fBY)*(fBY-fBY))
|
inv := fastsqrt.FastInvSqrt32((fBX-fAX)*(fBX-fAX) + (fBY-fBY)*(fBY-fBY))
|
||||||
colorAdjusted := color.RGBA{config.AccentColor.R, config.AccentColor.G, config.AccentColor.B, uint8(float32(config.Config.LineOpacity) * inv)}
|
colorAdjusted := color.RGBA{config.ThirdColor.R, config.ThirdColor.G, config.ThirdColor.B, uint8(float32(config.Config.LineOpacity) * inv)}
|
||||||
vector.StrokeLine(screen, float32(config.Config.WindowWidth/2)+fAX, float32(config.Config.WindowWidth/2)+fAY, float32(config.Config.WindowWidth/2)+fBX, float32(config.Config.WindowWidth/2)+fBY, config.Config.LineThickness, colorAdjusted, true)
|
vector.StrokeLine(screen, float32(config.Config.WindowWidth/2)+fAX, float32(config.Config.WindowWidth/2)+fAY, float32(config.Config.WindowWidth/2)+fBX, float32(config.Config.WindowWidth/2)+fBY, config.Config.LineThickness, colorAdjusted, true)
|
||||||
} else {
|
} else {
|
||||||
vector.StrokeLine(screen, float32(config.Config.WindowWidth/2)+fAX, float32(config.Config.WindowWidth/2)+fAY, float32(config.Config.WindowWidth/2)+fBX, float32(config.Config.WindowWidth/2)+fBY, config.Config.LineThickness, config.AccentColor, true)
|
vector.StrokeLine(screen, float32(config.Config.WindowWidth/2)+fAX, float32(config.Config.WindowWidth/2)+fAY, float32(config.Config.WindowWidth/2)+fBX, float32(config.Config.WindowWidth/2)+fBY, config.Config.LineThickness, config.ThirdColorAdj, true)
|
||||||
|
|
||||||
}
|
}
|
||||||
AX = BX
|
AX = BX
|
||||||
@ -62,7 +62,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
if config.Config.ShowMPRIS {
|
if config.Config.ShowMPRIS {
|
||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(16, 16)
|
op.GeoM.Translate(16, 16)
|
||||||
op.ColorScale.ScaleWithColor(config.AccentColor)
|
op.ColorScale.ScaleWithColor(color.RGBA{config.AccentColor.R, config.AccentColor.G, config.AccentColor.B, config.Config.MPRISTextOpacity})
|
||||||
text.Draw(screen, media.PlayingMediaInfo.Artist+" - "+media.PlayingMediaInfo.Title, &text.GoTextFace{
|
text.Draw(screen, media.PlayingMediaInfo.Artist+" - "+media.PlayingMediaInfo.Title, &text.GoTextFace{
|
||||||
Source: fonts.Font,
|
Source: fonts.Font,
|
||||||
Size: 32,
|
Size: 32,
|
||||||
@ -70,7 +70,8 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
|
|
||||||
op = &text.DrawOptions{}
|
op = &text.DrawOptions{}
|
||||||
op.GeoM.Translate(16, 64)
|
op.GeoM.Translate(16, 64)
|
||||||
op.ColorScale.ScaleWithColor(config.ThirdColor)
|
op.ColorScale.ScaleWithColor(color.RGBA{config.ThirdColor.R, config.ThirdColor.G, config.ThirdColor.B, config.Config.MPRISTextOpacity})
|
||||||
|
|
||||||
text.Draw(screen, media.PlayingMediaInfo.Album, &text.GoTextFace{
|
text.Draw(screen, media.PlayingMediaInfo.Album, &text.GoTextFace{
|
||||||
Source: fonts.Font,
|
Source: fonts.Font,
|
||||||
Size: 16,
|
Size: 16,
|
||||||
@ -78,7 +79,8 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
|
|
||||||
op = &text.DrawOptions{}
|
op = &text.DrawOptions{}
|
||||||
op.GeoM.Translate(16, 80)
|
op.GeoM.Translate(16, 80)
|
||||||
op.ColorScale.ScaleWithColor(config.AccentColor)
|
op.ColorScale.ScaleWithColor(color.RGBA{config.AccentColor.R, config.AccentColor.G, config.AccentColor.B, config.Config.MPRISTextOpacity})
|
||||||
|
|
||||||
text.Draw(screen, media.FmtDuration(media.PlayingMediaInfo.Position)+" / "+media.FmtDuration(media.PlayingMediaInfo.Duration), &text.GoTextFace{
|
text.Draw(screen, media.FmtDuration(media.PlayingMediaInfo.Position)+" / "+media.FmtDuration(media.PlayingMediaInfo.Duration), &text.GoTextFace{
|
||||||
Source: fonts.Font,
|
Source: fonts.Font,
|
||||||
Size: 32,
|
Size: 32,
|
||||||
|
Loading…
Reference in New Issue
Block a user