52 Commits

Author SHA1 Message Date
Dmitry Marakasov
41c96ba25b Fix build for ms compiler 2017-07-07 22:36:28 +03:00
Dmitry Marakasov
867219a0a1 Mark constants as constexpr, capture implicitly 2017-06-30 21:12:53 +03:00
Dmitry Marakasov
24482d85f6 Follow SDL2 include path conventions
Though these are broken and error prone, as they ignore the possibility
of conflicts between SDL, SDL2 and wrappers thereof discarding useful
include path prefix (SDL2/), since SDL and satellite libraries follow
these it's too hard to stay away.

So don't use prefixes for SDL include paths any longer.
2017-02-08 13:19:04 +03:00
Dmitry Marakasov
ed3fbb8953 Optimize examples CMakeLists 2016-01-25 17:40:00 +03:00
Dmitry Marakasov
69bb914040 Improve SDL2Main library handling 2016-01-22 23:49:29 +03:00
Dmitry Marakasov
6000d16548 Include <cmath> for sin()/cos() 2016-01-05 18:17:39 +03:00
Dmitry Marakasov
0aede126fc Fix main() signatures to be compatible with SDL_main 2015-12-15 22:06:56 +03:00
Dmitry Marakasov
ef3e50bef8 Include <algorithm> for std::min 2015-12-11 02:37:58 +03:00
Dmitry Marakasov
d29b7528a6 Fix some type conversion warnings 2015-09-17 15:32:54 +03:00
Dmitry Marakasov
9ecd4a12fe Fix variable types 2015-09-17 15:32:29 +03:00
Dmitry Marakasov
5822e5fc61 Mark static stuff as such 2015-09-16 22:52:42 +03:00
Dmitry Marakasov
a8ec68a625 Define pi as a constant instead of a macro
Consistent to what we already do in image example
2015-09-10 20:41:06 +03:00
Dmitry Marakasov
05c0690ea5 Define M_PI if it isn't 2015-09-09 14:37:05 +03:00
Dmitry Marakasov
00e47a8833 Remove unused variable 2015-09-06 22:01:42 +03:00
Dmitry Marakasov
326378c59c Add buildin effects support 2015-09-04 23:08:04 +03:00
Dmitry Marakasov
7121b78543 Fix comment 2015-08-31 18:41:01 +03:00
Dmitry Marakasov
f3511a1a71 Implement mixer music 2015-08-31 18:38:29 +03:00
Dmitry Marakasov
e37d67725e It is actually safe to free chunks which are still playing
Though documentation and even a comment at the start of Mix_FreeChunk()
state that it's unsafe to free chunk which is still being played, the
function actually contains the code to stop all playback of a chunk which is
being freed. See SDL2_mixer 2.0.0, mixer.c:759:

    /* Guarantee that this chunk isn't playing */
    SDL_LockAudio();
    if ( mix_channel ) {
        for ( i=0; i<num_channels; ++i ) {
            if ( chunk == mix_channel[i].chunk ) {
                mix_channel[i].playing = 0;
                mix_channel[i].looping = 0;
            }
        }
    }
    SDL_UnlockAudio();

