-
-
Save manveru/a234b87ce2b6d1ba29f1 to your computer and use it in GitHub Desktop.
This file contains 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
From 023ae5b3ae14fd6acc9e2a3176259f134d09861a Mon Sep 17 00:00:00 2001 | |
From: Michael Fellinger <m.fellinger@gmail.com> | |
Date: Wed, 26 May 2010 02:38:02 +0900 | |
Subject: [PATCH] Add GetVideoInfo | |
--- | |
sdl/sdl.go | 39 +++++++++++++++++++++++++++++++++++++++ | |
1 files changed, 39 insertions(+), 0 deletions(-) | |
diff --git a/sdl/sdl.go b/sdl/sdl.go | |
index 7222d3e..bd382cb 100644 | |
--- a/sdl/sdl.go | |
+++ b/sdl/sdl.go | |
@@ -73,6 +73,45 @@ func VideoModeOK(width int, height int, bpp int, flags uint32) int { | |
return int(C.SDL_VideoModeOK(C.int(width), C.int(height), C.int(bpp), C.Uint32(flags))) | |
} | |
+type RealVideoInfo struct { | |
+ HW_available bool "Flag: Can you create hardware surfaces?" | |
+ WM_available bool "Flag: Can you talk to a window manager?" | |
+ Blit_hw bool "Flag: Accelerated blits HW --> HW" | |
+ Blit_hw_CC bool "Flag: Accelerated blits with Colorkey" | |
+ Blit_hw_A bool "Flag: Accelerated blits with Alpha" | |
+ Blit_sw bool "Flag: Accelerated blits SW --> HW" | |
+ Blit_sw_CC bool "Flag: Accelerated blits with Colorkey" | |
+ Blit_sw_A bool "Flag: Accelerated blits with Alpha" | |
+ Blit_fill bool "Flag: Accelerated color fill" | |
+ Video_mem uint32 "The total amount of video memory (in K)" | |
+ Vfmt *PixelFormat "Value: The format of the video surface" | |
+ Current_w int32 "Value: The current video mode width" | |
+ Current_h int32 "Value: The current video mode height" | |
+} | |
+ | |
+func GetVideoInfo() *RealVideoInfo { | |
+ vinfo := (*VideoInfo)(cast(C.SDL_GetVideoInfo())) | |
+ | |
+ pad := vinfo.Pad0 | |
+ pad0, pad1 := pad[0], pad[1] | |
+ | |
+ return &RealVideoInfo{ | |
+ HW_available: pad0&(1<<0) != 0, | |
+ WM_available: pad0&(1<<1) != 0, | |
+ Blit_hw: pad1&(1<<1) != 0, | |
+ Blit_hw_CC: pad1&(1<<2) != 0, | |
+ Blit_hw_A: pad1&(1<<3) != 0, | |
+ Blit_sw: pad1&(1<<4) != 0, | |
+ Blit_sw_CC: pad1&(1<<5) != 0, | |
+ Blit_sw_A: pad1&(1<<6) != 0, | |
+ Blit_fill: pad1&(1<<7) != 0, | |
+ Video_mem: vinfo.Video_mem, | |
+ Vfmt: vinfo.Vfmt, | |
+ Current_w: vinfo.Current_w, | |
+ Current_h: vinfo.Current_h, | |
+ } | |
+} | |
+ | |
// Makes sure the given area is updated on the given screen. If x, y, w, and | |
// h are all 0, the whole screen will be updated. | |
func (screen *Surface) UpdateRect(x int32, y int32, w uint32, h uint32) { | |
-- | |
1.7.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment