fltk2go

package module
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2026 License: BSD-3-Clause Imports: 10 Imported by: 0

README

1. info

  • Use FLTK like the Cocoa Framework for iOS/Mac.
  • 中文:像iOS/Mac的Cocoa Framework一样用FLTK
  • FLTK Resource Doc

2. build FLTK

go run fltk_build/fltk_build.go fltk_build/manifest.go

3. Use

go get github.com/0xYeah/fltk2go@latest

4. Dir Tree

fltk2go/
├─ fltk2go.go          # Run / Quit / Version
├─ window/
├─ button/
├─ widget/
├─ runtime/            # ⭐ 运行时核心
│  ├─ handle/          # unsafe.Pointer 生命周期
│  ├─ callback/        # Go ↔ C 回调表
│  ├─ loop/            # UI loop / Run
│  └─ thread/          # 主线程约束
├─ fltk_bridge/        # C ABI / cgo
└─ lib/

5. Warning

  • Prevent GUI goroutines from being scheduled to other OS threads
  • 中文:防止 GUI的goroutine 被调度到其他 OS 线程
func main() {
    // 将当前 goroutine 绑定到当前操作系统线程。
    // 对于 Win32 / OpenGL / GDI+ 等具有线程亲和性的系统或 C/C++ API,这是必须的。
    // 防止 goroutine 被调度到其他 OS 线程,导致 GUI / 图形上下文失效或异常。
    runtime.LockOSThread()
	... // 其他代码
	
	
}

6. used tools

6.1. tree

6.1.1. list projects
tree -I ".git|build|lib"

Depends

Linux
apt update
apt install -y \
  build-essential cmake pkg-config \
  libx11-dev libxext-dev libxinerama-dev libxcursor-dev libxrender-dev libxfixes-dev \
  libxft-dev \
  libgl1-mesa-dev libglu1-mesa-dev \
  mesa-common-dev

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func App added in v0.0.6

func App(build func())

func FltkVersion added in v0.0.6

func FltkVersion() string

FltkVersion [☑]Option

en: Get `fltk` binding version;
zh-CN: 获取绑定的`fltk`版本;
@return [☑]string en: version string;zh-CN: 版本字符串;

func GetSupportedLibraries

func GetSupportedLibraries() (map[string][]Library, error)

GetSupportedLibraries returns all FLTK static library bundles embedded in this fltk2go module.

func Lock added in v0.0.6

func Lock() bool

func Run added in v0.0.6

func Run() int

func Unlock added in v0.0.6

func Unlock()

func Version

func Version() string

Version [☑]Option

en: Get `fltk_go` version;
zh-CN: 获取`fltk_go`版本;
@return [☑]string en: version string;zh-CN: 版本字符串;

Types

type Library added in v0.0.15

type Library struct {
	GOOS        string
	Arch        string
	FLTKVersion string
	Libraries   []string
}

type Manifest

type Manifest struct {
	Module      string `json:"module"`
	FLTKVersion string `json:"fltk_version"`
	Target      struct {
		GOOS    string `json:"goos"`
		OutArch string `json:"out_arch"` // amd64 / arm64 / universal / ...
	} `json:"target"`
	Build struct {
		Toolchain string `json:"toolchain"`
		Date      string `json:"date"`
		GitRev    string `json:"git_rev"`
	} `json:"build"`
	Artifacts struct {
		Libs        []string `json:"libs"`
		HasFlConfig bool     `json:"has_fl_config"`
	} `json:"artifacts"`
}

Directories

Path Synopsis
uikit

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL