Commit Graph

651 Commits

Author SHA1 Message Date
Jonas Kulla a4615fb8cc Add copyright notice to gl-fun.{cpp,h} 2014-06-15 07:52:26 +02:00
Jonas Kulla 6808b9a6dd SoundEmitter: Optimize source allocation strategy
Before, we would blindly rotate through the sources (like a
revolver through its chambers), which worked great if one
assumed all sounds to be relatively short and therefore oldest
use == most likely to be free, but breaks if there is one long
sound playing, which would be stopped and overtaken if we rotated
back to it even though there might be other free sources available.

Instead, keep an ascending priority list of sources with last
used == highest priorty that is iterated through for the first
free one, and only if none is found overtake the one with lowest
priority. This also ensures we're always able to play 'SE_SOURCES'
sounds at once independently of their length.

Fixes #37.
2014-06-15 06:26:34 +02:00
Jonas Kulla 282d547ad4 Remove Perftimer classes
Performance can still be crudely measured by turning off
the framelimit and observing the FPS count. For everything
else, there's always callgrind / apitrace.
2014-06-13 19:01:15 +02:00
Jonas Kulla 6c481e5eb8 Eliminate GLEW dependency
GL entrypoint resolution is now done manually. This has a couple
immediate benefits, such as not having to retrieve hundreds of
functions pointers that we'll never use. It's also nice to have
an exact overview of all the entrypoints used by mkxp.

This change allows mkxp to run fine with core contexts, not sure
how relevant that is going to be in the future.

What's noteworthy is that  _all_ entrypoints, even the ones core
in 1.1 and guaranteed to be in every libGL, are resolved
dynamically.
This has the added benefit of not having to link directly against
libGL anymore, which also cleans up the output of `ldd` quite
a bit (SDL2 loads most system deps dynamically at runtime).

GL headers are still required at build time.
2014-06-13 18:46:45 +02:00
Jonas Kulla 640b01e518 Graphics: Fix double calculation being a fixed point division 2014-06-12 14:31:29 +02:00
Jonas Kulla 3ac8f1e8aa Actually, don't disable that on Windows 2014-06-12 12:54:10 +02:00
Jonas Kulla aed7ba6672 Graphics: Check for nanosleep errors, disable on Windows (for now) 2014-06-12 10:40:17 +02:00
Jonas Kulla 06b218d5d7 Don't rely on non-standard typedef (thanks @ntzrmtthihu777) 2014-06-08 06:59:35 +02:00
Jonas Kulla 013437074b gitignore: Add codeblocks files 2014-06-08 06:55:37 +02:00
Jonas Kulla 2cc2ebca31 GLState: Get rid of GL_TEXTURE_2D enable/disable
This bit was deprecated/removed in core GL.

