Figuring out the file dialog.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package simulator
|
||||
|
||||
import "core:strings"
|
||||
import "core:log"
|
||||
import "core:strings"
|
||||
import rl "vendor:raylib"
|
||||
|
||||
gui_left_panel :: proc(rect: rl.Rectangle, sim: ^Simulator) {
|
||||
@@ -12,6 +12,7 @@ gui_left_panel :: proc(rect: rl.Rectangle, sim: ^Simulator) {
|
||||
rect.height / 2,
|
||||
}
|
||||
rl.DrawRectangleLinesEx(top_panel, 1, rl.DARKGRAY)
|
||||
gui_file_loader(top_panel)
|
||||
|
||||
bottom_panel := rl.Rectangle {
|
||||
rect.x,
|
||||
@@ -23,6 +24,20 @@ gui_left_panel :: proc(rect: rl.Rectangle, sim: ^Simulator) {
|
||||
gui_key_pad(bottom_panel, sim.machine.keypad, sim.font)
|
||||
}
|
||||
|
||||
gui_file_loader :: proc(rect: rl.Rectangle,) {
|
||||
if rl.IsFileDropped() {
|
||||
log.info("file drop found!")
|
||||
dropped_file := rl.LoadDroppedFiles()
|
||||
|
||||
if dropped_file.count > 1 {
|
||||
path_str := string(dropped_file.paths[0])
|
||||
log.info("file dropped: ", path_str)
|
||||
}
|
||||
|
||||
rl.UnloadDroppedFiles(dropped_file)
|
||||
}
|
||||
}
|
||||
|
||||
gui_key_pad :: proc(rect: rl.Rectangle, display: [16]bool, font: rl.Font) {
|
||||
Key :: struct { label: string, index: int}
|
||||
keys := [16]Key {
|
||||
|
||||
Reference in New Issue
Block a user