Skip to content

ivansouzamf/nativefiledialog-odin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nativefiledialog-odin

Odin bindings for the Native File Dialog Extended library.

Basic Usage

import nfd "./nativefiledialog"
import "core:fmt"

main :: proc() {
    nfd.Init()
    defer nfd.Quit()
    
    path: cstring
    filters := [2]nfd.Filter_Item { { "Source code", "c,cpp,cc" }, { "Headers", "h,hpp" } }
    args := nfd.Open_Dialog_Args {
        filter_list = raw_data(filters[:]),
        filter_count = len(filters)
    }
    
    result := nfd.OpenDialogU8_With(&path, &args)
    switch result {
        case .Okay: {
            fmt.println("Success!")
            fmt.println(path)
            nfd.FreePathU8(path)
        }
        case .Cancel: fmt.println("User pressed cancel.")
        case .Error: fmt.println("Error:", nfd.GetError())
    }
}

About

Odin bindings for Native File Dialog Extended

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages