[WIN/MAC/Linux-64] SDL2 (+mixer,image,ttf,net) + modern OpenGL

Developed or developing a new product in PureBasic? Tell the world about it.
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

[WIN/MAC/Linux-64] SDL2 (+mixer,image,ttf,net) + modern OpenGL

Post by GPI »

I have translated the c-header from the complete SDL - package for Pure Basic.
I added some small exmaples and a "translator" for the Lazy-Foo - SDL-Tutorials https://lazyfoo.net/tutorials/SDL/ (please read the readme!).

https://github.com/GPIforGit/SDL_For_PB/releases

Mac users must download and install the sdl-framework:

Code: Select all

download *.dmg from this files
		https://www.libsdl.org/download-2.0.php#source
		https://www.libsdl.org/projects/SDL_image/
		https://www.libsdl.org/projects/SDL_mixer/
		https://www.libsdl.org/projects/SDL_net/
		https://www.libsdl.org/projects/SDL_rtf/
		https://www.libsdl.org/projects/SDL_ttf/
	open the *.dmg
	copy "sdl*.frameworks" to /Library/Frameworks/
	more infos for example here: https://lazyfoo.net/tutorials/SDL/01_hello_SDL/mac/index.php
Sorry, I don't have any experience with linux, but it should easy to add support for it. When somebody has done it, I will add this to the package.

Why SDL?
- Check mouse without problems, when in windows a desktop-scale is set other than 100%
- Switch between window, borderless window and fullscreen without reloading all the sprites.
- Playback of mp3, ogg etc. (I had the problem, that PB doesn't like my OGGs)
- Support for Joystick and Gamepad - including rumble. Simple connect a PS4, XBOX or Switch-Pro Controller and SDL will support it.

Examples:
https://github.com/GPIforGit/SDL-Examples

Modern OpenGL Examples:
https://github.com/GPIforGit/LearnOpenGL/releases
Last edited by GPI on Sat Jun 05, 2021 1:38 pm, edited 1 time in total.
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Re: [WIN/MAC-64] SDL2 (+mixer,image,ttf,net)

Post by GPI »

Updated:
https://github.com/GPIforGit/SDL_For_PB/releases
Update to 2.0.14
Linux is supported
Modern OpenGL is supported

Examples:
https://github.com/GPIforGit/SDL-Examples
https://github.com/GPIforGit/LearnOpenGL/releases

; Changelog
; - new:.surface ext_Surface_FlipVertical(*sur.surface) - flip a surface vertically
; - new:.d ext_GetElapsedSeconds() - seconds since init SDL with high Performance Counter
; - new:.d ext_DeltaSeconds(*Timer.ext_Timer, max.d = 1.0/15.0) - delta seconds since last call
; - new: ext_DeltaDelay(*timer.ext_Timer, delay.d) - high performace delay in seconds since last call of this procedure (for fps cap)
; - Updateded to SDL to 2.0.14
; - new include openGL.pbi
; - Introduce SDL_Config
User avatar
❤x1
User
User
Posts: 46
Joined: Thu Jan 10, 2019 5:56 pm

Re: [WIN/MAC/Linux-64] SDL2 (+mixer,image,ttf,net) + modern OpenGL

Post by ❤x1 »

Oh!
This was precisely what I needed! Thanks a lot for your valiant efforts!
PeWa
New User
New User
Posts: 7
Joined: Fri Sep 06, 2019 8:25 pm

Re: [WIN/MAC/Linux-64] SDL2 (+mixer,image,ttf,net) + modern OpenGL

Post by PeWa »

Hi GPI,

is the translation of the C headers with the new PB6 version still necessary ?
SDL is now at version 2.0.22, is it easier to include it in PB6 ?
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: [WIN/MAC/Linux-64] SDL2 (+mixer,image,ttf,net) + modern OpenGL

Post by StarBootics »

PeWa wrote: Mon Jul 11, 2022 12:22 pm Hi GPI,

is the translation of the C headers with the new PB6 version still necessary ?
SDL is now at version 2.0.22, is it easier to include it in PB6 ?
From my perspective, the translation of the C headers is still necessary because compiling a large source code in Debug mode with the C backend take forever while the ASM backend ti is very fast. From my experience it's still better to not rely on inline C to import the C header.
Updating the translation of the C header will not take long at all anyway.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
Post Reply