Skip to content

v0.4.0

Latest
Compare
Choose a tag to compare
@veeableful veeableful released this 19 Jan 07:27
· 136 commits to master since this release

v0.4.0

It's almost Chinese New Year so the author decided to hold back no more for this go-sdl2 release! It will also make for a nice checkpoint for people to settle into while it is developed for the next release.

What's New

Updated to SDL2 2.0.10!

This version brings most of the bindings from SDL2 2.0.6 to the latest version SDL2 2.0.10! They are the ones that are noted in the SDL2 release announcement posts with the exception of some system specific functions (such as Android, WinRT, etc..). More support for those system-specific functions may come within patch version updates! If anything needed is missing, we'd very much appreciate a report via Github issue so we can add it!

Complementary website for SDL2

The website has also been in the works to become the hub that provides a more curated and centralized way of sharing how certain things are done using SDL2! It is meant as a complementary website in addition to the official one because the official one focuses more on C and lower-level usage. At the moment, this complementary website is focused on go-sdl2 as it is the only package the author is familiar with the C version being the next step. The main meat of the website is the basic, snippet-based tutorials, project-based tutorials, and external resources. The homepage shall serve as status report that relates to SDL2 development in general. Requests for SDL2-related tutorials are welcome via issues on Github!

Static build support with Go Module system

Prior to v0.4.0, the static libraries weren't fetched as they were in a submodule. However, they have now been merged into the repository instead. This fixes static and/or cross-platform build when using the new Go Module system as it didn't fetch the (previously) sub-module go-sdl2-libs. While this may increase the Git repository size, it shouldn't affect its size as a Go Module dependency as the Git history is not included.

Vulkan support and compatibility with vulkan-go

Most of the bindings for SDL2 Vulkan functions have been added which was long overdue since SDL2 2.0.6. It has also been written to be compatible with vulkan-go. Thanks @jclc!

Quieter builds

In go-sdl2 v0.3.x, there would be warnings that are printed during build when it has functions that are not supported by the older SDL2. In v0.4.x, the warnings have been disabled by default. However, if user wants to enable it, they can set the CGO_CPPFLAGS to -DWARN_OUTDATED. An example is:

In addition, there is also plenty of fixes in this release and stability of API is even more enforced from here onwards!

CGO_CPPFLAGS=-DWARN_OUTDATED go get -v github.com/veandco/go-sdl2/sdl

Added

sdl

Structs

  • AudioStream
  • DisplayEvent
  • SensorEvent
  • Sensor
  • MouseButtonEvent.Clicks

Functions

  • Surface.Duplicate()
  • RWops.LoadFileRW()
  • RWops.LoadFile()
  • Renderer.GetMetalLayer()
  • Renderer.GetMetalCommandEncoder()
  • Surface.ColorModel()
  • Surface.Bounds()
  • Surface.At()
  • Surface.Set()
  • Surface.HasColorKey()
  • TextInputEvent.GetText()
  • TextEditingEvent.GetText()
  • FRect.Empty()
  • FRect.Equals()
  • FRect.HasIntersection()
  • FRect.Intersect()
  • FPoint.InRect()
  • GameController.PlayerIndex()
  • GameController.Rumble()
  • Joystick.PlayerIndex()
  • Joystick.Rumble()
  • GameControllerMappingForDeviceIndex()
  • JoystickGetDevicePlayerIndex()
  • HasAVX2()
  • HasNEON()
  • ComposeCustomBlendMode()
  • WarpMouseGlobal()
  • LockJoysticks()
  • UnlockJoysticks()
  • SetYUVConversionMode()
  • GetYUVConversionMode()
  • GetYUVConversionModeForResolution()
  • SensorOpen()
  • SensorFromInstanceID()
  • NumSensors()
  • SensorGetDeviceName()
  • SensorGetDeviceType()
  • SensorGetDeviceNonPortableType()
  • SensorGetDeviceInstanceID()
  • SensorUpdate()
  • GetGlobalMouseState()
  • BytesPerPixel()
  • BitsPerPixel()
  • GetTouchDeviceType()
  • HasAVX512F()
  • IsAndroidTV()
  • IsTablet()

