package main import ( "log" "net/http" "os" "fyne.io/fyne/v2" "fyne.io/fyne/v2/app" "fyne.io/fyne/v2/theme" "g.r-io.lu/shynd/kemoforge/data/assets" "g.r-io.lu/shynd/kemoforge/internal/KFEditor" "g.r-io.lu/shynd/kemoforge/pkg/KFData/KFLog" _ "net/http/pprof" ) const ( Version = "0.0.1" Author = "Shynd" ) var WindowTitle = "KemoForge" + " | " + Version func main() { // start the profiler (located at http://localhost:6060/debug/pprof/) go func() { log.Println(http.ListenAndServe("localhost:6060", nil)) }() // create a new application and window with the title based on the version a := app.NewWithID("com.kemoforge.editor") // load the embedded icons/editorpng as bytes // TODO iconBytes, err := assets.EditorPng.ReadFile("icons/editor.png") if err != nil { // if the icon fails to load, log the error and set the icon to the default application icon log.Printf("failed to load icon: %v", err) a.SetIcon(theme.FileApplicationIcon()) } else { // if the icon loads successfully, set the icon to the loaded icon after converting it to a StaticResource iconResource := fyne.NewStaticResource("editor.png", iconBytes) a.SetIcon(iconResource) } w := a.NewWindow(WindowTitle) // use common 720p resolution for base window size w.Resize(fyne.NewSize(1280, 720)) userHome, err := os.UserConfigDir() if err != nil { log.Fatal(err) } err = KFLog.Setup(w, a.Preferences().StringWithFallback("logDir", userHome+"/KemoForge/Logs")) if err != nil { log.Fatal(err) } KFEditor.CreateMainContent(w) log.Printf("showing main window") w.ShowAndRun() }