mirror of
https://github.com/haya3218/SDfmL.git
synced 2024-08-14 23:57:09 +00:00
Redo README.md
This commit is contained in:
parent
10bbca486d
commit
7d12a4273e
5 changed files with 25 additions and 69 deletions
|
@ -14,10 +14,10 @@ set(OUT3_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/src/toml/")
|
|||
# Someone make a pull request to support MingW
|
||||
# Way to lazy to do that right now
|
||||
if (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
|
||||
set(MAIN_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/lib/x64/soloud_static.lib;${CMAKE_CURRENT_LIST_DIR}/lib/x64/SDL2.lib;${CMAKE_CURRENT_LIST_DIR}/lib/x64/SDL2_ttf.lib")
|
||||
set(MAIN_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/lib/x64/libmodplug.lib;${CMAKE_CURRENT_LIST_DIR}/lib/x64/soloud_static.lib;${CMAKE_CURRENT_LIST_DIR}/lib/x64/SDL2.lib;${CMAKE_CURRENT_LIST_DIR}/lib/x64/SDL2_ttf.lib")
|
||||
set(MAIN_LIBRARIES_E "${CMAKE_CURRENT_LIST_DIR}/lib/x64/")
|
||||
else ()
|
||||
set(MAIN_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/lib/x86/soloud_static.lib;${CMAKE_CURRENT_LIST_DIR}/lib/x86/SDL2.lib;${CMAKE_CURRENT_LIST_DIR}/lib/x86/SDL2_ttf.lib")
|
||||
set(MAIN_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/lib/x86/libmodplug.lib;${CMAKE_CURRENT_LIST_DIR}/lib/x86/soloud_static.lib;${CMAKE_CURRENT_LIST_DIR}/lib/x86/SDL2.lib;${CMAKE_CURRENT_LIST_DIR}/lib/x86/SDL2_ttf.lib")
|
||||
set(MAIN_LIBRARIES_E "${CMAKE_CURRENT_LIST_DIR}/lib/x86/")
|
||||
endif ()
|
||||
|
||||
|
@ -76,5 +76,6 @@ file(REMOVE_RECURSE "${BUILD_DIRECTORY}/SDL2_ttf.lib")
|
|||
file(REMOVE_RECURSE "${BUILD_DIRECTORY}/SDL2main.lib")
|
||||
file(REMOVE_RECURSE "${BUILD_DIRECTORY}/SDL2test.lib")
|
||||
file(REMOVE_RECURSE "${BUILD_DIRECTORY}/soloud_static.lib")
|
||||
file(REMOVE_RECURSE "${BUILD_DIRECTORY}/libmodplug.lib")
|
||||
|
||||
# :)
|
61
README.md
61
README.md
|
@ -1,64 +1,13 @@
|
|||
![bitch](logo.png)
|
||||
|
||||
# SDfmL
|
||||
|
||||
*Simple DirectMedia Flixel-like Multipurpose Layer*
|
||||
|
||||
*A basic wrapper meant to make creating SHIT easier*
|
||||
# SDfmL
|
||||
|
||||
# What the shit is this
|
||||
SDfmL is an easy to use, basic, and high-level game development library/wrapper.
|
||||
|
||||
A wrapper build around SDL2, some of its libraries, and SoLoud to make a lot of stuff
|
||||
more easier to use.
|
||||
Uses a style based on Flixel, a (very old) flash game engine.
|
||||
|
||||
Stuff like:
|
||||
- Rendering functions
|
||||
- Object system
|
||||
- Sound
|
||||
- Configuration
|
||||
- and most possibly, more.... idk.
|
||||
- Less dll binary clutter!
|
||||
*For more information, check out [the basics.](DOCUMENTATION.md)*
|
||||
|
||||
# How the shit to use it den
|
||||
|
||||
Currently, it only supports MSVC, but you could probably tweak CMakeLists.txt to be able to use
|
||||
MingW, or GCC.
|
||||
|
||||
## Requirements
|
||||
- CMake, to build the damn thing
|
||||
- SDL2 and SDL_ttf 2.0, duh
|
||||
- SoLoud (static library)
|
||||
- A VC++ (MSVC) compiler that atleast supports C++ std 17
|
||||
|
||||
To use it (in windows atleast),
|
||||
|
||||
- Get SDL2 and SDL_ttf 2.0, and put em on the respective x86 and x64 folders.
|
||||
You know how to place them. It's fucking common sense.
|
||||
- [SoLoud.](https://sol.gfxile.net/soloud/index.html) Follow GENie instructions and build as a static library.
|
||||
- If you are gonna be using the OpenMPT module, you'll need the libopenmpt dll in your exe directory as well.
|
||||
- Prebuilt binaries (with OpenMPT) are [here.](https://cdn.discordapp.com/attachments/872338952483381258/941594180461932564/SoLoud-SDL2.7z)
|
||||
- Clone the dam repo somewhere on ur machine.
|
||||
- Go to where you cloned it, and run `cmake -B build -DCMAKE_BUILD_TYPE=Release`
|
||||
- After successfully making the build files, run `cmake --build --config Release` to build it without the use of VStudio.
|
||||
- If everything worked well, congratulations! You have just compiled a shitty program.
|
||||
|
||||
`src/Main.cpp` should contain example code with some explanations.
|
||||
|
||||
# Licensing
|
||||
|
||||
The sole libraries themselves (SDL, SoLoud) are under the zLib/LibPNG licenses ofc, so you'll have to deal with that
|
||||
|
||||
stb_image is under the Public Domain/MIT.
|
||||
|
||||
TinySoundfont and toml11 under the same license as this wrapper (MIT License)
|
||||
|
||||
## SDfmL license
|
||||
MIT License
|
||||
|
||||
Copyright 2022 haya3218
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*License details are at [LICENSING.md](LICENSING.md)*
|
BIN
logo.png
BIN
logo.png
Binary file not shown.
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 46 KiB |
|
@ -37,6 +37,7 @@ SoLoud::Soloud Render::music;
|
|||
SoLoud::Soloud Render::se;
|
||||
SoLoud::WavStream Render::waveLoader;
|
||||
SoLoud::Openmpt Render::modLoader;
|
||||
SoLoud::Modplug Render::modPlugLoader;
|
||||
SoLoud::Midi Render::midiLoader;
|
||||
SoLoud::SoundFont Render::current_sf;
|
||||
string Render::currentMusic = "";
|
||||
|
@ -216,10 +217,6 @@ bool Render::Init(string window_name) {
|
|||
});
|
||||
}
|
||||
SOUNDFONT = tomlParse<string>("conf.toml", "config", "soundfont");
|
||||
if (se.init() > 0) {
|
||||
log("SoLoud", " has failed to load. Is your dll broken?", ERROR_, __FILENAME__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
if (music.init() > 0) {
|
||||
log("SoLoud", " has failed to load. Is your dll broken?", ERROR_, __FILENAME__, __LINE__);
|
||||
return false;
|
||||
|
@ -235,7 +232,7 @@ bool Render::Init(string window_name) {
|
|||
return false;
|
||||
}
|
||||
log("SDL_ttf", " has been successfully initialized.", NORMAL, __FILENAME__, __LINE__);
|
||||
window = SDL_CreateWindow(window_name.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_OPENGL|SDL_WINDOW_SHOWN);
|
||||
window = SDL_CreateWindow(window_name.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_SHOWN);
|
||||
if (window == nullptr) {
|
||||
log("A window", " failed to be created. " + string(SDL_GetError()), ERROR_, __FILENAME__, __LINE__);
|
||||
return false;
|
||||
|
@ -347,9 +344,7 @@ bool Render::Update() {
|
|||
}
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
se.stopAll();
|
||||
music.stopAll();
|
||||
se.deinit();
|
||||
music.deinit();
|
||||
TTF_Quit();
|
||||
SDL_Quit();
|
||||
|
@ -379,10 +374,10 @@ bool Render::playSound(string path, bool override) {
|
|||
log("", "Played sound from " + path, NORMAL, __FILENAME__, __LINE__);
|
||||
waveLoader.setLooping(false);
|
||||
if (override) {
|
||||
se.stop(seIndex);
|
||||
music.stop(seIndex);
|
||||
}
|
||||
waveLoader.load(path.c_str());
|
||||
seIndex = se.play(waveLoader);
|
||||
seIndex = music.play(waveLoader);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -424,9 +419,18 @@ bool Render::playModPlug(string path) {
|
|||
|
||||
return true;
|
||||
}
|
||||
log("", "Played mod tracker from " + path, NORMAL, __FILENAME__, __LINE__);
|
||||
log("", "Try to play " + path + " using libopenmpt", NORMAL, __FILENAME__, __LINE__);
|
||||
if (modLoader.load(path.c_str()) != SoLoud::SO_NO_ERROR) {
|
||||
log("", "Playing " + path + " using libmodplug", NORMAL, __FILENAME__, __LINE__);
|
||||
if (modPlugLoader.load(path.c_str()) != SoLoud::SO_NO_ERROR) {
|
||||
log("", "Could not play " + path, NORMAL, __FILENAME__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
modPlugLoader.setLooping(true);
|
||||
music.play(modPlugLoader);
|
||||
currentMusic = path;
|
||||
|
||||
return true;
|
||||
}
|
||||
modLoader.setLooping(true);
|
||||
music.play(modLoader);
|
||||
|
|
|
@ -264,6 +264,7 @@ namespace Render {
|
|||
extern SoLoud::Soloud music;
|
||||
extern SoLoud::WavStream waveLoader;
|
||||
extern SoLoud::Openmpt modLoader;
|
||||
extern SoLoud::Modplug modPlugLoader;
|
||||
extern SoLoud::Midi midiLoader;
|
||||
extern SoLoud::SoundFont current_sf;
|
||||
extern string currentMusic;
|
||||
|
@ -280,6 +281,7 @@ namespace Render {
|
|||
/*
|
||||
* Play music thru the openMPT api (669, amf, ams, dbm, digi, dmf, dsm, far, gdm, ice, imf, it, itp, j2b, m15, mdl, med, mo3, mod, mptm, mt2, mtm, okt, plm, psm, ptm, s3m, stm, ult, umx, wow, xm). Always loops.
|
||||
* When a midi is passed (mid), it will use a TSF-based midi loader instead.
|
||||
* If libopenmpt fails to load, it will resort to the libmodplug api instead.
|
||||
* Passing a blank string (e.g. "") will stop the current playing music.
|
||||
*/
|
||||
bool playModPlug(string path);
|
||||
|
|
Loading…
Reference in a new issue