more default value configs; make the default editor size larger

This commit is contained in:
Felix Angell 2021-01-10 20:33:44 +00:00
parent 9aa8e44fb3
commit 68c3a94c12
2 changed files with 14 additions and 10 deletions

View File

@ -20,7 +20,7 @@ func main() {
windowConfig.Alias = config.Render.Aliased windowConfig.Alias = config.Render.Aliased
windowConfig.VerticalSync = config.Render.VerticalSync windowConfig.VerticalSync = config.Render.VerticalSync
scaledWidth, scaledHeight := calcScaledWindowDimension() scaledWidth, scaledHeight := calcScaledWindowDimension(800, 600)
window := strife.SetupRenderWindow(scaledWidth, scaledHeight, windowConfig) window := strife.SetupRenderWindow(scaledWidth, scaledHeight, windowConfig)
window.AllowHighDPI() window.AllowHighDPI()
window.SetTitle("Hello world!") window.SetTitle("Hello world!")
@ -88,15 +88,13 @@ func main() {
} }
} }
func calcScaledWindowDimension() (int, int) { func calcScaledWindowDimension(width, height float32) (int, int) {
ww, wh := float32(640.0), float32(360.0)
dpi, defDpi := strife.GetDisplayDPI(0) dpi, defDpi := strife.GetDisplayDPI(0)
cfg.ScaleFactor = float64(dpi / defDpi) cfg.ScaleFactor = float64(dpi / defDpi)
scaledWidth := int((ww * dpi) / defDpi) scaledWidth := int((width * dpi) / defDpi)
scaledHeight := int((wh * dpi) / defDpi) scaledHeight := int((height * dpi) / defDpi)
return scaledWidth, scaledHeight return scaledWidth, scaledHeight
} }

View File

@ -170,10 +170,10 @@ func NewDefaultConfig() *PhiEditorConfig {
}, },
}, },
Cursor: &CursorConfig{ Cursor: &CursorConfig{
FlashRate: 0, FlashRate: 400, // in ms
ResetDelay: 0, ResetDelay: 400,
Draw: true, Draw: true,
Flash: false, Flash: true,
BlockWidth: "block", BlockWidth: "block",
}, },
Commands: map[string]Command{ Commands: map[string]Command{
@ -190,6 +190,12 @@ func NewDefaultConfig() *PhiEditorConfig {
"close_buffer": {"super+w"}, "close_buffer": {"super+w"},
"delete_line": {"super+d"}, "delete_line": {"super+d"},
}, },
Associations: map[string]FileAssociations{
"c": {Extensions: []string{".c", ".h", ".cc"}},
"go": {Extensions: []string{".go"}},
"md": {Extensions: []string{".md", ".markdown"}},
"toml": {Extensions: []string{".toml"}},
},
// TODO syntax defaults // TODO syntax defaults
associations: map[string]*LanguageSyntaxConfig{}, associations: map[string]*LanguageSyntaxConfig{},