37 lines
602 B
Go
37 lines
602 B
Go
package main
|
|
|
|
/*
|
|
#cgo CFLAGS: -I.
|
|
#cgo LDFLAGS: -L. -llibp2fa -lSDL2 -lSDL2main
|
|
|
|
#include "../c/libs/include/SDL2/SDL.h"
|
|
#include "../c/p2fa.h"
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"time"
|
|
"unsafe"
|
|
)
|
|
|
|
func startUI() {
|
|
if C.SDL_Init(C.SDL_INIT_VIDEO) != 0 {
|
|
panic("Failed to initialize SDL")
|
|
}
|
|
defer C.SDL_Quit()
|
|
|
|
window := C.createWindow()
|
|
if window == nil {
|
|
panic("Error creating window")
|
|
}
|
|
|
|
renderer := C.createRenderer((*C.SDL_Window)(unsafe.Pointer(window)))
|
|
if renderer == nil {
|
|
panic("Error creating renderer")
|
|
}
|
|
C.draw(renderer)
|
|
|
|
time.Sleep(10 * time.Second)
|
|
C.destroy(renderer, window)
|
|
}
|