Commit graph

2701 commits

Author SHA1 Message Date
Clownacy
a6408b330f Fix build error 2020-09-11 23:10:47 +01:00
Clownacy
a37e1d31f2 Remove extra newline 2020-09-11 13:06:52 +01:00
Clownacy
0324d1532b Apply SurfaceID type 2020-09-10 21:29:25 +01:00
Clownacy
1f88f7ffaf Make some code uniform 2020-09-10 21:26:22 +01:00
Clownacy
84c1e00c95 Tidy-up some code 2020-09-10 19:07:46 +01:00
Clownacy
69f3fbcd5a Change a dumb parameter 2020-09-10 17:56:22 +01:00
Clownacy
0fa538732d Use PrintError instead of ShowMessageBox 2020-09-10 17:48:21 +01:00
Clownacy
b065882f24 More size_t 2020-09-10 17:42:18 +01:00
Clownacy
988f1128dd Convert a bunch of ints to size_t
ints are dumb - only use them when you have to
2020-09-10 17:36:21 +01:00
Clownacy
8ad56ced43 Remove superfluous brackets 2020-09-10 16:08:53 +01:00
Clownacy
d80ef38af5 Lock SDL2 software renderer surface properly 2020-09-10 16:02:13 +01:00
Clownacy
f42a0530b0 Handle the framebuffer failing to lock
Also needed by SDL2
2020-09-10 16:02:02 +01:00
Clownacy
e90b903692 Change some variables to size_t
Really need to change the whole backend API to use size_t
2020-09-10 15:50:06 +01:00
Clownacy
b6c9467151 Switch software renderer to lockable framebuffer
SDL2 surfaces may require locking
2020-09-10 15:47:27 +01:00
Clownacy
0bdbb4f6bb Made some message-printing code more consistent 2020-09-10 15:39:10 +01:00
Clownacy
7c4a2b5caa Lock SDL_Surfaces 2020-09-08 18:53:06 +01:00
Clownacy
f1a85d4d2c Fix Wii U compilation 2020-09-08 12:55:19 +01:00
Clownacy
07f70200d0 Renderer cleanup 2020-09-08 12:48:25 +01:00
Clownacy
a0378dc30c Fix build errors 2020-09-08 12:48:17 +01:00
Clownacy
0a912b7f11 Change some type from int to size_t 2020-09-08 04:36:45 +01:00
Clownacy
4078182ee8 Add a bugfix for the blinking text cursor 2020-09-08 04:20:17 +01:00
Clownacy
f5828667a6 Update remaining platform backends 2020-09-08 04:04:27 +01:00
Clownacy
7d51a80007 Remove C++11 from GLFW3 platform backend 2020-09-08 03:56:52 +01:00
Clownacy
84d6b50bc2 Remove platform backend dependency on core engine
The backends need to have no dependency on the engine, otherwise
there'll be conflicts when we do stuff like include `window.h` in a
file that also happens to include "WindowsWrapper.h" somewhere.
2020-09-08 03:52:23 +01:00
Clownacy
bdcb1f3a3e Remove Organya dependency from platform backend 2020-09-08 03:36:11 +01:00
Clownacy
633ac64641 Go back to C++98
Now that `cute_spritebatch.h` is gone, there's only one other bit of
C++11 in the project that I can think of.
2020-09-08 03:24:55 +01:00
Clownacy
d1a9754784 Fix uninitialised memory usage 2020-09-08 03:23:36 +01:00
Clownacy
fcf1e9d0c4 Link glyph array from back to front
This way, glyphs are allocated from front to bacl, which makes the
atlas much more pleasant to look at.
2020-09-08 03:14:53 +01:00
Clownacy
80df145d3f Fix Japanese text
Sweet mercy I'm bad at FreeType2
2020-09-08 03:04:01 +01:00
Clownacy
b37e088465 Remove an empty line 2020-09-08 02:48:06 +01:00
Clownacy
f079a14b58 Update the SDLTexture renderer 2020-09-08 02:40:27 +01:00
Clownacy
0b83da1fd9 Make the Wii U batch its font rendering
Yaaaaaaaay
2020-09-08 02:12:37 +01:00
Clownacy
2eb5205dcc Remove cute_spritebatch.h 2020-09-08 01:58:51 +01:00
Clownacy
23156d38de Optimise OpenGL renderer a little 2020-09-08 01:55:57 +01:00
Clownacy
b080954a71 Wii U cleanup 2020-09-08 01:50:49 +01:00
Clownacy
bcf5513495 Updated Wii U renderer
Turns out it doesn't even batch the font stuff. I'll need to add that
later.
2020-09-08 01:17:07 +01:00
Clownacy
1d9446d425 Update SDLSurface renderer for new font batcher 2020-09-07 23:44:51 +01:00
Clownacy
096fa3b578 New custom font batcher
Previously, the font batching system was very shoddy: basically,
glyph bitmaps would be cached to system memory, and uploaded
on-demand to the GPU.

The OpenGL3, OpenGLES2, and SDLTexture backends relied on
`cute_spritebatch.h` to handle batching. While nice, this library is
overkill: it's intended for managing a whole game, not just a couple
of glyphs. It also depends on C++11, which is something I'd rather be
without.

Being so complex, it appears that internally it spams the backend
when merging atlases together. According to bug reports, this causes
the game to skip a lot of frames.

Instead, I've ditched the system-memory-side caching, and made the
game maintain its own atlas. Unlike `cute_spritebatch.h`, this one
doesn't purge glyphs after they've gone unused for 30(?) seconds -
instead, glyphs are only purged when room in the atlas runs out, at
which point the oldest glyph is replaced. This method doesn't involve
creating or destroying atlases at runtime, avoiding the overhead of
whatever OpenGL/DirectX do internally when that happens.

Currently only the OpenGL3, OpenGLES2, and Software renderers have
been updated with this - the others will fail to build.

I know immediate-mode renderers won't benefit from this, but it
replaces the leaky old caching system, so it's still an improvement.
2020-09-07 23:11:01 +01:00
Clownacy
1dcf3333fc Simplify some font logic 2020-09-06 20:30:47 +01:00
Clownacy
f4ffee2c99 Remove redundant font flag 2020-09-06 20:30:39 +01:00
Clownacy
34d3b8e664 Improve font rendering
This change fixes uneven glyph heights
2020-09-06 20:30:30 +01:00
Clownacy
df42d9300f Disable font anti-aliasing by default
CSE2 Portable is meant to be a purist thing - experiencing Cave Story
the way it was meant to be. The crappy font rendering was definitely
not how it was meant to be.
2020-09-06 17:10:46 +01:00
Clownacy
f908e2a064 Style tweaks 2020-09-06 15:26:57 +01:00
Clownacy
2963977cf9 Merge branch 'accurate' into portable 2020-09-04 02:36:19 +01:00
Clownacy
92d50ae187 Comment on a weird-ass Sleep call 2020-09-04 02:35:31 +01:00
Clownacy
3eced7b3e4 Implement the Sleep(100) call
Okay, seriously, why does the game do this?
2020-09-04 02:29:50 +01:00
Clownacy
bc165d0f0a Remove Organya-sleeping
Turns out that 'Sleep' call is ran on the *main* thread.

I have absolutely no idea why the game does this.
2020-09-04 02:26:31 +01:00
Clownacy
e2b5809990 Remove another explicit array size 2020-09-04 01:19:42 +01:00
Clownacy
7b1661dcf9 Merge branch 'accurate' into portable 2020-09-04 01:00:17 +01:00
Clownacy
b311888a12 Remove ccache in Travis file
This matches the portable branch
2020-09-04 00:57:00 +01:00