Commit Graph

603 Commits

Author SHA1 Message Date
Jonas Kulla a8bff666eb Audio: Don't try to fill and queue null buffer
Fixes skipping audio after interrupting and resuming
the program via eg. a debugger.
2014-01-04 12:28:16 +01:00
Jonas Kulla 3daf805350 Table: Serialize actual table dimensions instead of '3'
This allows savegames created with mkxp to be read with RMXP.
2014-01-02 03:39:22 +01:00
Jonas Kulla 5f16eef273 EventThread: Properly allocate SDL user event codes 2014-01-02 02:22:10 +01:00
Jonas Kulla 0a336ea315 Spacing 2014-01-02 00:17:31 +01:00
Jonas Kulla a0a27889a3 Merge #8 2014-01-02 00:11:57 +01:00
Edward Rudd 5b4f0b239c add config option to set the window icon 2014-01-01 16:52:07 -05:00
Edward Rudd a740f7754c add option to choose whether left alt or both alts toggle's fullscreen 2014-01-01 15:56:38 -05:00
Edward Rudd c6bd61d2de code style fixes 2014-01-01 11:01:05 -05:00
Jonas Kulla 1bacceddf0 Spacing 2014-01-01 12:59:40 +01:00
Jonas Kulla ce7bf97dd4 FileSystem: Make path caching optional via config
Because Windows has case insensitive paths, this should
be turned on (which it is by default) for maximum
compatibility. Can be turned off as an optimization
(this will speed up startup a little depending on the
number of game assets).
2014-01-01 07:13:35 +01:00
Edward Rudd a18497ca7b change to exe dir on startup and add some extra guards around boost program option parsing. 2013-12-31 21:03:53 -05:00
Jonas Kulla 3f08b6b3db Remove dead code 2014-01-01 02:13:02 +01:00
Edward Rudd e87bdb8a95 cleaner approach to handling the viewport bug 2013-12-31 19:56:20 -05:00
Edward Rudd f42539e02b accept any alt for fullscreen switch 2013-12-31 19:31:29 -05:00
Edward Rudd 1120c60cae fix viewport resizing on screen resize. 2013-12-31 19:31:14 -05:00
Edward Rudd f8e8d704b5 use copy construction to pass the config along so the main constructor gets run once. 2013-12-31 17:23:15 -05:00
Edward Rudd f2bb0b2e79 initialize gameFolder to be SDL_GetBasePath() 2013-12-31 17:19:05 -05:00
Edward Rudd 7aa07630e4 can't sizeof an iVar in a static function 2013-12-31 16:32:12 -05:00
Edward Rudd af70e8c1ff correct ScanRow forward declares 2013-12-31 16:31:24 -05:00
Edward Rudd eacc143ea0 update extension usage..
nearly all of the previous required extensions are CORE in OpenGL 2.0
the remaining ones need to have fallback checks for ARB vs EXT vs APPLE 
variants..
2013-12-31 16:31:03 -05:00
Edward Rudd 27ae261d0e don't use base name it's destructive to the incoming string which you shouldn't modify as c_str() is const. 2013-12-31 16:27:28 -05:00
Jonas Kulla f2d2a1886f Shader: Throw on compile/link error, and print info logs
Also let go of the startup debug prints when compiling.
The engine will now tell us properly which shader fails
at which part.
2013-12-30 01:38:47 +01:00
Jonas Kulla 680e407a38 SharedState: Throw exception on errors (and handle them)
First up: throw if chdir(gameFolder) fails.
2013-12-30 01:37:55 +01:00
Jonas Kulla 9759e52b3c Exception: Constructor now takes printf style arguments 2013-12-29 18:05:11 +01:00
Jonas Kulla d8e22a8b3c Remove unused definition 2013-12-29 14:36:32 +01:00
Jonas Kulla 2adf8ab265 Transition from QtCore to stdc++ / STL / boost
This looks like a pretty major change, but in reality,
80% of it is just renames of types and corresponding
methods.

The config parsing code has been completely replaced
with a boost::program_options based version. This
means that the config file format slightly changed
(checkout the updated README).

I still expect there to be bugs / unforseen events.
Those should be fixed in follow up commits.

