Created
December 23, 2010 07:36
-
-
Save mk0x9/752705 to your computer and use it in GitHub Desktop.
sdl.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sdl | |
func c_SDL_Init(flags uint32) int __asm__ ("SDL_Init"); | |
func c_SDL_SetVideoMode(width, height, bpp int, flags uint32) *Surface __asm__("SDL_SetVideoMode"); | |
func c_SDL_Delay(ms uint32) __asm__ ("SDL_Delay"); | |
func c_SDL_Quit() __asm__ ("SDL_Quit"); | |
func c_SDL_UpperBlit(src *Surface, srcrect *Rect, dst *Surface, dstrect *Rect) int __asm__ ("SDL_UpperBlit"); | |
func c_SDL_Flip(screen *Surface) int __asm__ ("SDL_Flip"); | |
func c_SDL_FreeSurface(surface *Surface) __asm__ ("SDL_FreeSurface"); | |
func c_SDL_LoadBMP_RW(src *RWops, freesrc int) *Surface __asm__ ("SDL_LoadBMP_RW"); | |
func c_SDL_RWFromFile(file, mode *byte) *RWops __asm__ ("SDL_RWFromFile"); | |
func c_IMG_Load(file *byte) *Surface __asm__ ("IMG_Load"); | |
func c_SDL_DisplayFormat(surface *Surface) *Surface __asm__ ("SDL_DisplayFormat"); | |
func c_SDL_WM_SetCaption(title, icon *byte) __asm__ ("SDL_WM_SetCaption"); | |
func c_SDL_PollEvent(event *Event) int __asm__ ("SDL_PollEvent"); | |
func Init(flags uint32) int { return c_SDL_Init(flags) } | |
func Set_video_mode(width, height, bpp int, flags uint32) *Surface { return c_SDL_SetVideoMode(width, height, bpp, flags) } | |
func Delay(ms uint32) { c_SDL_Delay(ms) } | |
func Quit() { c_SDL_Quit() } | |
func Blit_surface(src *Surface, srcrect *Rect, dst *Surface, dstrect *Rect) int { return c_SDL_UpperBlit(src, srcrect, dst, dstrect) } | |
func Flip(screen *Surface) int { return c_SDL_Flip(screen) } | |
func Free_surface(surface *Surface) { c_SDL_FreeSurface(surface) } | |
func Load_BMP(filename string) *Surface { | |
b_filename := []byte(filename) | |
i := c_SDL_RWFromFile(&b_filename[0], &([]byte("rb"))[0]) | |
return c_SDL_LoadBMP_RW(i, 1) | |
} | |
func IMG_load(filename string) *Surface { return c_IMG_Load(&([]byte(filename))[0]) } | |
func Display_format(surface *Surface) *Surface { return c_SDL_DisplayFormat(surface) } | |
func WM_set_caption(title, icon string) { | |
b_title := []byte(title) | |
if len(icon) == 0 { | |
c_SDL_WM_SetCaption(&b_title[0], nil) | |
} else { | |
b_icon := []byte(icon) | |
c_SDL_WM_SetCaption(&b_title[0], &b_icon[0]) | |
} | |
} | |
func Poll_event(event *Event) int { return c_SDL_PollEvent(event) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment