Ejemplo n.º 1
0
func NewRenderWindowDefault(mode VideoMode, title string) RenderWindow {
	style := StyleDefaultStyle
	ctitle := C.CString(title)
	ref := C.sfRenderWindow_create(*mode.Cref, ctitle, C.sfUint32(style), nil)

	return RenderWindow{ref}
}
Ejemplo n.º 2
0
// \brief Get a glyph in a font
// \param font          Source font
// \param codePoint     Unicode code point of the character to get
// \param characterSize Character size, in pixels
// \param bold          Retrieve the bold version or the regular one?
// \return The corresponding glyph
// sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold);
func (self Font) Glyph(codePoint, characterSize uint32, bold bool) Glyph {
	g := C.sfFont_getGlyph(
		self.Cref,
		C.sfUint32(codePoint),
		C.uint(characterSize),
		Bool(bold),
	)
	return Glyph{&g}
}
Ejemplo n.º 3
0
// Construct a new window
// This function creates the window with the size and pixel
// depth defined in \a mode. An optional style can be passed to
// customize the look and behaviour of the window (borders,
// title bar, resizable, closable, ...). If \a style contains
// sfFullscreen, then \a mode must be a valid video mode.
// The fourth parameter is a pointer to a structure specifying
// advanced OpenGL context settings such as antialiasing,
// depth-buffer bits, etc.
// param mode     Video mode to use (defines the width, height and depth
// of the rendering area of the window)
// param title    Title of the window
// param style    Window style
// param settings Additional settings for the underlying OpenGL context
// return A new Window.
// sfWindow* sfWindow_create(sfVideoMode mode, const char* title,
// sfUint32 style, const sfContextSettings* settings);
func NewWindow(mode VideoMode, title string, style int32, settings ContextSettings) (Window, error) {
	t := C.CString(title)
	defer C.free(unsafe.Pointer(t))
	if mode.Nil() {
		return Window{nil}, errors.New("NewWindow can't take mode with nil Cref")
	}

	win := C.sfWindow_create(*mode.Cref, t, C.sfUint32(style), settings.Cref)
	if win == nil {
		return Window{nil}, errors.New("Couldn't make a new window")
	}
	return Window{win}, nil
}
Ejemplo n.º 4
0
// \brief Get the kerning value corresponding to a given pair of characters in a font
// \param font          Source font
// \param first         Unicode code point of the first character
// \param second        Unicode code point of the second character
// \param characterSize Character size, in pixels
// \return Kerning offset, in pixels
// int sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize);
func (self Font) Kerning(first, second uint32, characterSize uint) int {
	k := C.sfFont_getKerning(self.Cref, C.sfUint32(first),
		C.sfUint32(second), C.uint(characterSize))
	return int(k)
}
Ejemplo n.º 5
0
// Set the style of a text
// You can pass a combination of one or more styles, for
// example sfTextBold | sfTextItalic.
// The default style is sfTextRegular.
// \param text  Text object
// \param style New style
// void sfText_setStyle(sfText* text, sfUint32 style);
func (self Text) SetStyle(style uint32) {
	C.sfText_setStyle(self.Cref, C.sfUint32(style))
}
Ejemplo n.º 6
0
// \brief Construct a new render window
//
// \param mode     Video mode to use
// \param title    Title of the window
// \param style    Window style
// \param settings Creation settings (pass NULL to use default values)
//
// sfRenderWindow* sfRenderWindow_create(sfVideoMode mode, const char* title, sfUint32 style, const sfContextSettings* settings);
func NewRenderWindow(mode VideoMode, title string, style uint32, settings ContextSettings) RenderWindow {
	ctitle := C.CString(title)
	defer C.free(unsafe.Pointer(ctitle))
	ref := C.sfRenderWindow_create(*mode.Cref, ctitle, C.sfUint32(style), settings.Cref)
	return RenderWindow{ref}
}