Also, finally reverted back to using pkg-config to
locate and link libruby. Yay for less hacks!
2013-12-29 13:59:26 +01:00
Jonas Kulla 01529c5741 Audio: Fix stream not being unlocked on exception 2013-12-28 23:10:43 +01:00
Jonas Kulla 99866fb84c Replace QStack with std::stack 2013-12-27 20:10:01 +01:00
Jonas Kulla 922a16a013 TexPool: Fix wrong total memory consumption calculation
The byte count of textures released into the pool was
erroneously added twice to the total byte count.
2013-12-27 18:46:04 +01:00
Jonas Kulla fbf02cf2ce Remove Qt style forloop 2013-12-27 06:19:30 +01:00
Jonas Kulla f3def32461 Constify 2013-12-27 06:11:18 +01:00
Jonas Kulla 231e38ae8e Replace QVector, QList with std::vector, std::list
An exception is made of TexPool, which will need a
bit more testing before transitioning to std containers.

Also replace 'int' with 'size_t' where it is used only
as an array index.
2013-12-26 20:18:33 +01:00
Jonas Kulla 8215bc7e7d Remove useless lines 2013-12-26 15:00:03 +01:00
Jonas Kulla 19bb6c924e Gaphics: Make frame skip a config option
When using something like Valgrind that will run
mkxp 20 times slower than normal, frame skip will
make the redraw loop completely grind to a halt.
Set 'frameSkip' to false in the config to
avert this.
2013-12-21 21:18:20 +01:00
Jonas Kulla cb36a28b09 Add a very crude screenshot function (press F3)
Files are named after the current date+time (down to seconds),
and written to the gameFolder directory.
2013-12-20 09:17:15 +01:00
Jonas Kulla 99cbb4d594 FileSystem: Remove useless code 2013-12-20 07:38:29 +01:00
Jonas Kulla f1df97551c FileSystem: Add "otf" to recognized font extensions 2013-12-15 10:19:22 +01:00
Jonas Kulla 5f290c5b11 Audio: Prevent div-by-zero 2013-12-15 10:12:44 +01:00
Jonas Kulla 8161b00804 Remove unneeded include 2013-12-11 23:52:20 +01:00
Jonas Kulla 3b8484a280 Audio: Silence "unused" errors with latest libvorbisfile 2013-12-11 21:08:40 +01:00
Jonas Kulla 1f2470deb7 Graphics: Fix some RGSS2 bitrot 2013-12-11 21:07:41 +01:00
Jonas Kulla 0035c23641 Shader: Group all shaders in one collective struct
Makes sharedstate.{cpp|h} a lot easier to read, and
adding new shaders a one liner.
2013-12-11 05:22:13 +01:00
Jonas Kulla 8c6648f47e Use std algorithm functions 2013-12-08 13:19:22 +01:00
Jonas Kulla ef12e96158 Remove completely outdated note 2013-12-08 13:01:59 +01:00
Jonas Kulla 946d778b96 Audio: Fix BGM not starting after ME has ended
A previous commit prevented the MeWatch from
starting a BGM stream that was in stopped state.
However, when a new BGM is loaded while the ME
is still playing, the BGM stream will be stopped
even though we want it to start after the ME
finishes.

Also add some comments trying to explain members
of 'AudioStream' a bit better.
2013-12-08 12:58:39 +01:00
Jonas Kulla bf712f3738 Graphics: Remove useless and confusing function 2013-12-08 12:57:46 +01:00
Jonas Kulla 5328d17090 Graphics: Fix viewport effect rendering bug
We didn't account for the spec dictating that
scissor test does affect FBO blit operations,
which resulted in corrupted output if more than
one viewport with an active effect (tone, color)
was created.

The reason I never caught this before must be
that the fglrx-legacy driver is actually bugged
in this aspect and ignores the scissor on blit.
2013-12-08 12:23:12 +01:00
Jonas Kulla 8ac70b7879 Sprite: Perform CPU visibility culling 2013-12-06 15:55:18 +01:00
Jonas Kulla 6e3b1d9466 Sprite: Don't draw when opacity == 0 2013-12-05 18:27:53 +01:00
Jonas Kulla 648684e4aa Don't expose global modules' con/destructors
This is just a small change to make the C++ API
match the binding counterparts more closely.
2013-12-05 00:34:11 +01:00
Jonas Kulla 5fca94616c Audio: Implement RGSS3 functionality
'Pos' and 'Play' functions take a float for
their 'pos' parameter, which is in seconds
of playback.

'setupMidi' is a noop at this point.
2013-12-05 00:24:18 +01:00
Jonas Kulla ef2430e0c3 Sanitize #include statements
The general rule I'm aiming for is to <> include
system wide / installed paths / generally everything
that's outside the git managed source tree (this means
mruby paths too!), and "" include everything else,
ie. local mkxp headers.

