Remove superfluous SDL dependencies

This commit is contained in:
Iliyas Jorio 2021-07-18 15:44:24 +02:00
parent 46599c1780
commit 9c223defc2
2 changed files with 12 additions and 36 deletions

View File

@ -1,42 +1,20 @@
#include "PommeDebug.h" #include "PommeDebug.h"
#include <cstring>
#include <SDL.h>
#include <sstream>
#include <iostream> #include <iostream>
void ImplementMe(const char* fn, std::string msg, int severity) void ImplementMe(const char* fn, std::string msg, int severity)
{ {
if (severity >= 0) std::stringstream ss;
{ ss << "[TODO] \x1b[1m" << fn << "\x1b[22m";
std::stringstream ss;
ss << "[TODO] \x1b[1m" << fn << "\x1b[22m"; if (!msg.empty())
if (!msg.empty()) ss << ": " << msg;
{
ss << ": " << msg; auto str = ss.str();
} std::cerr << (severity > 0 ? "\x1b[31m" : "\x1b[33m") << str << "\x1b[0m\n";
auto str = ss.str();
std::cerr << (severity > 0 ? "\x1b[31m" : "\x1b[33m") << str << "\x1b[0m\n";
}
if (severity >= 2) if (severity >= 2)
{ throw std::runtime_error(str);
std::stringstream ss;
ss << fn << "()";
if (!msg.empty()) ss << "\n" << msg;
auto str = ss.str();
int mbflags = SDL_MESSAGEBOX_ERROR;
if (severity == 0) mbflags = SDL_MESSAGEBOX_INFORMATION;
if (severity == 1) mbflags = SDL_MESSAGEBOX_WARNING;
SDL_ShowSimpleMessageBox(mbflags, "Source port TODO", str.c_str(), nullptr);
}
if (severity >= 2)
{
abort();
}
} }
std::string Pomme::FourCCString(uint32_t fourCC, char filler) std::string Pomme::FourCCString(uint32_t fourCC, char filler)
@ -49,9 +27,8 @@ std::string Pomme::FourCCString(uint32_t fourCC, char filler)
{ {
char c = (fourCC >> shift) & 0xFF; char c = (fourCC >> shift) & 0xFF;
// Replace any non-alphanumeric character with the filler character. // Replace symbols to make suitable for use as filename
// This ensures that the resulting string is suitable for use as a filename. if (!isalnum(c) && !strchr("!#$%&'()+,-.;=@[]^_`{}", c))
if (!isalnum(c))
c = filler; c = filler;
stringBuffer[i] = c; stringBuffer[i] = c;

View File

@ -6,7 +6,6 @@ extern "C"
#endif #endif
#include "PommeTypes.h" #include "PommeTypes.h"
#include <SDL_opengl.h>
#include <stdbool.h> #include <stdbool.h>
typedef float TQ3Float32; typedef float TQ3Float32;