78 Commits

Author SHA1 Message Date
Dmitry Marakasov
f8c6b2a9fb Add operators to offset a Rect by a Point 2014-12-20 18:04:28 +03:00
Dmitry Marakasov
486dbb7bf4 Provide copy operations for AudioDevice::LockHandle 2014-12-19 19:33:30 +03:00
Dmitry Marakasov
3dd739d4a3 Provide default argument for Texture::Lock() 2014-12-19 19:26:53 +03:00
Dmitry Marakasov
3660efab44 Provide version information 2014-12-19 00:48:48 +03:00
Dmitry Marakasov
a6ef469487 Split AudioSpec into separate header 2014-12-18 18:26:11 +03:00
Dmitry Marakasov
95f43d8478 Merge branch 'rwops-improvements' 2014-12-18 17:28:27 +03:00
Dmitry Marakasov
7e61a4aa7d Merge branch 'texture-lock' 2014-12-18 17:28:08 +03:00
Dmitry Marakasov
9a245e073a Merge branch 'audio-fixes' 2014-12-18 17:28:02 +03:00
Dmitry Marakasov
b8d3b08f10 Implement fixed integer r/w methods 2014-12-18 17:24:19 +03:00
Dmitry Marakasov
d7987b33da Allow ContainerRWops to work with both const and non-const containers
Analogus to how StreamRWops work. Also add more tests for
ContainerRWops.
2014-12-18 16:48:48 +03:00
Dmitry Marakasov
53aa26dec5 Make StreamRWops work with istream/ostream
Streams do not generally work well with RWops because
* streams have separate read and write pointers
* ostream doesn't allow you to determine how many bytes were actually written
* istream and ostream have separate set of functions

Try my best to support streams in RWops though, engaging some template
magic:
* provide separate template implementations of all operations which
  depend on whether stream is an istream or ostream. This allows to
  e.g. return 0 immediately for an attempt to write() to istream.
* disallow StreamRWops for classes which are both istream and ostream
  to not run into ambiguity of separate read/write pointers
