mirror of
https://github.com/felixangell/phi.git
synced 2024-09-11 15:55:25 +03:00
Option to toggle hardware/software accelerated in config
This commit is contained in:
parent
e9cddc66f8
commit
7e95e73c29
@ -19,6 +19,7 @@ highlight_line = true
|
||||
|
||||
[render]
|
||||
aliased = true
|
||||
accelerated = true
|
||||
|
||||
[theme]
|
||||
background = "0xfdf6e3"
|
||||
@ -57,7 +58,8 @@ func (c CursorConfig) GetCaretWidth() int {
|
||||
}
|
||||
|
||||
type RenderConfig struct {
|
||||
Aliased bool
|
||||
Aliased bool
|
||||
Accelerated bool
|
||||
}
|
||||
|
||||
// todo make this more extendable...
|
||||
|
@ -329,7 +329,7 @@ func (b *Buffer) OnRender(ctx *sdl.Renderer) {
|
||||
}
|
||||
|
||||
source := b.contents
|
||||
if int(last_h) > 0 {
|
||||
if int(last_h) > 0 && int(b.h) != 0 {
|
||||
// work out how many lines can fit into
|
||||
// the buffer, and set the source to
|
||||
// slice the line buffer accordingly
|
||||
|
7
main.go
7
main.go
@ -117,7 +117,12 @@ func main() {
|
||||
window.SetIcon(icon)
|
||||
}
|
||||
|
||||
renderer, err := sdl.CreateRenderer(window, -1, sdl.RENDERER_ACCELERATED)
|
||||
var mode uint32 = sdl.RENDERER_SOFTWARE
|
||||
if config.Render.Accelerated {
|
||||
mode = sdl.RENDERER_ACCELERATED
|
||||
}
|
||||
|
||||
renderer, err := sdl.CreateRenderer(window, -1, mode)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user