Ya funcionan las notificaciones
This commit is contained in:
@@ -136,18 +136,13 @@ void Notify::showText(std::string text)
|
||||
SDL_RenderClear(renderer);
|
||||
n.texture->setBlendMode(SDL_BLENDMODE_BLEND);
|
||||
this->text->writeDX(TXT_CENTER | TXT_STROKE, width / 2, despV, text, 1, {255, 255, 255}, 1, {0, 0, 0});
|
||||
SDL_SetRenderTarget(renderer, nullptr);
|
||||
|
||||
// Crea el sprite
|
||||
n.sprite = new Sprite(n.rect, n.texture, renderer);
|
||||
|
||||
// Añade la notificación a la lista
|
||||
notifications.push_back(n);
|
||||
|
||||
//std::cout << "Notification " << notifications.size() << std::endl;
|
||||
//std::cout << "width " << width << std::endl;
|
||||
//std::cout << "height " << height << std::endl;
|
||||
//std::cout << "offset " << offset << std::endl;
|
||||
//std::cout << "desp " << despH << std::endl;
|
||||
}
|
||||
|
||||
// Indica si hay notificaciones activas
|
||||
@@ -157,6 +152,6 @@ bool Notify::active()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -356,12 +356,12 @@ void Screen::showText(std::string text)
|
||||
// Dibuja las notificaciones
|
||||
void Screen::renderNotifications()
|
||||
{
|
||||
//if (!notifyActive)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
if (!notifyActive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//SDL_RenderSetLogicalSize(renderer, windowWidth * options->windowSize, windowHeight * options->windowSize);
|
||||
SDL_RenderSetLogicalSize(renderer, windowWidth * 2, windowHeight * 2);
|
||||
notify->render();
|
||||
//SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
|
||||
SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
|
||||
}
|
||||
@@ -18,7 +18,7 @@ Sprite::Sprite(int x, int y, int w, int h, Texture *texture, SDL_Renderer *rende
|
||||
this->texture = texture;
|
||||
|
||||
// Establece el rectangulo de donde coger la imagen
|
||||
spriteClip = {x, y, w, h};
|
||||
spriteClip = {0, 0, w, h};
|
||||
|
||||
// Inicializa variables
|
||||
enabled = true;
|
||||
@@ -41,7 +41,7 @@ Sprite::Sprite(SDL_Rect rect, Texture *texture, SDL_Renderer *renderer)
|
||||
this->texture = texture;
|
||||
|
||||
// Establece el rectangulo de donde coger la imagen
|
||||
spriteClip = {x, y, w, h};
|
||||
spriteClip = {0, 0, w, h};
|
||||
|
||||
// Inicializa variables
|
||||
enabled = true;
|
||||
@@ -83,8 +83,8 @@ int Sprite::getHeight()
|
||||
// Establece la posición del objeto
|
||||
void Sprite::setPos(SDL_Rect rect)
|
||||
{
|
||||
x = rect.x;
|
||||
y = rect.y;
|
||||
this->x = rect.x;
|
||||
this->y = rect.y;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
@@ -166,6 +166,12 @@ void Sprite::setRenderer(SDL_Renderer *renderer)
|
||||
this->renderer = renderer;
|
||||
}
|
||||
|
||||
// Obten el valor de la variable
|
||||
SDL_Renderer *Sprite::getRenderer()
|
||||
{
|
||||
return renderer;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Sprite::setEnabled(bool value)
|
||||
{
|
||||
|
||||
@@ -81,6 +81,9 @@ public:
|
||||
// Establece el valor de la variable
|
||||
void setRenderer(SDL_Renderer *renderer);
|
||||
|
||||
// Obten el valor de la variable
|
||||
SDL_Renderer *getRenderer();
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setEnabled(bool value);
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
|
||||
this->options = options;
|
||||
|
||||
#ifdef DEBUG
|
||||
currentRoom = "02.room";
|
||||
const int x1 = 20;
|
||||
const int y1 = 6;
|
||||
currentRoom = "01.room";
|
||||
const int x1 = 25;
|
||||
const int y1 = 13;
|
||||
spawnPoint = {x1 * 8, y1 * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user