* for read failure, but partially read object back to the stream to not
  lose data for following read (not sure that e.g. fread behaves so
  though; I'll anyway expect user to Seek() after read or write failure)
* for write failure, there's no way to avoid leaking partial data to the
  stream

In general, it is best to use this container as read-only.

Also add tests for StreamRWops
2014-12-18 16:23:22 +03:00
Dmitry Marakasov
7ba131a913 Add StreamRWops class 2014-12-18 14:32:27 +03:00
Dmitry Marakasov
c73bd885c5 Name header file after class it defines 2014-12-18 14:29:45 +03:00
Dmitry Marakasov
9d2097cdea Silence warning on Release build 2014-12-18 13:16:12 +03:00
Dmitry Marakasov
d5b557706a Use correct exception
SDL2pp::Exception doesn't is not suitable here as this is not an SDL
error. Incorrect argument is a logic error.
2014-12-18 13:14:12 +03:00
Dmitry Marakasov
46591a9cbf Update project comment 2014-12-18 02:52:08 +03:00
Dmitry Marakasov
0124e2703a Update copyright years 2014-12-18 02:51:49 +03:00
Dmitry Marakasov
a727fb4857 Use more consistent name for an option 2014-12-18 02:44:16 +03:00
Dmitry Marakasov
1118a9b166 Implement empty constructor for Texture::LockHandle
Useful if lock must be initialized after it was created
While here, deinitialize all fields of an object which was moved-from
2014-12-17 03:50:02 +03:00
Dmitry Marakasov
16b9399bd1 Implement empty constructor for AudioDevice::LockHandle
Useful if lock must be initialized after it was created
2014-12-16 23:31:53 +03:00
Dmitry Marakasov
70fafab8dd Exception safety
Suck callback in only after everything was created to not needlessly
destroy it if exception is thrown in the constructor
2014-12-16 23:31:41 +03:00
Dmitry Marakasov
5abf3558be Move audio callback from AudioSpec into AudioDevice
Though this is not 100% compatible with SDL2, this makes API much
more consistent and less error prone. For example, you don't need
to store AudioSpec along with AudioDevice just to have your callback
lambda around, you don't need to copy AudioSpec from Wav file just
to fill in the callback (see wav demo), you are no more obliged to
take care of locking AudioDevice while replacing the callback.
2014-12-16 05:59:19 +03:00
Dmitry Marakasov
93a77542d8 Fix move assignments
- Add self-assignment checks
- Free resources of object which is going to be replaced to avoid
  resource leaks
2014-11-30 01:22:22 +03:00
Dmitry Marakasov
950829f234 Add Wav class 2014-11-30 00:48:08 +03:00
Dmitry Marakasov
646380520f Add method to check if two AudioSpecs are equal 2014-11-30 00:45:36 +03:00
Dmitry Marakasov
7ebd613d01 Add AudioSpec copy constructor
Since callback is non-copyable, new callback is specified
2014-11-30 00:44:43 +03:00
Dmitry Marakasov
e034f6cd67 Add AudioSpec empty constructor 2014-11-30 00:44:02 +03:00
Dmitry Marakasov
724e3f37a8 Provide default value for empty callback 2014-11-30 00:43:13 +03:00
Dmitry Marakasov
fcf0302213 Remove noexcept specifications
std::function(std::function&&) is only noexcept in libc++, not
libstdc++, so calculated signatire of move ctor/assignment of AudioSpec
won't match specification
2014-11-29 23:12:11 +03:00
Dmitry Marakasov
2be68a9ebb Add wrapper for large part of SDL2 audio functionality 2014-11-29 22:58:27 +03:00
Dmitry Marakasov
a97d100372 Implement texture property getters 2014-11-25 23:41:54 +03:00
Dmitry Marakasov
f5fa211cfe Implement texture locking 2014-11-24 19:27:56 +03:00
Dmitry Marakasov
359a0e93c8 Implement Rect::Contains(Point) 2014-11-24 01:52:49 +03:00
Dmitry Marakasov
168143510b Mention template args 2014-09-05 05:41:59 +04:00
Dmitry Marakasov
3e5b392075 ContainerRWops are not assignable due to references; add noexecpt to move ctor 2014-09-05 05:35:34 +04:00
Dmitry Marakasov
e3ad1a4ad7 Add custom RWops for use with constant containers 2014-09-05 05:23:13 +04:00
Dmitry Marakasov
2b84c17ce2 Allow to load texture fro file or via RWops 2014-09-05 05:03:12 +04:00
Dmitry Marakasov
9a0a6b9da6 Add Config.hh to record build-time settings 2014-09-05 05:00:06 +04:00
Dmitry Marakasov
fbf5d046ea Add custom RWops class which works with arbitrary container as a storage 2014-09-05 04:54:50 +04:00
Dmitry Marakasov
aaea702856 Add RWops class 2014-09-05 04:46:30 +04:00
Dmitry Marakasov
dfb464ea7b Implement init/deinit/check of separate SDL subsystems 2014-07-27 00:30:26 +04:00
Dmitry Marakasov
42fa7bdd70 Fix return value checking 2014-07-21 19:12:48 +04:00
Dmitry Marakasov
6ed9b7a578 Remove unneeded argument names 2014-02-22 00:39:50 +04:00
Dmitry Marakasov
5a61a8f51b Fix Get() for null Points and Rects, add tests for it 2014-02-21 23:46:37 +04:00
Dmitry Marakasov
8e6bf5fc2f Add basic Point arith 2014-02-21 20:09:11 +04:00
Dmitry Marakasov
7b4b6c051a Don't use allocations inside Point and Rect
Instead, use boolean validity flag, which is much more practical
2014-02-21 17:11:48 +04:00
Dmitry Marakasov
2c7cb50fd9 Implement SetClipRect, SetScale, SetViewport, TargetSupported in Renderer 2014-02-17 03:28:57 +04:00
Dmitry Marakasov
2f91553068 Implement Renderer::ReadPixels 2014-02-11 07:41:20 +04:00
Dmitry Marakasov
f6d6572602 Fix Rect::FromCenter and add test for it 2014-02-11 06:01:36 +04:00
Dmitry Marakasov
66f4d5b57a Properly handle self-assignment 2014-02-11 05:51:15 +04:00