forked from jaildesigner-jailgames/jaildoctors_dilemma
corregides cridades a SDL3 i migrat casi tot de int a float. Falta jail_shader
This commit is contained in:
@@ -1,61 +1,55 @@
|
||||
#include "debug.h"
|
||||
|
||||
#include <algorithm> // Para max
|
||||
#include <memory> // Para __shared_ptr_access, shared_ptr
|
||||
#include "resource.h" // Para Resource
|
||||
#include "text.h" // Para Text
|
||||
#include "utils.h" // Para Color
|
||||
#include <memory> // Para __shared_ptr_access, shared_ptr
|
||||
|
||||
#include "resource.h" // Para Resource
|
||||
#include "text.h" // Para Text
|
||||
#include "utils.h" // Para Color
|
||||
|
||||
// [SINGLETON]
|
||||
Debug *Debug::debug_ = nullptr;
|
||||
Debug* Debug::debug_ = nullptr;
|
||||
|
||||
// [SINGLETON] Crearemos el objeto con esta función estática
|
||||
void Debug::init()
|
||||
{
|
||||
Debug::debug_ = new Debug();
|
||||
void Debug::init() {
|
||||
Debug::debug_ = new Debug();
|
||||
}
|
||||
|
||||
// [SINGLETON] Destruiremos el objeto con esta función estática
|
||||
void Debug::destroy()
|
||||
{
|
||||
delete Debug::debug_;
|
||||
void Debug::destroy() {
|
||||
delete Debug::debug_;
|
||||
}
|
||||
|
||||
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
|
||||
Debug *Debug::get()
|
||||
{
|
||||
return Debug::debug_;
|
||||
Debug* Debug::get() {
|
||||
return Debug::debug_;
|
||||
}
|
||||
|
||||
// Dibuja en pantalla
|
||||
void Debug::render()
|
||||
{
|
||||
auto text = Resource::get()->getText("debug");
|
||||
int y = y_;
|
||||
int w = 0;
|
||||
void Debug::render() {
|
||||
auto text = Resource::get()->getText("debug");
|
||||
int y = y_;
|
||||
int w = 0;
|
||||
|
||||
for (const auto &s : slot_)
|
||||
{
|
||||
text->write(x_, y, s);
|
||||
w = (std::max(w, (int)s.length()));
|
||||
y += text->getCharacterSize() + 1;
|
||||
if (y > 192 - text->getCharacterSize())
|
||||
{
|
||||
y = y_;
|
||||
x_ += w * text->getCharacterSize() + 2;
|
||||
}
|
||||
}
|
||||
for (const auto& s : slot_) {
|
||||
text->write(x_, y, s);
|
||||
w = (std::max(w, (int)s.length()));
|
||||
y += text->getCharacterSize() + 1;
|
||||
if (y > 192 - text->getCharacterSize()) {
|
||||
y = y_;
|
||||
x_ += w * text->getCharacterSize() + 2;
|
||||
}
|
||||
}
|
||||
|
||||
y = 0;
|
||||
for (const auto &l : log_)
|
||||
{
|
||||
text->writeColored(x_ + 10, y, l, static_cast<Uint8>(PaletteColor::WHITE));
|
||||
y += text->getCharacterSize() + 1;
|
||||
}
|
||||
y = 0;
|
||||
for (const auto& l : log_) {
|
||||
text->writeColored(x_ + 10, y, l, static_cast<Uint8>(PaletteColor::WHITE));
|
||||
y += text->getCharacterSize() + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Establece la posición donde se colocará la información de debug
|
||||
void Debug::setPos(SDL_Point p)
|
||||
{
|
||||
x_ = p.x;
|
||||
y_ = p.y;
|
||||
void Debug::setPos(SDL_FPoint p) {
|
||||
x_ = p.x;
|
||||
y_ = p.y;
|
||||
}
|
||||
Reference in New Issue
Block a user