SDL2 Packet (Header Version 2.0.1)
Download
- 7Z-Archiv (57 kB)
- LGPL
- Plattformen:
- FreeBASIC 0.24.0
- Quelltext enthalten
- Angelegt von TJF am 05.11.2013 • Aktueller Dateiupload vom 22.11.2013
- Alle Dateiversionen
Bewertung
Punkte: 5,0 bei 1 Stimmen(Zum Abstimmen auf die Sterne klicken.)
Der gegenständliche Download betrifft Header-Dateien und Beispielquelltext zur FreeBasic-Anbindung der OpenSource Bibliotheken SDL2-2.0.1, SDL2_mixer-2.0.0 und SDL2_image-2.0.0 (jeweils zlib license). Es handelt sich um ein Update auf Version 2, welches neue Beispiele für alle drei Bibliotheken enthält.
Original | |
---|---|
Webseite | http://www.libsdl.org (en) |
Dokumentation | http://wiki.libsdl.org (en) |
http://www.libsdl.org/projects/SDL_mixer/docs/index.html (en) | |
http://www.libsdl.org/projects/SDL_image/docs/index.html (en) | |
Quelltext | http://www.libsdl.org/release/SDL2-2.0.1.tar.gz |
http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.0.tar.gz | |
http://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.0.tar.gz | |
FreeBasic | |
Header | http://www.freebasic-portal.de/dlfiles/501/FB-SDL-2.0.1.a.7z |
Beispiele | Im Archiv |
Binaries | |
DOS | Nicht verfügbar. |
windows | Downloadseiten mit 32/64-Bit Binaries |
SDL2 | |
SDL2_mixer | |
SDL2_image | |
LINUX | Kompilieren aus den Quelltexten |
SDL2 | |
SDL2_mixer | |
SDL2_image |
Anwendungsbeispiel (Abfrage der Energieversorgung)
'' SDL2-Example program:
'' Simple test of power subsystem.
'' translated by TJF 2013
'/*
'Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
'This software is provided 'as-is', without any express or implied
'warranty. In no event will the authors be held liable for any damages
'arising from the use of this software.
'Permission is granted to anyone to use this software for any purpose,
'including commercial applications, and to alter it and redistribute it
'freely.
'*/
#INCLUDE ONCE "SDL2/SDL2.bi"
SUB report_power()
DIM AS INTEGER seconds, percent
DIM AS SDL_PowerState state = SDL_GetPowerInfo(@seconds, @percent)
DIM AS ZSTRING PTR statestr = NULL
SDL_Log(!"SDL-reported power info...\n")
SELECT CASE AS CONST state
CASE SDL_POWERSTATE_UNKNOWN : statestr = @"Unknown"
CASE SDL_POWERSTATE_ON_BATTERY : statestr = @"On battery"
CASE SDL_POWERSTATE_NO_BATTERY : statestr = @"No battery"
CASE SDL_POWERSTATE_CHARGING : statestr = @"Charging"
CASE SDL_POWERSTATE_CHARGED : statestr = @"Charged"
CASE ELSE : statestr = @"!!API ERROR!!"
END SELECT
SDL_Log(!"State: %s\n", statestr)
IF percent = -1 THEN
SDL_Log(!"Percent left: unknown\n")
ELSE
SDL_Log(!"Percent left: %d%%\n", percent)
END IF
IF seconds = -1 THEN
SDL_Log(!"Time left: unknown\n")
ELSE
SDL_Log(!"Time left: %d minutes, %d seconds\n", _
CAST(INTEGER, seconds / 60), CAST(INTEGER, seconds MOD 60))
END IF
END SUB
'/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO)
IF SDL_Init(0) = -1 THEN
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, !"SDL_Init() failed: %s\n", SDL_GetError())
END 1
END IF
report_power()
SDL_Quit()
English
See english forum page.