Commit Graph

192 Commits

Author SHA1 Message Date
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 906f9fae17 BitmapBlitShader: Try a bit harder
It's not really perfect yet, but it looks a lot closer
to what was there before.
2013-10-22 06:40:24 +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 aa786e268d Remove unused code 2013-10-20 21:04:30 +02:00
Jonas Kulla 27341dc95d MRI-Binding: Enforce UTF-8 strings in 'Marshal::load()' via aux proc
We override 'Marshal::load()' via alias and call it with
a custom auxiliary proc in the alias which sets the encoding
of all demarshalled strings to UTF-8. The case where a user
himself provided a proc to 'load()' is not implemented.

This is definitely a better solution than patching the ruby
source tree. Thanks to github.com/cremno for hints and help!
2013-10-20 20:54:56 +02:00
Jonas Kulla e14f3ef9db Readme: mention ruby patches 2013-10-19 19:59:18 +02:00
Jonas Kulla d8aa5f2b0d Add patches for ruby source tree 2013-10-19 19:00:08 +02:00
Jonas Kulla 30507d2f6f MRI-Binding: Enforce UTF-8 string encoding 2013-10-19 18:57:34 +02:00
Jonas Kulla d5bc71f7ba MRI-Binding: Add 'System.puts()' for console printing 2013-10-19 15:54:21 +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 1759a1b4a9 MRI-Binding: Fix Audio fade functions all fading the BGM 2013-10-17 01:02:09 +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 26bc4842c0 MRI-Binding: Catch exceptions in '_load' implementations 2013-10-15 05:12:20 +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 0f4a9930de README: fix more inconsistencies 2013-10-12 15:59:52 +02:00
Jonas Kulla f520b5a32e Fix ruby include paths for config.h, on amd64 2013-10-12 12:51:43 +02:00
Jonas Kulla 95daa78ef7 Clarify points in readme 2013-10-11 22:28:54 +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 4b28314433 Update config table and default values 2013-10-09 14:11:59 +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 6a4fd804a7 Clarify point about latest library version 2013-10-09 04:16:00 +02:00
Jonas Kulla 34d4103111 Always request OpenGL Core profile 2013-10-08 06:29:05 +02:00
Jonas Kulla 6fef49f42a Cosmetic fixes 2013-10-08 06:05:06 +02:00
Jonas Kulla a108843069 Add 'System.data_directory()' for save files etc.
Just a small wrapper around SDL2's GetPrefPath()
2013-10-08 06:04:21 +02:00
Jonas Kulla dd25323cdd Ifdef out more RGSS2 functionality 2013-10-06 10:28:03 +02:00