The only current exception are the mri headers, which
all have './' at their front as to not clash with
system wide ruby headers. I'm leaving them be for now
until I can come up with a better general solution.
2013-12-04 17:48:37 +01:00
Jonas Kulla 9a63140f3e Audio: MeWatch: Don't resume stopped BGM 2013-12-04 17:16:18 +01:00
Jonas Kulla 04526987e4 Audio: Implement RGSS2 ogg looping
With this we now link to libvorbis/ogg directly.
When this is enabled, one can theoretically also
build SDL_sound without ogg support, although I
doubt it makes much of a difference.

Adittionally, count frames instead of samples
for playback offset calculation.
2013-12-04 16:44:34 +01:00
Jonas Kulla 226e860c38 Bitmap: Fix renaming issue in RGSS2 code 2013-12-04 15:53:42 +01:00
Jonas Kulla a817b31e7c Audio: Remove all traces of rubberband
We will not be using librubberband for in place
pitch shifting. RMXP "shifts" PCM based audio
by just playing it back slower/faster, which
OpenAL takes care of for us. A native midi backend
will be able to effortlessly pitch shift by
multiplying note pitches, should we ever get one.

I have been chasing this ghost for way too long.
2013-12-04 14:49:35 +01:00
Jonas Kulla e26d0366f1 Revert "Audio: Make cheap OpenAL pitch shifting a config option"
Making this an option makes no sense. It ought to
be the default behavior, as RMXP pitch shifts PCM
based audio files the exact same way.

This reverts commit ac35d4214e.
2013-12-04 13:39:39 +01:00
Jonas Kulla ac35d4214e Audio: Make cheap OpenAL pitch shifting a config option 2013-12-01 09:36:15 +01:00
Jonas Kulla a65956818f Bitmap: Feed image extension into SDL2_image for faster loading 2013-11-30 14:28:50 +01:00
Jonas Kulla 64f35071ab Audio: Replace SFML solution by using OpenAL directly
This is a major change in the Audio module that comes with
many changes throughout the codebase and dependency list.
The main gist is that we're finally nuking the last pieces
of SFML from the project. sfml-audio brought with itself
unneeded and big dependencies (libsndfile, libvorbisenc)
while at the same time limiting the amount of audio formats
mkxp can support (eg. we now get mp3 for free, and wma/midi
can be implemented by extending SDL_sound directly).

The increased control gained by interfacing with OpenAL directly
will also allow for easy integration of a dedicated audio
stretcher (librubberband), as well as enable us to implement
looped ogg vorbis (via the 'LOOPSTART'/'LOOPLENGTH' tags),
as required by RGSS2, in the future.

The FileSystem class has had its SFML parts removed.
Aditionally, audio file extensions to be supplemented are
now automatically detected based on how SDL_sound was
built (ie. if no mp3 support was built, mkxp won't try
to look for *.mp3 files). The final used extension
can be optionally returned by 'openRead' calls so
SDL_sound and SDL2_image can immediately choose the
right decoder.

The OpenAL context is created and destroyed in main.cpp
along side the GL context.
2013-11-30 12:00:11 +01:00
Jonas Kulla 0b195cbffc Perftimer: Make GPU query count configurable 2013-11-30 11:47:03 +01:00
Jonas Kulla 0038d27c11 Input: Fix default key bindings 2013-11-30 11:45:17 +01:00
Jonas Kulla ac9bc21947 TexPool: Simplify code 2013-11-23 12:40:23 +01:00
Jonas Kulla da2f68cdba TexPool: Rename 'CacheObject' to 'CacheNode' 2013-11-23 12:27:10 +01:00
Jonas Kulla 06f5a06f67 Filesystem: Optimize RGSSAD file enumeration
Finally got around to nuking that ugly pile of shit that was
previously there for PhysFS file enumeration because filepath
cache generation with unencrypted game files + archive + RTP
has started taking around 6 seconds. Thank $DEITY.
2013-11-01 08:24:14 +01:00
Jonas Kulla 28ff5cd33c Bitmap: Ensure cloned bitmap is non-mega 2013-10-31 10:26:39 +01:00
Jonas Kulla 7549778dc6 Font: Add clone constructor 2013-10-31 10:09:57 +01:00
Jonas Kulla 8dd6b63fc4 EventThread: Mouse button IDs greater than 'SDL_BUTTON_X2' are possible 2013-10-29 08:54:57 +01:00
Jonas Kulla b6890a3c35 Remove unused code 2013-10-29 08:53:56 +01:00
Jonas Kulla 58bd60a70f Graphics: Attempt to provide more consistent frame timings
We now actively track how far behind / in front of an
ideal timestep we are during each frame, and try to
catch up / delay approximate this timing.

