mirror of
https://github.com/make-42/xyosc
synced 2024-11-22 17:20:09 +01:00
feat: various fixes
This commit is contained in:
parent
30694431e6
commit
63d987ff10
@ -19,7 +19,6 @@ type ConfigS struct {
|
||||
TargetFPS int32
|
||||
WindowWidth int32
|
||||
WindowHeight int32
|
||||
WindowOpacity float32
|
||||
CaptureDeviceIndex int
|
||||
SampleRate uint32
|
||||
RingBufferSize uint32
|
||||
@ -27,22 +26,23 @@ type ConfigS struct {
|
||||
Gain float32
|
||||
LineOpacity uint8
|
||||
LineThickness float32
|
||||
LineInvSqrtOpacityControl bool
|
||||
}
|
||||
|
||||
var DefaultConfig = ConfigS{
|
||||
FPSCounter: false,
|
||||
ShowMPRIS: true,
|
||||
TargetFPS: 60,
|
||||
WindowWidth: 1080,
|
||||
WindowHeight: 1080,
|
||||
WindowOpacity: 0.8,
|
||||
TargetFPS: 240,
|
||||
WindowWidth: 1300,
|
||||
WindowHeight: 1300,
|
||||
CaptureDeviceIndex: 0,
|
||||
SampleRate: 48000,
|
||||
RingBufferSize: 4800,
|
||||
ReadBufferSize: 4800,
|
||||
SampleRate: 96000,
|
||||
RingBufferSize: 9600,
|
||||
ReadBufferSize: 9600,
|
||||
Gain: 1,
|
||||
LineOpacity: 50,
|
||||
LineThickness: 2,
|
||||
LineOpacity: 100,
|
||||
LineThickness: 3,
|
||||
LineInvSqrtOpacityControl: false,
|
||||
}
|
||||
|
||||
var Config ConfigS
|
||||
|
BIN
icons/assets/icon-16-32.xcf
Normal file
BIN
icons/assets/icon-16-32.xcf
Normal file
Binary file not shown.
BIN
icons/assets/icon-16.png
Normal file
BIN
icons/assets/icon-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 864 B |
BIN
icons/assets/icon-32.png
Normal file
BIN
icons/assets/icon-32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 953 B |
BIN
icons/assets/icon-48.png
Normal file
BIN
icons/assets/icon-48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
BIN
icons/assets/icon-48.xcf
Normal file
BIN
icons/assets/icon-48.xcf
Normal file
Binary file not shown.
35
icons/icons.go
Normal file
35
icons/icons.go
Normal file
@ -0,0 +1,35 @@
|
||||
package icons
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"image"
|
||||
_ "image/png"
|
||||
"xyosc/utils"
|
||||
)
|
||||
|
||||
//go:embed assets/icon-48.png
|
||||
//go:embed assets/icon-16.png
|
||||
//go:embed assets/icon-32.png
|
||||
var fs embed.FS
|
||||
|
||||
var WindowIcon48 image.Image
|
||||
var WindowIcon32 image.Image
|
||||
var WindowIcon16 image.Image
|
||||
|
||||
func Init() {
|
||||
f48, err := fs.Open("assets/icon-48.png")
|
||||
utils.CheckError(err)
|
||||
defer f48.Close()
|
||||
WindowIcon48, _, err = image.Decode(f48)
|
||||
utils.CheckError(err)
|
||||
f32, err := fs.Open("assets/icon-32.png")
|
||||
utils.CheckError(err)
|
||||
defer f32.Close()
|
||||
WindowIcon32, _, err = image.Decode(f32)
|
||||
utils.CheckError(err)
|
||||
f16, err := fs.Open("assets/icon-16.png")
|
||||
utils.CheckError(err)
|
||||
defer f16.Close()
|
||||
WindowIcon16, _, err = image.Decode(f16)
|
||||
utils.CheckError(err)
|
||||
}
|
17
main.go
17
main.go
@ -2,10 +2,14 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"image"
|
||||
"image/color"
|
||||
"log"
|
||||
"xyosc/audio"
|
||||
"xyosc/config"
|
||||
"xyosc/fastsqrt"
|
||||
"xyosc/fonts"
|
||||
"xyosc/icons"
|
||||
"xyosc/media"
|
||||
|
||||
"fmt"
|
||||
@ -38,9 +42,15 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
||||
fAY := -float32(AY) * config.Config.Gain * float32(scale)
|
||||
fBX := float32(BX) * config.Config.Gain * float32(scale)
|
||||
fBY := -float32(BY) * config.Config.Gain * float32(scale)
|
||||
//inv := fastsqrt.FastInvSqrt32((fBX-fAX)*(fBX-fAX) + (fBY-fBY)*(fBY-fBY))
|
||||
//colorAdjusted := color.RGBA{config.AccentColor.R, config.AccentColor.G, config.AccentColor.B, uint8(255 * inv * config.Config.LineOpacity)}
|
||||
if config.Config.LineInvSqrtOpacityControl {
|
||||
|
||||
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)}
|
||||
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 {
|
||||
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)
|
||||
|
||||
}
|
||||
AX = BX
|
||||
AY = BY
|
||||
}
|
||||
@ -84,10 +94,13 @@ func main() {
|
||||
config.Init()
|
||||
audio.Init()
|
||||
fonts.Init()
|
||||
icons.Init()
|
||||
go audio.Start()
|
||||
go media.Start()
|
||||
ebiten.SetWindowIcon([]image.Image{icons.WindowIcon48, icons.WindowIcon32, icons.WindowIcon16})
|
||||
ebiten.SetWindowSize(int(config.Config.WindowWidth), int(config.Config.WindowHeight))
|
||||
ebiten.SetWindowTitle("xyosc")
|
||||
ebiten.SetWindowMousePassthrough(true)
|
||||
ebiten.SetTPS(int(config.Config.TargetFPS))
|
||||
ebiten.SetWindowDecorated(false)
|
||||
screenW, screenH := ebiten.Monitor().Size()
|
||||
|
Loading…
Reference in New Issue
Block a user