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

View File

@ -161,7 +161,7 @@ func NewDefaultConfig() *PhiEditorConfig {
Outline: 0xebedef,
RenderShadow: true,
ShadowColor: 0x000000,
Suggestion: SuggestionConfig{
Suggestion: SuggestionConfig{
Background: 0xebedef,
Foreground: 0x3a3839,
SelectedBackground: 0xc7cdb1,
@ -170,10 +170,10 @@ func NewDefaultConfig() *PhiEditorConfig {
},
},
Cursor: &CursorConfig{
FlashRate: 0,
ResetDelay: 0,
FlashRate: 400, // in ms
ResetDelay: 400,
Draw: true,
Flash: false,
Flash: true,
BlockWidth: "block",
},
Commands: map[string]Command{
@ -190,6 +190,12 @@ func NewDefaultConfig() *PhiEditorConfig {
"close_buffer": {"super+w"},
"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
associations: map[string]*LanguageSyntaxConfig{},