mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-09-29 18:38:13 +03:00
Windows: Embed default font as a resource
After this, embedded MTLc3m.ttf is used unless the -fontfile option is specified.
This commit is contained in:
@@ -4,38 +4,10 @@
|
||||
[ DRI ]
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#undef ERROR
|
||||
#endif
|
||||
#include "dri.h"
|
||||
#include "crc32.h"
|
||||
#include "../fileio.h"
|
||||
|
||||
namespace {
|
||||
|
||||
SDL_RWops* open_resource(const char* name, const char* type) {
|
||||
#ifdef _WIN32
|
||||
// On Windows, read from resource.
|
||||
HINSTANCE hInst = GetModuleHandle(NULL);
|
||||
HRSRC hRes = FindResource(hInst, name, type);
|
||||
HGLOBAL hGlobal = LoadResource(hInst, hRes);
|
||||
if (!hGlobal) {
|
||||
WARNING("Cannot load resource %s (type: %s)", name, type);
|
||||
return NULL;
|
||||
}
|
||||
return SDL_RWFromConstMem(LockResource(hGlobal), SizeofResource(hInst, hRes));
|
||||
#else
|
||||
// On Android, read from APK assets.
|
||||
// On other platforms, read from a file under RESOURCE_PATH.
|
||||
char path[_MAX_PATH];
|
||||
sprintf_s(path, _MAX_PATH, "%s%s/%s", RESOURCE_PATH, type, name);
|
||||
return SDL_RWFromFile(path, "rb");
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
uint8* DRI::load(const char* file_name, int page, int* size)
|
||||
{
|
||||
char tmp_name[_MAX_PATH];
|
||||
|
||||
Reference in New Issue
Block a user