當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.Uint32函數代碼示例

本文整理匯總了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
}
開發者ID:rsaarelm,項目名稱:teratogen,代碼行數:32,代碼來源:sdl.go

示例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
}
開發者ID:DeedleFake,項目名稱:sdl,代碼行數:8,代碼來源:pixels.go

示例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
}
開發者ID:willemvds,項目名稱:sdl,代碼行數:8,代碼來源:surface.go

示例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)
}
開發者ID:badgerodon,項目名稱:go,代碼行數:8,代碼來源:surface.go

示例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()
}
開發者ID:kearsley,項目名稱:Go-SDL,代碼行數:11,代碼來源:sdl.go

示例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)
}
開發者ID:kearsley,項目名稱:Go-SDL,代碼行數:11,代碼來源:sdl.go

示例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))))
}
開發者ID:JalfResi,項目名稱:go-sdl2,代碼行數:10,代碼來源:surface.go

示例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))))
}
開發者ID:JalfResi,項目名稱:go-sdl2,代碼行數:11,代碼來源:surface.go

示例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
}
開發者ID:jbondeson,項目名稱:Go-SDL2,代碼行數:14,代碼來源:sdl.go

示例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
}
開發者ID:emlai,項目名稱:go-sdl2,代碼行數:16,代碼來源:surface.go

示例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
}
開發者ID:extrame,項目名稱:Go-SDL,代碼行數:16,代碼來源:sdl.go

示例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
}
開發者ID:veandco,項目名稱:go-sdl2,代碼行數:7,代碼來源:sdl_gfx.go

示例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
}
開發者ID:emlai,項目名稱:go-sdl2,代碼行數:9,代碼來源:pixels.go

示例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
}
開發者ID:veandco,項目名稱:go-sdl2,代碼行數:7,代碼來源:sdl_gfx.go

示例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
}
開發者ID:veandco,項目名稱:go-sdl2,代碼行數:7,代碼來源:sdl_gfx.go


注:本文中的C.Uint32函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。