I've tried looking this up everywhere and tried just about everything I can, I cannot get SDL to work in Go. Here's my code, a little sloppy, but I just wanted to get it to work, just to test it, just as a starting point. I was going to clean it up and get rid of all the unnecessary #defines later.
package main
// #cgo LDFLAGS: -lSDL -lSDL_main -lSDL_image
// #include <stdio.h>
// #include <SDL/SDL.h>
// #include <SDL/SDL_main.h>
// #include <SDL/SDL_image.h>
import "C"
import "runtime"
func init() {
runtime.LockOSThread()
}
func main() {
var image* C.SDL_Surface
var screen* C.SDL_Surface
C.SDL_Init( C.SDL_INIT_EVERYTHING )
screen = C.SDL_SetVideoMode(640, 480, 32, C.SDL_SWSURFACE)
hello = C.SDL_LoadBMP( "moe.bmp" )
C.SDL_BlitSurface(hello, nil, screen, nil)
C.SDL_Flip(screen)
C.SDL_Delay(2000)
C.SDL_FreeSurface(hello)
C.SDL_Quit()
}
This gives me the "command-line arguments" error: 'SDL_LoadBMP' undeclared (first use in this function), and no amount of searching or wizardry will fix it. If it's required, I'm on Ubuntu with SDL 1.0.2 (I think)
I'd rather not use a wrapper since the only SDL 1 wrapper for Go is two years old and the two good ones are for SDL 2, and I'd rather use SDL 1. Thank you anyone that can guide me.
Also, bonus question because the compiler would never let me test it (obviously), do I use "nil", "NULL", or "C.NULL" (which I know I'd have to #define) in BlitSurface's arguments?