Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 6 commits
  • 2 files changed
  • 0 commit comments
  • 4 contributors
Showing with 30 additions and 3 deletions.
  1. +22 −3 sdl/sdl.go
  2. +8 −0 ttf/ttf.go
View
25 sdl/sdl.go
@@ -616,6 +616,11 @@ func GetMouseState(x, y *int) uint8 {
return uint8(C.SDL_GetMouseState((*C.int)(cast(x)), (*C.int)(cast(y))))
}
+// Warp mousej
+func WarpMouse(x, y int) {
+ C.SDL_WarpMouse(C.Uint16(x), C.Uint16(y))
+}
+
// Retrieves the current state of the mouse relative to the last time this
// function was called.
func GetRelativeMouseState(x, y *int) uint8 {
@@ -720,9 +725,19 @@ func WaitEvent() Event {
return goEvent((*cevent)(cast(&cev)))
}
-// Push the event onto the event queue
+// Push the event onto the event queue. Note that it must be passed a
+// pointer to one of the Event structs, not a value. Thus
+//
+// PushEvent(&UserEvent{})
+//
+// will succeed, but
+//
+// PushEvent(UserEvent{})
+//
+// will result in a panic.
func PushEvent(event Event) bool {
- ret := C.SDL_PushEvent((*C.SDL_Event)(cast(cEvent(event))))
+ cev := cEvent(event)
+ ret := C.SDL_PushEvent((*C.SDL_Event)(cast(cev)))
return ret != 0
}
@@ -773,7 +788,11 @@ func goEvent(cev *cevent) Event {
func cEvent(ev Event) *cevent {
evv := reflect.ValueOf(ev)
- return (*cevent)(cast(evv.UnsafeAddr()))
+ if k := evv.Kind(); k != reflect.Ptr {
+ panic("Can't handle kind: " + k.String())
+ }
+
+ return (*cevent)(cast(evv.Elem().UnsafeAddr()))
}
// Time
View
8 ttf/ttf.go
@@ -161,6 +161,14 @@ func (f *Font) GetStyle() int { return int(C.TTF_GetFontStyle(f.cfont)) }
// Sets the rendering style of the font.
func (f *Font) SetStyle(style int) { C.TTF_SetFontStyle(f.cfont, C.int(style)) }
+func (f *Font) GetOutline() int { return int(C.TTF_GetFontOutline(f.cfont)) }
+
+func (f *Font) SetOutline(outline int) { C.TTF_SetFontOutline(f.cfont, C.int(outline)) }
+
+func (f *Font) GetHinting() int { return int(C.TTF_GetFontHinting(f.cfont)) }
+
+func (f *Font) SetHinting(hinting int) { C.TTF_SetFontHinting(f.cfont, C.int(hinting)) }
+
// Returns the maximum height of all the glyphs of the font.
func (f *Font) Height() int { return int(C.TTF_FontHeight(f.cfont)) }

No commit comments for this range

Something went wrong with that request. Please try again.