Commit graph

53 commits

Author SHA1 Message Date
Clownacy
c4aa8e28bb More refactoring 2020-04-01 14:57:07 +01:00
Clownacy
5dbca99e19 Extremely horrible terrible nightmare refactoring
Working on ridding CSE2 of its hard SDL2 dependency.

For now, I have a rudimentary GLFW3 backend.
2020-03-31 21:56:10 +01:00
Clownacy
e3cd7ce353 Add glyph-batching to OpenGL renderer
Unfortunately, sub-pixel font rendering had to go. It wasn't portable
anyway (not every display is an LCD with R->G->B ordering).
2020-02-01 22:37:59 +00:00
Clownacy
eaf2de05b6 Add glyph-batching to the SDLTexture backend
Hope it will be this easy for the OpenGL backend
2020-02-01 17:49:26 +00:00
Clownacy
639039ce3a Added Backend_PrepareToDrawGlyphs
This is to reduce OpenGL context changes, and help pave the way for
glyph-batching
2020-02-01 16:40:23 +00:00
Clownacy
b650294b8b Change LoadFileToMemory's function signature 2020-01-26 20:06:31 +00:00
Clownacy
1fe73f9aab Explicitly compare pointers in Font.cpp to NULL 2020-01-23 01:05:29 +00:00
Clownacy
3c9ff22c22 Add better error-handling to Font.cpp
Co-authored-by: Gabriel Ravier <gabravier@gmail.com>
2019-11-09 14:19:26 +00:00
Clownacy
e4fcf6a5e1 Fixed spacing for fonts that aren't Courier New
Previous, I used a godawful hack to emulate Windows' API, but it
seems this only ever worked for Courier New: with something like
Liberation Mono, it would squash the font. Now I'm just giving up on
it, and using actual font sizes rather than "cell" sizes.