Therefore we use more precise timers and sleep functions
(nanosleep if available). We also delay **before** the
final buffer swap so the frame displays at more consistent
points in time.

Not only should this provide a somewhat more consistent
looking map scrolling at lower frame rates, it also
guarantees that we don't fall out of sync eg. with the
Audio during longer cutscenes.

'Graphics.frameReset()' now finally has a function, in
that it resets the ideal timestep approximation, which I
beliefe was also its job in the original RMXP engine.

I'm not sure how well this will work when the frame rate
is set to the monitor refresh rate and vsync is turned on.
Very likely unnecessary frame skips will occur here and there
due to imprecise timers. In the future we should probably
check if the frame rate is equal to or higher than the
monitor rate, and disable frame skip accordingly.

These changes currently break the F2 FPS display (it shows
a value that's slightly too high).
2013-10-22 17:05:46 +02:00
Jonas Kulla 765fd55bce Tilemap: Use simple "TexPool" replacement for atlas allocation
Releasing a Tilemap atlas into the pool on every map switch
will blow out tons of smaller textures for very little gain,
as atlas textures are already pretty much impossible to
recycle anywhere but in new Tilemaps.
2013-10-22 06:36:13 +02:00
Jonas Kulla 10b3e04dee Add config entry "allowSymlinks" 2013-10-20 22:38:46 +02:00
Jonas Kulla dcdfea55f1 Bitmap: Make 'Bitmap::textSize()' work with multibyte characters 2013-10-20 22:14:38 +02:00
Jonas Kulla d63c8cdc19 Bitmap: Add FIXME 2013-10-20 21:05:48 +02:00
Jonas Kulla 7236ca0515 Spacing 2013-10-19 01:47:12 +02:00
Jonas Kulla 82e2901726 Plane, Sprite: Fix Bitmap flushes in draw handler
Comparing the current SceneElement classes to the earlier
written documentation actually immediatelly exposed some
bugs. Yay! :D
2013-10-17 15:28:55 +02:00
Jonas Kulla 52dd1dbe2f Bitmap: Add warning to 'flush()' 2013-10-17 15:28:43 +02:00
Jonas Kulla f67a73cb4f Attempt at better documentation for SceneElement subclasses 2013-10-17 15:27:48 +02:00
Jonas Kulla f5a178b9bb Add config option "fixedFramerate" 2013-10-17 02:18:16 +02:00
Jonas Kulla 9dcd09d64f Serialization: Fix typos resulting in corrupted data 2013-10-17 01:01:25 +02:00
Jonas Kulla 9e3d7f579c Bitmap: Use PixelStore to avoid aux clip surface 2013-10-16 22:54:05 +02:00
Jonas Kulla 397856089d Tilemap: Optimize atlas assembly from mega surface tileset
Use 'glPixelStorei()' parameters to upload sub images
directly from the same surface instead of creating
helper surfaces to upload from.
2013-10-16 19:20:36 +02:00
Jonas Kulla 94911b61a6 Revert "Always request OpenGL Core profile"
This reverts commit 34d4103111.

Turns out we need at least GLSL 1.50, for which we'd
have to throw our OpenGL 2.0 compatibility in the water.
Nope, not yet.
2013-10-16 00:04:01 +02:00
Jonas Kulla 1e98413a7e Init: Print various GL implementation strings 2013-10-15 23:19:52 +02:00
Jonas Kulla 6b20147a72 Table: Minor cleanups
Fix up comment style and remove the MIN macro
in favor of the template defined in util.h.
2013-10-15 19:39:29 +02:00
Jonas Kulla bf5e80dd6a Init: Check for OpenGL 2.0 and destroy context on error 2013-10-15 19:35:03 +02:00
Jonas Kulla 36b904ede3 Clean up serialization helpers and add endianness check
We don't handle big endian at the moment, so let's
error out on that.
2013-10-14 12:57:30 +02:00
Jonas Kulla 2a83cfc1e1 Init: glClear the window as early as possible 2013-10-14 03:03:31 +02:00
Jonas Kulla caccee5db2 Fix up glew include paths 2013-10-14 02:22:34 +02:00
Jonas Kulla 39436ad231 Fix up SDL2 include paths
Using "SDL2/SDL_xxx.h" instead of "SDL_xxx.h" caused
the include paths provided by pkg-config to be ignored,
and headers from a standard include path to be used instead.
2013-10-13 23:21:34 +02:00
Jonas Kulla 8b9c501249 Remove useless SDL_Init() flag 2013-10-13 23:07:40 +02:00
Jonas Kulla 23e712a730 Tilemap: Draw consecutive scanrows in one draw call
If consecutive scanrows in the scene list have no foreign
elements in between them, we batch them up and draw them
in one glDrawElements() call.

This should reduce the Tilemap induced draw calls on
average by at least 50 percent.
2013-10-13 22:00:38 +02:00
Jonas Kulla 99cfe9aefd Tilemap: Optimize scanrow z ordering 2013-10-13 12:58:56 +02:00
Jonas Kulla 69637c75af Replace Qt functions deprecated in 5.0 2013-10-11 10:32:56 +02:00
Jonas Kulla 8b96174457 Fix broken asset include path 2013-10-10 12:50:04 +02:00
Jonas Kulla 4af4f5bd6b Ensure attached autotiles aren't mega surfaces 2013-10-09 18:08:44 +02:00
Jonas Kulla 8b53681e11 Turn on 'fixedAspectRatio' by default
This is more consistent with RMXP's behavior.
2013-10-09 14:17:21 +02:00
Jonas Kulla f8e8ece946 Forgot to add license header 2013-10-09 13:44:15 +02:00
Jonas Kulla cb6f73f7df Rename 'GlobalState' to 'SharedState' to avoid confusion with GLState
This was particularly nasty with the shorthand macros
'gState' and 'glState'. The former is now 'shState'.
2013-10-09 12:30:33 +02:00
Jonas Kulla 807bee5748 Print info about shader compilation to console 2013-10-09 12:26:42 +02:00
Jonas Kulla ba304feb54 Minor code move
Move animation based state data together and add comments
2013-10-09 11:52:39 +02:00
Jonas Kulla 34d4103111 Always request OpenGL Core profile 2013-10-08 06:29:05 +02:00
Jonas Kulla dd25323cdd Ifdef out more RGSS2 functionality 2013-10-06 10:28:03 +02:00
Jonas Kulla 49e7b66a53 Bitmap: s/tex/gl 2013-10-06 08:54:16 +02:00
Jonas Kulla 89238aebe9 s/rgss/RGSS 2013-10-06 07:11:03 +02:00
Jonas Kulla 26843f2e51 Implement FPS display (F2 to toggle ON/OFF) 2013-10-06 07:05:01 +02:00
Jonas Kulla 41675859dd Actually destroy duplicated PHYSFS_Io instance on close
Fixes crash after loading about a hundred maps
2013-10-06 05:11:22 +02:00
Jonas Kulla 958af38442 Optimize archive reading
This should be almost as fast as reading unencrypted
files from disk now. I also don't see any possible further
optimizations, so this is probably as fast as it gets.
2013-10-04 07:52:40 +02:00
Jonas Kulla a9fc44f79d Fix filesystem init for relative 'gamePath's 2013-10-03 22:11:25 +02:00
Jonas Kulla 4ddc487f17 Fix a critical bug with seeking in archives
Also, other small cleanups on the way.
2013-10-03 22:09:35 +02:00
Jonas Kulla d20b652155 No point in drawing spaces 2013-10-03 00:48:12 +02:00
Jonas Kulla d8dab9c429 Start ifdef'ing out RGSS2 functionality 2013-10-02 22:40:09 +02:00
Jonas Kulla 751b9c3ae5 Clip text surface to texture bounds on fast upload 2013-10-02 21:39:44 +02:00
Jonas Kulla bb70c39811 Ensure SDL_image and SDL_ttf initialize correctly 2013-10-02 13:50:58 +02:00
Jonas Kulla 0f58852e2b Remove GL_ARB_imaging requirement
Mesa doesn't have it, and I'm not sure it really
serves any purpose at all.
2013-10-02 13:35:14 +02:00
Jonas Kulla 7b97075282 Remove unnecessary allocations 2013-10-01 18:27:22 +02:00
Jonas Kulla a54acce6b7 Implement Bitmap 'blur'
I was a bit confused at first because I thought Enterbrain
had actually implemented a full Gaussian blur, but nope,
just dumb averaging.
2013-10-01 18:12:52 +02:00
Jonas Kulla 20ec560145 Wrap color clear in 'FBO::clear()' convenience function 2013-10-01 13:10:14 +02:00
Jonas Kulla ceb7821362 Minor code style fix 2013-10-01 12:15:28 +02:00
Jonas Kulla 8baa76541c Merge branch 'bitmap_blur' 2013-10-01 12:06:40 +02:00
Jonas Kulla baff4e362e Fix minor GPU timer query issue 2013-10-01 12:05:58 +02:00
Jonas Kulla 9f26ff9fb0 Port over Bitmap 'radial_blur' from old SFML codebase
This implementation is also heaps better than the old
one as it doesn't use a (differently sized) aux texture,
meaning the Bitmap discards its old texture and aquires
one of same size, making reuse through the TexPool a
lot more likely. It also saves on the aux texture blits
and binding switches.

As the setup / resource acquisition far outweighs the
actual rendering cost, operation time is relatively
constant no matter how many divisions are used.
2013-10-01 12:03:20 +02:00
Jonas Kulla b5afeadb5b Fix null deref 2013-10-01 02:29:02 +02:00
Jonas Kulla 73d5cb5bad Comment out unsupported audio formats 2013-10-01 02:28:46 +02:00
Jonas Kulla 408864339f Implement case insensitive path resolution 2013-09-30 21:20:29 +02:00
Jonas Kulla f49b03ba23 Window: Always rebuild cursor_rect tex coords
If the same Window updated its control verts without a visble
cursor_rect, these tex coords will get randomly overwritten by
further control parts.
2013-09-30 19:32:45 +02:00
Jonas Kulla 05f73f0b98 Ensure Elements don't unlink from an already dead Scene 2013-09-30 19:30:27 +02:00
Jonas Kulla 9d34fc966b Tilemap: Clamp sampled tileset height to multiple of 32 2013-09-30 01:38:46 +02:00
Jonas Kulla 2226927b08 Null deref fixes / cleanups 2013-09-28 21:48:02 +02:00
Jonas Kulla 1737ec9af4 Fix 'Rect::isEmpty()' and small performance fixes
Specifically, don't emit the 'valueChanged' signal
if nothing actually changed.
2013-09-28 21:45:33 +02:00
Jonas Kulla 4c06b676ad Spacing and minor fixes 2013-09-28 21:30:51 +02:00
Jonas Kulla 307eeb732d Factor out performance timers into separate files
This should make graphics.cpp somewhat easier to navigate/read.
GL_EXT_timer_query is also made optional, and if it's not present
dummy functions will be called instead.
2013-09-27 16:54:01 +02:00
Jonas Kulla 92525cd077 Make this mess of performance measuring a bit more readable 2013-09-27 04:47:12 +02:00
Jonas Kulla 12c92d6dd0 Fix Tilemap's scanrow z sorting for good
Also make it a tad faster.
2013-09-27 04:42:22 +02:00
Jonas Kulla 97d0794c7c Remove Serializable's virtual destructor. It didn't do anything anyway.
To still make the compiler happy, add virtual destructors
to all descendants of Serializable.
2013-09-27 04:39:35 +02:00
Jonas Kulla 92ab65ba52 Fix window opacity not being applied on vert (re)construction 2013-09-27 04:37:56 +02:00
Jonas Kulla 43aacc13d9 Add equality op that compares against a clamped integer 2013-09-27 00:55:48 +02:00
Jonas Kulla 35521c25c0 Don't hide cursor when window isn't focused 2013-09-25 20:35:00 +02:00
Jonas Kulla dff2d79a70 Implement blits from mega surfaces to regular Bitmaps
This is used in events that take their sprite from a tile
out of the tileset.
2013-09-25 17:07:43 +02:00
Jonas Kulla 0fc6022dd0 Use BlitSurface instead of UpperBlit (for forward-compat) 2013-09-25 17:07:26 +02:00
Jonas Kulla cfcfc2fd5e Fix wrong pixel format specified for upload 2013-09-25 15:13:45 +02:00
Jonas Kulla 0a17f9ccad Return advance as width for italic characters 2013-09-25 13:49:54 +02:00
Jonas Kulla 32361e513a Track 'tainted' area of Bitmaps to optimize blit operations
The 'tainted' area of a Bitmap describes what parts are no
longer in a 'cleared' state. When we blit to a fully cleared
are of a Bitmap at full opacity, we can completely disregard
the existing pixels in the operation, meaning we can skip any
blending calculations and just blit / upload straight to the
texture. This greatly speeds up text message rendering.

In the process, pixman has become a new dependency for mkxp,
but the results of this optimization are well worth it!
2013-09-25 13:49:24 +02:00
Jonas Kulla e903d8cb0f One last null pointer deref slipped through ;) 2013-09-24 23:00:16 +02:00
Jonas Kulla fe557bca1d Implement "show_cursor" attribute in Graphics module
If false (the default), the system cursor is hidden
inside the game window.
2013-09-24 22:56:25 +02:00
Jonas Kulla a9454fdf9c Fix nullpointer deref 2013-09-24 22:42:10 +02:00
Jonas Kulla 4f08382c69 Replace 'tiles.bufferCount' with function 2013-09-24 20:11:55 +02:00
Jonas Kulla 41e1187063 Just realized the word 'Row' makes no sense whatsoever 2013-09-24 20:06:11 +02:00
Jonas Kulla a327d4c324 Fix valgrind warning (value might be uninitialized) 2013-09-24 19:56:36 +02:00
Jonas Kulla 10ec55e39b Implement a new tileset atlas layout to allow for bigger tilesets
The atlas packing algorithm has been reworked to pack autotiles
and tileset very efficiently into a texture, splitting the tileset
in multiple ways and eliminating the previous duplication of image
data in the atlas across "frames". Animation, which these frames
were designed for, is now done via duplicated buffer frames,
ie. each animation frame has its own VBO and IBO data. This was
not done to save on VRAM (hardly less memory is used), but to
make place for the new atlas layout.
Thanks to this new layout, even with a max texture size of 2048,
one can use tilesets with up to 15000 height. Of course, such
a tileset couldn't be stored in a regular Bitmap to begin with,
which is why I also introduced a hack called "mega surfaces":
software surfaces stored in RAM and wrapped inside a Bitmap,
whose sole purpose is to be passed to a Tilemap as tilesets.

