本文整理匯總了Golang中C.Uint32函數的典型用法代碼示例。如果您正苦於以下問題:Golang Uint32函數的具體用法?Golang Uint32怎麽用?Golang Uint32使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Uint32函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: mainLoop
func mainLoop(width, height int) {
// SDL window must be created in the same thread where the events are
// polled. Hence this stuff must be in a separate goroutine along with the
// event loop.
initFlags := int64(C.SDL_INIT_VIDEO) | int64(C.SDL_INIT_AUDIO)
screenFlags := 0
if C.SDL_Init(C.Uint32(initFlags)) == C.int(-1) {
panic(getError())
}
screen := C.SDL_SetVideoMode(
C.int(width), C.int(height), 32, C.Uint32(screenFlags))
if screen == nil {
panic(getError())
}
C.SDL_EnableUNICODE(1)
C.SDL_EnableKeyRepeat(C.SDL_DEFAULT_REPEAT_DELAY, C.SDL_DEFAULT_REPEAT_INTERVAL)
initAudio()
// Synchronize with Run function.
coord <- true
eventLoop()
C.SDL_Quit()
// Synchronize with Stop function.
coord <- true
runLevel = off
}
示例2: MasksToPixelFormatEnum
func MasksToPixelFormatEnum(bpp int, rm, gm, bm, am uint32) (uint32, error) {
f := C.SDL_MasksToPixelFormatEnum(C.int(bpp), C.Uint32(rm), C.Uint32(gm), C.Uint32(bm), C.Uint32(am))
if f == PIXELFORMAT_UNKNOWN {
return 0, getError()
}
return uint32(f), nil
}
示例3: ConvertFormat
func (s *Surface) ConvertFormat(pf uint32, flags uint32) (*Surface, error) {
cs := C.SDL_ConvertSurfaceFormat(s.c(), C.Uint32(pf), C.Uint32(flags))
if cs == nil {
return nil, getError()
}
return (*Surface)(unsafe.Pointer(cs)), nil
}
示例4: UpdateRect
func (this Surface) UpdateRect(rect Rect) {
c_surface := (*C.SDL_Surface)(this.Ptr)
c_x := C.Sint32(rect.X)
c_y := C.Sint32(rect.Y)
c_w := C.Uint32(rect.W)
c_h := C.Uint32(rect.H)
C.SDL_UpdateRect(c_surface, c_x, c_y, c_w, c_h)
}
示例5: UpdateRect
// 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) {
GlobalMutex.Lock()
screen.mutex.Lock()
C.SDL_UpdateRect(screen.cSurface, C.Sint32(x), C.Sint32(y), C.Uint32(w), C.Uint32(h))
screen.mutex.Unlock()
GlobalMutex.Unlock()
}
示例6: CreateRGBSurface
// Creates an empty Surface.
func CreateRGBSurface(flags uint32, width int, height int, bpp int, Rmask uint32, Gmask uint32, Bmask uint32, Amask uint32) *Surface {
GlobalMutex.Lock()
p := C.SDL_CreateRGBSurface(C.Uint32(flags), C.int(width), C.int(height), C.int(bpp),
C.Uint32(Rmask), C.Uint32(Gmask), C.Uint32(Bmask), C.Uint32(Amask))
GlobalMutex.Unlock()
return wrap(p)
}
示例7: CreateRGBSurface
func CreateRGBSurface(flags uint32, width, height, depth int32, Rmask, Gmask, Bmask, Amask uint32) *Surface {
return (*Surface)(unsafe.Pointer(C.SDL_CreateRGBSurface(C.Uint32(flags),
C.int(width),
C.int(height),
C.int(depth),
C.Uint32(Rmask),
C.Uint32(Gmask),
C.Uint32(Bmask),
C.Uint32(Amask))))
}
示例8: CreateRGBSurfaceFrom
func CreateRGBSurfaceFrom(pixels unsafe.Pointer, width, height, depth, pitch int, Rmask, Gmask, Bmask, Amask uint32) *Surface {
return (*Surface)(unsafe.Pointer(C.SDL_CreateRGBSurfaceFrom(pixels,
C.int(width),
C.int(height),
C.int(depth),
C.int(pitch),
C.Uint32(Rmask),
C.Uint32(Gmask),
C.Uint32(Bmask),
C.Uint32(Amask))))
}
示例9: Init
// Initializes SDL.
func Init(flags uint32) int {
status := int(C.SDL_Init(C.Uint32(flags)))
if (status != 0) && (runtime.GOOS == "darwin") && (flags&INIT_VIDEO != 0) {
if os.Getenv("SDL_VIDEODRIVER") == "" {
os.Setenv("SDL_VIDEODRIVER", "x11")
status = int(C.SDL_Init(C.Uint32(flags)))
if status != 0 {
os.Setenv("SDL_VIDEODRIVER", "")
}
}
}
return status
}
示例10: CreateRGBSurface
// CreateRGBSurface (https://wiki.libsdl.org/SDL_CreateRGBSurface)
func CreateRGBSurface(flags uint32, width, height, depth int32, Rmask, Gmask, Bmask, Amask uint32) (*Surface, error) {
surface := (*Surface)(unsafe.Pointer(C.SDL_CreateRGBSurface(
C.Uint32(flags),
C.int(width),
C.int(height),
C.int(depth),
C.Uint32(Rmask),
C.Uint32(Gmask),
C.Uint32(Bmask),
C.Uint32(Amask))))
if surface == nil {
return nil, GetError()
}
return surface, nil
}
示例11: InitSubSystem
// Initializes subsystems.
func InitSubSystem(flags uint32) int {
GlobalMutex.Lock()
status := int(C.SDL_InitSubSystem(C.Uint32(flags)))
if (status != 0) && (runtime.GOOS == "darwin") && (flags&INIT_VIDEO != 0) {
if os.Getenv("SDL_VIDEODRIVER") == "" {
os.Setenv("SDL_VIDEODRIVER", "x11")
status = int(C.SDL_InitSubSystem(C.Uint32(flags)))
if status != 0 {
os.Setenv("SDL_VIDEODRIVER", "")
}
}
}
GlobalMutex.Unlock()
return status
}
示例12: FilledCircleColor
func FilledCircleColor(renderer *sdl.Renderer, x, y, rad int, color sdl.Color) bool {
_x := C.Sint16(x)
_y := C.Sint16(y)
_rad := C.Sint16(rad)
_color := C.Uint32(gfxColor(color))
return C.filledCircleColor(renderer, _x, _y, _rad, _color) == 0
}
示例13: AllocFormat
// AllocFormat creates a PixelFormat structure from a uint.
// AllocFormat (https://wiki.libsdl.org/SDL_AllocFormat)
func AllocFormat(format uint) (*PixelFormat, error) {
r := (*PixelFormat)(unsafe.Pointer(C.SDL_AllocFormat(C.Uint32(format))))
if r == nil {
return nil, GetError()
}
return r, nil
}
示例14: StringColor
func StringColor(renderer *sdl.Renderer, x, y int, s string, color sdl.Color) bool {
_x := C.Sint16(x)
_y := C.Sint16(y)
_s := C.CString(s)
_color := C.Uint32(gfxColor(color))
return C.stringColor(renderer, _x, _y, _s, _color) == 0
}
示例15: HlineColor
func HlineColor(renderer *sdl.Renderer, x1, x2, y int, color sdl.Color) bool {
_x1 := C.Sint16(x1)
_x2 := C.Sint16(x2)
_y := C.Sint16(y)
_color := C.Uint32(gfxColor(color))
return C.hlineColor(renderer, _x1, _x2, _y, _color) == 0
}