I'm not sure if this is accurate the original EXE.
2019-09-04 19:21:51 +00:00
Clownacy
ae8aeae2ac Restored the new font system 2019-09-04 15:43:28 +00:00
Clownacy
f956eb9264 Mostly ASM-accurate Draw.cpp
See #74
2019-08-31 17:43:45 +01:00
Clownacy
ce8b5651bc Give the FONT_PIXEL_MODE enums a type 2019-08-21 16:25:02 +00:00
Clownacy
4f057dd72a Revert "Split glyph surface creation and pixel upload"
This reverts commit 5da3b72fca.
2019-08-14 16:30:48 +00:00
Clownacy
f354b84f6a Revert "Glyphs now regenerate with the rest of the game's textures"
This reverts commit aa6174b3f2.
2019-08-14 16:26:37 +00:00
Clownacy
aa6174b3f2 Glyphs now regenerate with the rest of the game's textures
God-damn this code is ugly
2019-08-13 18:32:44 +01:00
Clownacy
5da3b72fca Split glyph surface creation and pixel upload
When DirectX-SDL2 loses its device, it doesn't lose its textures,
just their contents, so we shouldn't remake the textures when we
regenerate the glyphs (that's coming next commit).
2019-08-13 18:02:14 +01:00
Clownacy
dddf968810 Backend_SupportsSubpixelGlyph -> Backend_SupportsSubpixelGlyphs 2019-08-13 05:14:37 +00:00
Clownacy
3f8ead09d6 Renderer backend simplification part 1: Draw.cpp and Software.cpp
By emulating the DirectDraw code more closely, I can simplify the
renderer backend API.
2019-08-13 01:39:08 +00:00
Clownacy
85f58d7d39 Rendering backend API naming improvements 2019-08-10 19:50:10 +01:00
Clownacy
ac273d2d7c Make the ShiftJIS->Unicode translation table *slightly* less ugly 2019-08-08 05:22:24 +00:00
Clownacy
8acd46bce6 Move the font gamma-correction up to Font.cpp
Reduces duplicate code
2019-08-08 05:04:08 +00:00
Clownacy
7e04741c29 Correct the rendering backend glyph API, and add a missing #include
For some reason, FT_BITMAP's 'width' member specifies subpixels,
not pixels as the documentation says.
2019-08-07 22:31:45 +00:00
Clownacy
6a7fd14833 Font refactor part 2: SDL_Surface
No per-component alpha support here
2019-07-23 17:20:56 +01:00
Clownacy
6d385e674f Font refactor part 1: Software
With this, font blitting is handled by the rendering backend, paving
the way for hardware-accelerated font drawing in the accelerated
backends.
2019-07-23 16:38:04 +01:00
Clownacy
24d104e2e8 Tweak in Font.cpp
MSVC2003 would complain about that code because it didn't understand
the C++ standard. It looked ugly anyway.
2019-07-19 09:02:17 +01:00
Clownacy
a679373c14 Disable font anti-aliasing when FIX_BUGS is enabled
It causes ugly artifacting around the text
2019-07-15 18:20:24 +00:00
Clownacy
c80b593a3f Some #include fixes
Finally figured out how to get include-what-you-use working
2019-06-06 18:44:28 +00:00
Clownacy
d2b5872c95 Weeded out some bool usage
Cave Story was written in C89. No bools. I've left in Sound.cpp's
though, since that's written in C++98 currently.
2019-05-24 10:07:30 +01:00
Clownacy
ac904aa4ae Fixed uninitialised pointer 2019-04-22 00:40:03 +01:00
Clownacy
cc4eb82162 Added caching to the font system
I never liked how much of a bottleneck the font renderer was. Maybe now
the credits won't stutter like mad on the Raspberry Pi.
2019-04-21 23:54:05 +01:00
Clownacy
f25df2ce07 Remove SDL2 dependency from Font.cpp 2019-04-21 21:28:18 +01:00
Clownacy
c45326295a Minor Font.cpp cleanup 2019-03-11 22:19:12 +00:00
Clownacy
e864f7e142 Removed the alpha channel from the surfaces
It's not needed here, where we use a colour-key instead. The enhanced
branch will need it though.
2019-03-11 14:38:11 +00:00
Clownacy
c9b681299c Shut up some MSVC2003 warnings 2019-03-11 03:40:51 +00:00
Clownacy
6744235892 Added our own Shift-JIS to Unicode converter
This removes the dependency on iconv, meaning MSVC2003 should be able to
compile the Japanese build now.
2019-03-11 03:06:41 +00:00
Clownacy
2266a5ee6d Font code cleanup 2019-03-07 00:18:24 +00:00
Clownacy
8484fc2c2d Fix Font.cpp not expecting the font colour in BGR 2019-02-23 23:36:53 +00:00
Clownacy
01ddc5e923 Fixed some warning MSVC2003 was giving in /W3 mode 2019-02-23 21:45:57 +00:00
Clownacy
d55f72aeaf Another missing #include that MSVC2003 noticed 2019-02-23 15:25:49 +00:00
Clownacy
55f1d3a9fe Fixed some problems found while compiling most of this with VC++2003
I could compile most of this, but not link it (SDL2's .lib files must
be too new).
2019-02-20 03:55:05 +00:00
Clownacy
9203105235 Shut up some warnings 2019-02-19 22:57:00 +00:00
Clownacy
c44186d93a Ditched SDL's file IO for stdio and our own convenience functions
ASM-accurate file stuff can come later.
2019-02-15 20:33:08 +00:00
Clownacy
c844bc9f49 Avoid VLAs
'VLAs are bad because stack overflows' yeah yeah yeah except this
doesn't involve the stack at all.
2019-02-13 16:49:45 +00:00
Clownacy
d7813fd900 Fixed some warnings 2019-02-13 15:43:35 +00:00
Clownacy
f81fd7b1cd Fixed Japanese text 2019-02-09 22:52:47 +00:00
Clownacy
ee88e805b3 Fix some errors and prevent some GCC warnings 2019-02-05 22:51:44 +00:00
Clownacy
d52a69b0e6 Fix dumbass font problems
The 320x240 font is still one pixel too high, but honestly I don't give
a shit. It looks better anyway since the vanilla way is off-centre.
2019-02-01 13:50:32 +00:00
Clownacy
4f7db164d6 Overhauled graphics system
Along with being more accurate to the original, this fixes switching out
of fullscreen causing textures to disappear. This was caused by DirectX
destroying textures that are marked as render-targets when a device-loss
occurs. SDL2 doesn't do anything to recover them, unlike regular
textures, so my solution is just to avoid render-target textures
entirely.

On the upside, this should make drawing text to surfaces much faster,
since we're not reading back bitmaps from the GPU.
2019-01-30 21:07:47 +00:00
Clownacy
90ef30bece Added option for fonts to be loaded from Windows
This restores some compatibility with Config.dat's font settings.
2019-01-29 14:20:25 +00:00
Clownacy
b325efd981 Improved Japanese build a little 2019-01-25 12:02:52 +00:00