As a result, no special actions are required to stop Mixer playback
before destruction of the Chunks (which is a common case with SDL2pp,
as Chunks may only be constructed after Mixer is created, and are
correspondingly destroyed in reverse order, e.g. before Mixer).
2015-08-29 02:34:16 +03:00
Dmitry Marakasov
1cc64cea4f Cosmetic fixes for example 2015-08-29 00:27:22 +03:00
Dmitry Marakasov
4be68384ff Extend example 2015-08-28 23:46:13 +03:00
Dmitry Marakasov
30734317c8 It's a good idea to halt playback before Chunk destruction 2015-08-28 23:26:51 +03:00
Dmitry Marakasov
c5dc35574d Implement mixer playback 2015-08-28 23:23:47 +03:00
Dmitry Marakasov
a25c84932c Add stub Mixer class 2015-08-28 23:04:19 +03:00
Dmitry Marakasov
94f4a3d7aa Include Chunk into example 2015-08-28 19:32:18 +03:00
Dmitry Marakasov
7cc56a1ccb Add basic example for SDLMixer 2015-08-27 20:43:41 +03:00
Dmitry Marakasov
93dc374280 Merge branch 'char16_t' 2015-06-10 00:08:53 +03:00
Dmitry Marakasov
0fd5aafea3 Merge branch 'fill-copy' 2015-06-10 00:08:47 +03:00
Dmitry Marakasov
635deff498 Add utf8 and utf16 cases to the demo 2015-05-14 18:04:30 +03:00
Dmitry Marakasov
7403182cc9 Make ttf demo more flexible 2015-05-14 16:29:51 +03:00
Dmitry Marakasov
0d08d4b7bc Provide pi constant, clean up floating point math
Since M_PI is non-standard, provide own constant to avoid using
-std=gnu++11 or other unwanted hacks.
2015-03-27 03:55:52 +03:00
Dmitry Marakasov
8bdc43417d Include cmath for sin/cos 2015-03-26 19:30:32 +03:00
Dmitry Marakasov
8636fb651f Simplify exception handling 2015-03-20 15:04:07 +03:00
Dmitry Marakasov
fbe9a77044 Add demo for FillCopy() 2015-03-12 17:44:28 +03:00
Dmitry Marakasov
2869db24ef Remove unneeded parentheses, fix README example 2015-01-21 23:15:18 +03:00
Dmitry Marakasov
689f57b864 Exception rework
Now it explicitely stores name of SDL function which caused an error
and generates complete user-readable error message which contains both
function name and SDL error message. Users can now handle SDL2pp
exceptions along with all others in `catch (std::exception&)' and
get complete error info.

While here, fixed incorrect function names in some throw's
2015-01-19 01:41:37 +03:00
Dmitry Marakasov
6e6f8d1a6f Don't use deprecated method 2015-01-12 22:27:16 +03:00
Dmitry Marakasov
7d00d3bbb2 Add outline to font demo 2014-12-29 21:38:38 +03:00
Dmitry Marakasov
31c68423fc Use size getters 2014-12-29 21:38:21 +03:00
Dmitry Marakasov
8a7d5cab0e Make example more demonstrative 2014-12-28 06:38:29 +03:00
Dmitry Marakasov
5a72312d82 Offset by real surface size 2014-12-28 06:36:27 +03:00
Dmitry Marakasov
f1398b54df Implement basic ttf rendering, use in example 2014-12-28 06:15:46 +03:00
Dmitry Marakasov
ffdeb9465d Merge branch 'master' into ttf
Conflicts:
	CMakeLists.txt
	SDL2pp/SDL2pp.hh
2014-12-28 06:14:12 +03:00
Dmitry Marakasov
0557464b56 Merge branch 'surface'
Conflicts:
	CMakeLists.txt
2014-12-28 04:29:07 +03:00
Dmitry Marakasov
cf79498c5e Bundle Bitstream Vera font
It's not that large (even smaller than our example .wav file), has
liberal license and saves us from complexity of finding system
font. Later I may consider installing it as a default font to make
ttf features of SDL2pp usable out-of-box without need for extra
fonts.
2014-12-28 04:01:58 +03:00
Dmitry Marakasov
ffc2caf14d If font is not found, just don't build example instead of failing 2014-12-28 03:50:22 +03:00
Dmitry Marakasov
3570d812eb Add more possible paths to Vera.ttf 2014-12-28 03:49:50 +03:00
Dmitry Marakasov
9a9aa0b05c Add stub for ttf example 2014-12-28 03:35:38 +03:00
Dmitry Marakasov
79300dea2b Use surface in example 2014-12-27 21:46:07 +03:00
Dmitry Marakasov
e0032de447 Implement wrapper for SDL_image init/deinit
Fixes #21
2014-12-27 05:22:12 +03:00
Dmitry Marakasov
65b5446fd1 Axe out remaining uses of old Point/Rect API 2014-12-25 19:30:37 +03:00