-
Notifications
You must be signed in to change notification settings - Fork 1
/
code_editor.go
51 lines (41 loc) · 885 Bytes
/
code_editor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package console
import (
"github.com/veandco/go-sdl2/sdl"
)
type codeEditor struct {
console *console
PixelBuffer
}
func newCodeEditorMode(c *console) Mode {
codeEditor := &codeEditor{
console: c,
}
pb, _ := newPixelBuffer(c.Config)
codeEditor.PixelBuffer = pb
return codeEditor
}
func (c *codeEditor) HandleEvent(event sdl.Event) error {
switch t := event.(type) {
case *sdl.KeyDownEvent:
switch t.Keysym.Sym {
// case sdl.K_RIGHT:
// fmt.Printf("Switching to runtime\n")
// c.console.SetMode(RUNTIME)
}
default:
//fmt.Printf("Some event: %#v \n", event)
}
return nil
}
func (c *codeEditor) Init() error {
return nil
}
func (c *codeEditor) Update() error {
return nil
}
func (c *codeEditor) Render() error {
c.PixelBuffer.ClsWithColor(5)
c.PixelBuffer.PrintAtWithColor("Code editor Print Test", 10, 10, 7)
renderModeHeader(c)
return nil
}