Various other minor changes and fixes are included.
2013-09-24 19:35:38 +02:00
Jonas Kulla b85988d194 Fix typo 2013-09-23 11:18:20 +02:00
Jonas Kulla da4e0fbed0 Implement smooth scaling 2013-09-23 11:00:50 +02:00
Jonas Kulla f00136c489 Implement fixed aspect ratio 2013-09-23 10:39:16 +02:00
Jonas Kulla 7a6c05bba0 Implement animated flash tiles in Tilemap
Flash tiles start with an alpha of 60, which ramps up to 120
in 16 frames and 4 steps, then ramps down again over the same period.
2013-09-23 08:27:28 +02:00
Jonas Kulla 9e63fb6b64 Remove the remaining bits of deprecated GL usage
The drawing is now completely shader based, which makes away
with all usage of the depracted matrix stack. This also allows
us to do things like simple translations and texture coordinate
translation directly instead of doing everything indirectly
through matrices.

Fixed vertex attributes ('vertexPointer()' etc) are also
replaced with user defined attribute arrays.
2013-09-23 07:50:22 +02:00
Jonas Kulla abce6c94b0 Properly emit valueChanged in Rect setters 2013-09-23 00:03:43 +02:00
Jonas Kulla 660cb9e05a Always set rqTermAck to true after binding returns 2013-09-23 00:02:28 +02:00
Jonas Kulla f4f0748d68 Cosmetic changes 2013-09-21 14:45:27 +02:00
Jonas Kulla 4aed9ef1a7 Add Vec2 conversion method to 'Vec2i' 2013-09-10 04:25:58 +02:00
Jonas Kulla d1bfc1e50c Properly free RWops associated with Font objects 2013-09-10 04:19:45 +02:00
Jonas Kulla 6f711184ac Spacing 2013-09-09 21:32:34 +02:00
Jonas Kulla 39233a036b Rename constant 2013-09-09 21:23:56 +02:00
Jonas Kulla a66b15bd08 Pack REQUEST event codes into enum 2013-09-09 21:22:31 +02:00
Jonas Kulla 4620901002 Forgot some EXT functions 2013-09-07 02:42:56 +02:00
Jonas Kulla 051c939f8d Free SDL surface if 'TexPool::request' throws 2013-09-06 15:52:45 +02:00
Jonas Kulla 6c7d751dbd Remove 'Default' FBO binding (only allow 'Read' and 'Draw')
Also make code more verbose by removing default mode
parameter value to 'FBO::bind'
2013-09-06 14:56:30 +02:00
Jonas Kulla abc927c91d Use EXT version of gl functions 2013-09-06 14:37:28 +02:00
Jonas Kulla ef6bacf201 Only require EXT framebuffer extensions 2013-09-06 14:21:35 +02:00
Jonas Kulla a9f400e64a Undef utility macro in header 2013-09-06 13:14:34 +02:00
Jonas Kulla 3bd9df1191 Move draw order sorting into SceneElement 2013-09-06 13:10:41 +02:00
Jonas Kulla 5ca513fcec Document gl-util types 2013-09-06 12:33:33 +02:00
Jonas Kulla b151a22f6e Rename 'Tex' to 'TEX' for consistency 2013-09-06 12:26:41 +02:00
Jonas Kulla ba3b904f34 Thanks to the ID abstraction, we can use proper overloading now! 2013-09-06 12:22:55 +02:00
Jonas Kulla 55596e9da9 Rename 'RB'(renderbuffer) to 'RBO'(renderbuffer object) 2013-09-06 12:16:24 +02:00
Jonas Kulla a21423ca1c Move GL state initialization into GLState 2013-09-04 21:05:47 +02:00
Jonas Kulla f89cd2d207 Provide general purpose Quad in GlobalState 2013-09-04 19:07:28 +02:00
Jonas Kulla efa55ce6c2 Raise exception on invalid bitmap sizes
A difference to RMXP is that negative height values
will result in exceptions too.
Also change Bitmap constructors to not allocate Private
struct before potential exceptions.
2013-09-04 18:14:29 +02:00
Jonas Kulla 6a85699e11 Properly destroy fade thread 2013-09-04 17:53:12 +02:00
Jonas Kulla abd59be30d Properly delete[] arrays 2013-09-04 17:52:03 +02:00
Jonas Kulla 689a31580c Beautify constant 2013-09-04 17:03:00 +02:00
Jonas Kulla 1401578f92 Add bounds check to setter 2013-09-04 17:01:51 +02:00
Jonas Kulla 4a945f8d6c Null PhysFS handle after closing 2013-09-04 13:32:11 +02:00
Jonas Kulla 0253b6ed2b Use C99 integer types instead of Qt's 2013-09-04 13:30:14 +02:00
Jonas Kulla a75dea3ffe Rename 'resetInput' to 'resetInputStates' 2013-09-04 13:28:05 +02:00
Jonas Kulla d0fa2dd37a Document 'WindowSizeNotify' 2013-09-04 12:09:09 +02:00
Jonas Kulla 5b6d4e0026 Clean up remainind references to 'render thread' 2013-09-04 12:07:59 +02:00
Jonas Kulla c2585660b7 Remove unnecessary variable 2013-09-04 11:31:35 +02:00
Jonas Kulla 3761c62d86 Spacing 2013-09-03 16:47:53 +02:00
Jonas Kulla 84db116d0c Rename 'bound' to 'clamp' 2013-09-03 15:31:29 +02:00
Jonas Kulla f81e20cc68 Raise exception on too big textures 2013-09-03 15:22:00 +02:00
Jonas Kulla 31c007b541 Mark internal methods 2013-09-03 15:21:44 +02:00
Jonas Kulla 6a133cf04b Clean up unused code and documentation 2013-09-03 14:51:55 +02:00
Jonas Kulla 6c5745c4bf FloatRect: add implicit IntRect conversion 2013-09-03 14:51:13 +02:00
Jonas Kulla 108392217f Remove empty line 2013-09-03 11:15:04 +02:00
Jonas Kulla 57c806e9b5 Add "[Binding]" config subgroup
Binding specific configuration goes here. It is stored as
a String->Value hash.
2013-09-03 11:07:56 +02:00
Jonas Kulla 8674cb8e06 Always glClear before blitting to screen
Prevents a distorted screen when an error happens during
script loading (ie. before the first drawn frame) and fullscreen
is turned on in the config.
This will also be necessarry once fixed aspect ratio is implemented.
2013-09-02 17:31:34 +02:00
Jonas Kulla 0477c3f8db Remove wrong extension check 2013-09-02 13:40:16 +02:00
Jonas Kulla 7ea875ae5d Minor cleanups and documentation 2013-09-02 12:32:53 +02:00
Jonas Kulla 0ab438af64 Add more gl extensions and spacing 2013-09-02 11:13:22 +02:00
Jonas Kulla 6bebfa90e1 Fix spacing 2013-09-02 06:14:46 +02:00
Jonas Kulla dff6acebca Remove more leftovers 2013-09-02 06:02:50 +02:00
Jonas Kulla 691c4b7728 Add GPL license header 2013-09-01 18:26:36 +02:00
Jonas Kulla ff25887f41 Initial commit 2013-09-01 16:27:21 +02:00