There was only one place where this was used (flash tiles
in Tilemap), and since the full shader rewrite, it was
effectively a no-op anyway (flash shader doesn't sample texture).
2014-05-30 23:13:58 +02:00
Jonas Kulla 7b1f599dd6 mkxp.pro: Add 'BOOST_LIB_SUFFIX'
Boost being boost.
2014-05-30 23:13:58 +02:00
Jonas Kulla 5ba40369cc Don't unnecessarily expose internal constant 2014-05-30 23:13:58 +02:00
Jonas Kulla ad63c962c6 Merge pull request #32 from cremno/use-rb_funcall2-instead-of-rb_funcallv
use `rb_funcall2` instead of `rb_funcallv`
2014-05-25 13:28:31 +02:00
cremno e6a116f43f use `rb_funcall2` instead of `rb_funcallv`
In 2.1 `rb_funcall2`  was renamed to `rb_funcallv` and
a macro for backward compatibility was added.
2014-05-25 12:57:04 +02:00
Jonas Kulla 0ef68a2eb7 Audio: Remove unused float helper code
Let's us get rid of 'alext.h' include,
which doesn't exist on OSX.
2014-05-24 18:26:04 +02:00
Jonas Kulla ce0fee0641 Spacing 2014-05-24 18:24:51 +02:00
Jonas Kulla 70279f0fdc mkxp.pro: Remove stray linker parameter 2014-05-24 18:24:10 +02:00
Jonas Kulla ea20154978 Spacing 2014-05-22 05:49:06 +02:00
Jonas Kulla 66fe932a8e Remove useless code 2014-05-21 18:11:31 +02:00
Jonas Kulla 2d30301aef DebugWriter: Add std::vector print handler 2014-05-21 18:10:46 +02:00
Jonas Kulla 32bb18d93f Spacing 2014-05-21 18:10:14 +02:00
Jonas Kulla d09f4a1bae Typo 2014-05-21 18:08:31 +02:00
Jonas Kulla e74f889bc5 Quad: Don't discard VBO on each update
This never yielded any traceable performance gains.
I also apparently forgot to unbind the buffer after
updating.
2014-05-16 21:39:26 +02:00
Jonas Kulla 8dd7c1b48c Spacing/spelling 2014-05-07 17:52:11 +02:00
Jonas Kulla 72fc659a4c MRI-Binding: Don't refine Kernel#caller in RGSS3 2014-05-07 03:19:06 +02:00
Jonas Kulla 1bdcfa7b04 MRI-Binding: Adjust 'Kernel#caller' output to match RMXP 2014-05-06 12:13:12 +02:00
Jonas Kulla c6a3c5aa59 Graphics: Setting 'fixedFramerate' to -1 disables frame limit
Can be useful for benchmarking
2014-05-05 09:21:20 +02:00
Jonas Kulla 627ff66e7a mkxp.pro: Add 'EMBED' files to 'OTHER_FILES'
So they show up in the project tree in QtCreator.
2014-05-03 04:07:07 +02:00
Jonas Kulla 80b2768e73 Fix "unused variable" warning 2014-05-03 04:05:11 +02:00
Jonas Kulla 58d86039d5 Merge branch 'dev' 2014-04-17 08:19:24 +02:00
Jonas Kulla 4cb1c10c3a Minor declaration fix 2014-04-16 20:54:29 +02:00
Jonas Kulla 4e346cac27 Merge pull request #25 from cremno/mri-improve-error-printing
MRI: improve error printing
2014-04-16 20:22:58 +02:00
cremno bd6764450f fix comment style 2014-04-16 20:05:15 +02:00
Jonas Kulla f11cc182df Remove screenshot functionality
It was only meant for debugging and brought with it
unneeded platform dependant issues.
2014-04-16 13:48:45 +02:00
Jonas Kulla 1ef6e04520 Font: Overhaul font asset discovery
Previously, any font names requested by RGSS would be translated
directly to filenames by lowercasing and replacing spaces with
underscores (and finally doing some extension substitution).
To make this whole thing work smoother as well as get closer to
how font discovery is done in VX, we now scan the "Fonts/" folder
at startup and index all present font assets by their family name;
now, if an "Open Sans" font is present in "Fonts/", it will be
used regardless of filename.

Font assets with "Regular" style are preferred, but in their
absence, mkxp will make use of any other style it can find for
the respective family. This is not the exact same behavior as
VX, but it should cover 95% of use cases.

Previously, one could substitute fonts via filenames, ie. to
substitute "Arial" with "Open Sans", one would just rename
"OpenSans.ttf" to "arial.ttf" and put it in "Fonts/". With the
above change, this is no longer possible. As an alternative, one
can now explicitly specify font family substitutions via mkxp.conf;
eg. for the above case, one would add

fontSub=Arial>Open Sans

to the configuration file. Multiple such rules can be specified.

In the process, I also added the ability to provide
'Font.(default_)name' with an array of font families to search
for the first existing one instead of a plain string.
This makes the behavior closer to RMXP; however, it doesn't
work 100% the same: when a reference to the 'Font.name' array is
held and additional strings are added to it without re-assignig
the array to 'Font.name', those will be ignored.
2014-04-16 13:37:22 +02:00
Jonas Kulla 31626c9acc Spacing 2014-04-16 13:06:16 +02:00
Jonas Kulla 51c5ca1410 Graphics: Taint entire Bitmap in #snap_to_bitmap 2014-04-15 19:05:36 +02:00
Jonas Kulla f25d2db63c MRI-Binding: Add RGSS3 '__FILE__' variant 2014-04-15 11:54:22 +02:00
Jonas Kulla 711060db8f Spacing / minor fixes 2014-04-14 09:39:23 +02:00
cremno 4ca9e82a14 MRI: improve error printing
`Debug()` is CRuby-style and `showMsg` is RGSS-style.
The `Debug()` output is safe, `showMsg` might be fragile.
2014-04-14 00:07:51 +02:00
Jonas Kulla ab9464006b Merge pull request #24 from cremno/mri-rewrite-script-eval
MRI: rewrite script eval
2014-04-12 11:54:13 +02:00
cremno 95c112bbe4 MRI: add option to use a script's name as filename 2014-04-11 18:11:32 +02:00
cremno 8bc17a9a98 MRI: less `strlen` calls, use custom script's filename 2014-04-11 17:13:25 +02:00
Jonas Kulla 6dfa4f6b7d MRI-Binding: Add 'Graphics.width/height' bindings (RGSS2) 2014-04-11 13:34:19 +02:00
Jonas Kulla 8203e32900 MRI-Binding: Define 'msgbox' p/print aliases (RGSS3) 2014-04-11 13:31:09 +02:00
cremno f6ec364632 MRI: rewrite script eval
- set __FILE__ (RGSS 1 and 2)
 - set Ruby string encoding to UTF-8
   instead of using a magic comment
2014-04-10 14:00:05 +02:00
cremno 06b877a78c MRI: don't set $0 (see #24) 2014-04-10 02:14:25 +02:00
cremno 4e0262d2a7 MRI: fix $RGSS_SCRIPTS 2014-04-10 01:16:31 +02:00
cremno f8b87eb188 MRI: don't manually peform GC 2014-04-09 23:45:24 +02:00
cremno 804a697c03 MRI: add $RGSS_SCRIPTS 2014-04-09 22:36:56 +02:00