Exemplo n.º 1
0
func (v *VertexDecl) Add(attrib Attrib, num uint8, typ AttribType, normalized bool, asint bool) {
	C.bgfx_vertex_decl_add(
		&v.decl,
		C.bgfx_attrib_t(attrib),
		C.uint8_t(num),
		C.bgfx_attrib_type_t(typ),
		C._Bool(normalized),
		C._Bool(asint),
	)
}
Exemplo n.º 2
0
//export _goHandlePointerMotion
func _goHandlePointerMotion(view C.wlc_handle, time C.uint32_t, point *C.struct_wlc_point) C._Bool {
	return C._Bool(wlcInterface.Pointer.Motion(
		View(view),
		uint32(time),
		pointCtoGo(point),
	))
}
Exemplo n.º 3
0
// Attach attaches a socket to zero or more endpoints. If endpoints is not null,
// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by
// '@' (to bind the socket) or '>' (to attach the socket). If the endpoint
// does not start with '@' or '>', the serverish argument determines whether
// it is used to bind (serverish = true) or connect (serverish = false)
func (s *Sock) Attach(endpoints string, serverish bool) error {
	rc := C.zsock_attach(s.zsockT, C.CString(endpoints), C._Bool(serverish))
	if rc == -1 {
		return ErrSockAttach
	}
	return nil
}
Exemplo n.º 4
0
func CreateFrameBufferFromTextures(textures []Texture, destroyTextures bool) FrameBuffer {
	h := C.bgfx_create_frame_buffer_from_handles(
		C.uint8_t(len(textures)),
		//(*C.bgfx_texture_handle_t)(unsafe.Pointer(&textures[0])),
		&textures[0].h,
		C._Bool(destroyTextures),
	)
	return FrameBuffer{h: h}
}
Exemplo n.º 5
0
//export _goHandleKeyboardKey
func _goHandleKeyboardKey(view C.wlc_handle, time C.uint32_t, modifiers *C.struct_wlc_modifiers, key C.uint32_t, state C.enum_wlc_key_state) C._Bool {
	return C._Bool(wlcInterface.Keyboard.Key(
		View(view),
		uint32(time),
		modsCtoGo(modifiers),
		uint32(key),
		KeyState(state),
	))
}
Exemplo n.º 6
0
//export _goHandleTouchTouch
func _goHandleTouchTouch(view C.wlc_handle, time C.uint32_t, modifiers *C.struct_wlc_modifiers, touch C.enum_wlc_touch_type, slot C.int32_t, point *C.struct_wlc_point) C._Bool {
	return C._Bool(wlcInterface.Touch.Touch(
		View(view),
		uint32(time),
		modsCtoGo(modifiers),
		TouchType(touch),
		int32(slot),
		pointCtoGo(point),
	))
}
Exemplo n.º 7
0
//export _goHandlePointerButton
func _goHandlePointerButton(view C.wlc_handle, time C.uint32_t, modifiers *C.struct_wlc_modifiers, button C.uint32_t, state C.enum_wlc_button_state, point *C.struct_wlc_point) C._Bool {
	return C._Bool(wlcInterface.Pointer.Button(
		View(view),
		uint32(time),
		modsCtoGo(modifiers),
		uint32(button),
		ButtonState(state),
		pointCtoGo(point),
	))
}
Exemplo n.º 8
0
// Attach attaches a socket to zero or more endpoints. If endpoints is not null,
// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by
// '@' (to bind the socket) or '>' (to attach the socket). If the endpoint
// does not start with '@' or '>', the serverish argument determines whether
// it is used to bind (serverish = true) or connect (serverish = false)
func (s *Sock) Attach(endpoints string, serverish bool) error {
	cEndpoints := C.CString(endpoints)
	defer C.free(unsafe.Pointer(cEndpoints))

	rc := C.zsock_attach(s.zsockT, cEndpoints, C._Bool(serverish))
	if rc == -1 {
		return ErrSockAttach
	}
	return nil
}
Exemplo n.º 9
0
func (o *ObjectIter) Next() *Object {
	obj := C.ucl_iterate_object(o.object, &o.iter, C._Bool(o.expand))
	if obj == nil {
		return nil
	}

	// Increase the ref count so we have to free it
	C.ucl_object_ref(obj)

	return &Object{object: obj}
}
Exemplo n.º 10
0
// detectLanguage calls the C function
func detectLanguage(text string, plain bool) *Language {
	length := C.int(len(text))
	buffer := C.CString(text)
	defer C.free(unsafe.Pointer(buffer))
	result := C.struct_language{}
	C.detect_language(buffer, length, C._Bool(plain), &result)
	return &Language{
		Code:     C.GoString(result.code),
		Name:     C.GoString(result.name),
		Reliable: result.reliable != 0,
	}
}
Exemplo n.º 11
0
//export _goHandlePointerScroll
func _goHandlePointerScroll(view C.wlc_handle, time C.uint32_t, modifiers *C.struct_wlc_modifiers, axisBits C.uint8_t, amount *C.double) C._Bool {
	// convert double[2] to [2]float64
	goAmount := [2]float64{
		*(*float64)(amount),
		*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(amount)) + unsafe.Sizeof(*amount))),
	}
	return C._Bool(wlcInterface.Pointer.Scroll(
		View(view),
		uint32(time),
		modsCtoGo(modifiers),
		uint8(axisBits),
		goAmount,
	))
}
Exemplo n.º 12
0
func VertexPack(input [4]float32, normalized bool, attrib Attrib, decl VertexDecl, slice interface{}, index int) {
	val := reflect.ValueOf(slice)
	if val.Kind() != reflect.Slice {
		panic(errors.New("bgfx: expected slice"))
	}
	C.bgfx_vertex_pack(
		(*C.float)(unsafe.Pointer(&input)),
		C._Bool(normalized),
		C.bgfx_attrib_t(attrib),
		&decl.decl,
		unsafe.Pointer(val.Pointer()),
		C.uint32_t(index),
	)
}
Exemplo n.º 13
0
Arquivo: mmdb.go Projeto: ruizu/geoip
func (db *DB) Lookup(ip string) (*LookupResult, error) {
	var gaiError, status C.int
	result := C.MMDB_lookup_string(&db.mmdb, C.CString(ip), &gaiError, &status)
	if gaiError != 0 {
		return nil, fmt.Errorf(C.GoString(C.gai_strerror(gaiError)))
	}
	if status != C.int(StatusSuccess) {
		return nil, fmt.Errorf(errorString(int(status)))
	}
	if result.found_entry != C._Bool(true) {
		return nil, fmt.Errorf("no entry for ip (%s) was found.", ip)
	}

	var entryDataList *C.MMDB_entry_data_list_s
	status = C.MMDB_get_entry_data_list(&result.entry, &entryDataList)
	if status != C.int(StatusSuccess) {
		return nil, fmt.Errorf(errorString(int(status)))
	}

	return &LookupResult{entryDataList, entryDataList}, nil
}
Exemplo n.º 14
0
func (opt *options) SetSourceMapEmbed(embed bool) {
	C.sass_option_set_source_map_embed(opt.optc(), C._Bool(embed))
}
Exemplo n.º 15
0
func (opt *options) SetSourceComments(comment bool) {
	C.sass_option_set_source_comments(opt.optc(), C._Bool(comment))
}
Exemplo n.º 16
0
func CreateProgram(vsh, fsh Shader, destroyShaders bool) Program {
	return Program{
		h: C.bgfx_create_program(vsh.h, fsh.h, C._Bool(destroyShaders)),
	}
}
Exemplo n.º 17
0
//export _goHandleInputCreated
func _goHandleInputCreated(device *C.struct_libinput_device) C._Bool {
	return C._Bool(wlcInterface.Input.Created(device))
}
Exemplo n.º 18
0
// SetType sets type bit. TOggle indicates whether it is set or not.
func (v View) SetType(typ ViewTypeBit, toggle bool) {
	C.wlc_view_set_type(C.wlc_handle(v), uint32(typ), C._Bool(toggle))
}
Exemplo n.º 19
0
func (opt *options) SetIsIndentedSyntaxSrc(is bool) {
	C.sass_option_set_is_indented_syntax_src(opt.optc(), C._Bool(is))
}
Exemplo n.º 20
0
// SetSleep sets sleep status: wake up / sleep.
func (o Output) SetSleep(sleep bool) {
	C.wlc_output_set_sleep(C.wlc_handle(o), C._Bool(sleep))
}
Exemplo n.º 21
0
//export _goHandleViewCreated
func _goHandleViewCreated(view C.wlc_handle) C._Bool {
	return C._Bool(wlcInterface.View.Created(View(view)))
}
Exemplo n.º 22
0
func (t SystemTray) SetVisible(b bool)                        { C.SetTrayVisible(t.addr, C._Bool(b)) }
Exemplo n.º 23
0
func requestAttention(continuous bool) {
	C.requestAttention(C._Bool(continuous))
}
Exemplo n.º 24
0
func (opt *options) SetSourceMapContent(content bool) {
	C.sass_option_set_source_map_contents(opt.optc(), C._Bool(content))
}
Exemplo n.º 25
0
func (opt *options) SetOmitSourceMapURL(omit bool) {
	C.sass_option_set_omit_source_map_url(opt.optc(), C._Bool(omit))
}
Exemplo n.º 26
0
Arquivo: bindings.go Projeto: hazbo/si
// wrenReturnBool is the Go binding for the
// C implementation of wrenReturnBool
func wrenReturnBool(vm *C.WrenVM, value bool) {
	C.wrenReturnBool(vm, C._Bool(value))
}
Exemplo n.º 27
0
//export _goHandleOutputCreated
func _goHandleOutputCreated(output C.wlc_handle) C._Bool {
	return C._Bool(wlcInterface.Output.Created(Output(output)))
}
Exemplo n.º 28
0
// SetState sets state bit. Toggle indicates whether it is set or not.
func (v View) SetState(state ViewStateBit, toggle bool) {
	C.wlc_view_set_state(C.wlc_handle(v), uint32(state), C._Bool(toggle))
}