Constants

  • INIT_SENSOR
  • HINT_AUDIO_RESAMPLING_MODE
  • HINT_RENDER_LOGICAL_SIZE_MODE
  • HINT_MOUSE_NORMAL_SPEED_SCALE
  • HINT_MOUSE_RELATIVE_SPEED_SCALE
  • HINT_TOUCH_MOUSE_EVENTS
  • HINT_WINDOWS_INTRESOURCE_ICON
  • HINT_WINDOWS_INTRESOURCE_ICON_SMALL
  • HINT_IOS_HIDE_HOME_INDICATOR
  • HINT_RETURN_KEY_HIDES_IME
  • HINT_TV_REMOTE_AS_JOYSTICK
  • HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR
  • HINT_VIDEO_DOUBLE_BUFFER
  • HINT_MOUSE_DOUBLE_CLICK_TIME
  • HINT_MOUSE_DOUBLE_CLICK_RADIUS
  • BLENDMODE_INVALID
  • BLENDOPERATION_ADD
  • BLENDOPERATION_SUBTRACT
  • BLENDOPERATION_REV_SUBTRACT
  • BLENDOPERATION_MINIMUM
  • BLENDOPERATION_MAXIMUM
  • BLENDFACTOR_ZERO
  • BLENDFACTOR_ONE
  • BLENDFACTOR_SRC_COLOR
  • BLENDFACTOR_ONE_MINUS_SRC_COLOR
  • BLENDFACTOR_SRC_ALPHA
  • BLENDFACTOR_ONE_MINUS_SRC_ALPHA
  • BLENDFACTOR_DST_COLOR
  • BLENDFACTOR_ONE_MINUS_DST_COLOR
  • BLENDFACTOR_DST_ALPHA
  • BLENDFACTOR_ONE_MINUS_DST_ALPHA
  • YUV_CONVERSION_JPEG
  • YUV_CONVERSION_BT601
  • YUV_CONVERSION_BT709
  • YUV_CONVERSION_AUTOMATIC
  • STANDARD_GRAVITY
  • SENSOR_INVALID
  • SENSOR_UNKNOWN
  • SENSOR_ACCEL
  • SENSOR_GYRO
  • TOUCH_DEVICE_INVALID
  • TOUCH_DEVICE_DIRECT
  • TOUCH_DEVICE_INDIRECT_ABSOLUTE
  • TOUCH_DEVICE_INDIRECT_RELATIVE

ttf

Structs

  • Font.GlyphMetrics

Constants

  • DROPTEXT
  • DROPBEGIN
  • DROPCOMPLETE
  • MOUSEWHEEL_NORMAL
  • MOUSEWHEEL_FLIPPED`
  • SYSWM_WINRT
  • SYSWM_ANDROID
  • SYSWM_VIVANTE
  • GL_CONTEXT_RESET_NOTIFICATION
  • GL_CONTEXT_NO_ERROR
  • GL_CONTEXT_RELEASE_BEHAVIOR
  • GL_FRAMEBUFFER_SRGB_CAPABLE
  • WINDOWEVENT_TAKE_FOCUS
  • WINDOWEVENT_HIT_TEST

Structs

  • AudioDeviceEvent

Changed

sdl

Functions

  • RWFromMem() (0ee14f9)
  • RWops.FreeRW() to RWops.Free() 0ee14f9
  • RWops.RWsize() to RWops.Size() 0ee14f9
  • RWops.RWseek() to RWops.Seek() 0ee14f9
  • RWops.RWread() to RWops.Read() and RWops.Read2() 0ee14f9
  • RWops.RWtell() to RWops.Tell() 0ee14f9
  • RWops.RWwrite() to RWops.Write() and RWops.Write2() 0ee14f9
  • RWops.RWclose() to RWops.Close() 0ee14f9
  • RWops.RWclose() to RWops.Close() 0ee14f9
  • Window.VulkanCreateSurface to return unsafe.Pointer instead of uintptr 1bad697

img

Functions

  • Init() now returns error instead of int