Commit Graph

264 Commits

Author SHA1 Message Date
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 c6fc1cb5ad Add '.sample' suffix to example configuration file 2013-09-29 18:25:19 +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 6b94dd6bcb Script binding vfuncs should be static 2013-09-28 21:27:11 +02:00
Jonas Kulla fa77726388 Remove unneeded shader uniform 2013-09-28 15:41:09 +02:00
Jonas Kulla 0717003114 Use 'snprintf()' instead of the unsafe variant 2013-09-27 19:50:23 +02:00
Jonas Kulla 080f9333a9 Clarify a couple README points 2013-09-27 19:44:16 +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 4ff563725b Make 'rb_get_args()' va_arg passing safer by introducing a termination marker
What can I say. I made a pact with the devil, and paid dearly.
Almost a whole day's worth of debugging, actually. Not again.

If this turns out to be slow we can always optimize the critical
parts (with no variable param count) later, or completely remove it.
2013-09-27 04:49:48 +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 6b2c892280 Simplify shader 2013-09-23 14:12:11 +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 7f604e25ad Lower minimum OpenGL requirement 2013-09-23 10:42:23 +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 88c1489554 Include vertex shader xxd's 2013-09-23 07:14:53 +02:00
Jonas Kulla 22050f7217 Add new shaders. Also output xxd'ed files to top dir. 2013-09-23 00:17:51 +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 e42e6398cb Add FIXME 2013-09-10 04:21:57 +02:00
Jonas Kulla 23c5be6fbe Catch errors that could happen when reading Scripts.rxdata 2013-09-10 04:21:41 +02:00
Jonas Kulla d1bfc1e50c Properly free RWops associated with Font objects 2013-09-10 04:19:45 +02:00
Jonas Kulla 80d0b33dda Add 'Makefile' / xxd+ binary to gitignore 2013-09-10 04:17:23 +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