meow
This commit is contained in:
parent
b5fc1e4c5a
commit
99b8a43a10
12
src/font.cpp
12
src/font.cpp
|
|
@ -128,7 +128,7 @@ TTF_Font *SharedFontState::getFont(std::string family, int size){
|
||||||
SDL_IOStream *ops;
|
SDL_IOStream *ops;
|
||||||
|
|
||||||
if (family.empty()){
|
if (family.empty()){
|
||||||
crash("font does not exist", Exception::RGSSError, true);
|
crash(Exception::RGSSError, "font does not exist");
|
||||||
}else{
|
}else{
|
||||||
/* Use 'other' path as alternative in case
|
/* Use 'other' path as alternative in case
|
||||||
* we have no 'regular' styled font asset */
|
* we have no 'regular' styled font asset */
|
||||||
|
|
@ -143,8 +143,7 @@ TTF_Font *SharedFontState::getFont(std::string family, int size){
|
||||||
font = TTF_OpenFontIO(ops, 1, size);
|
font = TTF_OpenFontIO(ops, 1, size);
|
||||||
|
|
||||||
if (!font){
|
if (!font){
|
||||||
snprintf(msg, sizeof msg, "%s", SDL_GetError());
|
crash(Exception::SDLError, "%s", SDL_GetError());
|
||||||
crash(msg, Exception::SDLError, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p->pool.insert(key, font);
|
p->pool.insert(key, font);
|
||||||
|
|
@ -161,10 +160,7 @@ bool SharedFontState::fontPresent(std::string family) const{
|
||||||
return !(set.regular.empty() && set.other.empty());
|
return !(set.regular.empty() && set.other.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void pickExistingFontName(const std::vector<std::string> &names,
|
void pickExistingFontName(const std::vector<std::string> &names, std::string &out, const SharedFontState &sfs){
|
||||||
std::string &out,
|
|
||||||
const SharedFontState &sfs)
|
|
||||||
{
|
|
||||||
/* Note: In RMXP, a names array with no existing entry
|
/* Note: In RMXP, a names array with no existing entry
|
||||||
* results in no text being drawn at all (same for "" and []);
|
* results in no text being drawn at all (same for "" and []);
|
||||||
* we can't replicate this in mkxp due to the default substitute. */
|
* we can't replicate this in mkxp due to the default substitute. */
|
||||||
|
|
@ -309,7 +305,7 @@ void Font::setSize(int value){
|
||||||
|
|
||||||
/* Catch illegal values (according to RMXP) */
|
/* Catch illegal values (according to RMXP) */
|
||||||
if (value < 6 || value > 96)
|
if (value < 6 || value > 96)
|
||||||
throw Exception(Exception::ArgumentError, "%s", "bad value for size");
|
crash(Exception::ArgumentError, "%s", "bad value for size");
|
||||||
|
|
||||||
p->size = value;
|
p->size = value;
|
||||||
p->sdlFont = 0;
|
p->sdlFont = 0;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "boost-hash.h"
|
#include "boost-hash.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
#include "meow.h"
|
||||||
|
|
||||||
#include <SDL3/SDL_video.h>
|
#include <SDL3/SDL_video.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
@ -32,8 +33,7 @@ GLFunctions gl;
|
||||||
typedef const GLubyte* (APIENTRYP _PFNGLGETSTRINGIPROC) (GLenum, GLuint);
|
typedef const GLubyte* (APIENTRYP _PFNGLGETSTRINGIPROC) (GLenum, GLuint);
|
||||||
|
|
||||||
static void parseExtensionsCore(_PFNGLGETINTEGERVPROC GetIntegerv, BoostSet<std::string> &out){
|
static void parseExtensionsCore(_PFNGLGETINTEGERVPROC GetIntegerv, BoostSet<std::string> &out){
|
||||||
_PFNGLGETSTRINGIPROC GetStringi =
|
_PFNGLGETSTRINGIPROC GetStringi = (_PFNGLGETSTRINGIPROC) SDL_GL_GetProcAddress("glGetStringi");
|
||||||
(_PFNGLGETSTRINGIPROC) SDL_GL_GetProcAddress("glGetStringi");
|
|
||||||
|
|
||||||
GLint extCount = 0;
|
GLint extCount = 0;
|
||||||
GetIntegerv(GL_NUM_EXTENSIONS, &extCount);
|
GetIntegerv(GL_NUM_EXTENSIONS, &extCount);
|
||||||
|
|
@ -69,7 +69,7 @@ static void parseExtensionsCompat(_PFNGLGETSTRINGPROC GetString, BoostSet<std::s
|
||||||
gl.name = (type) SDL_GL_GetProcAddress("gl" #name EXT_SUFFIX);
|
gl.name = (type) SDL_GL_GetProcAddress("gl" #name EXT_SUFFIX);
|
||||||
|
|
||||||
#define EXC(msg) \
|
#define EXC(msg) \
|
||||||
Exception(Exception::MKXPError, "%s", msg)
|
crash(Exception::MKXPError, "%s", msg)
|
||||||
|
|
||||||
void initGLFunctions(){
|
void initGLFunctions(){
|
||||||
#define EXT_SUFFIX ""
|
#define EXT_SUFFIX ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue