diff --git a/include/menu/ncc/Background.hpp b/include/menu/ncc/Background.hpp index 34552467..aa1ad768 100644 --- a/include/menu/ncc/Background.hpp +++ b/include/menu/ncc/Background.hpp @@ -8,7 +8,6 @@ #ifndef BACKGROUND_HPP_ #define BACKGROUND_HPP_ -#include "resource.hpp" #include "common.hpp" #include "menu/ncc/Menu.hpp" diff --git a/include/resource.hpp b/include/resource.hpp deleted file mode 100644 index 88117439..00000000 --- a/include/resource.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * resource.hpp - * - * Created on: Mar 28, 2017 - * Author: nullifiedcat - */ - -#ifndef RESOURCE_HPP_ -#define RESOURCE_HPP_ - -#include "common.hpp" - -class Texture -{ -public: - Texture(unsigned char *start, unsigned w, unsigned h); - ~Texture(); - void Load(); - void Draw(int x, int y, int w, int h, - int color = colorsint::Create(255, 255, 255, 255)); - -public: - int id{ 0 }; - const unsigned char *const start_addr; - const unsigned w; - const unsigned h; -}; - -#endif /* RESOURCE_HPP_ */ diff --git a/src/resource.cpp b/src/resource.cpp deleted file mode 100644 index 552b6c6a..00000000 --- a/src/resource.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * resource.cpp - * - * Created on: Mar 28, 2017 - * Author: nullifiedcat - */ - -#include "common.hpp" -#include "resource.hpp" - -Texture::Texture(unsigned char *start, unsigned w, unsigned h) - : start_addr(start), w(w), h(h) -{ -} - -Texture::~Texture() -{ - if (id) - { - g_ISurface->DeleteTextureByID(id); - } -} - -void Texture::Load() -{ - id = g_ISurface->CreateNewTextureID(true); - logging::Info("Loading %ix%i texture from 0x%08x: got id %i", w, h, - start_addr, id); - // g_ISurface->DrawSetTextureRGBA(id, start_addr, w, h, 0, 0); - g_ISurface->DrawSetTextureRGBAEx(id, start_addr, w, h, - ImageFormat::IMAGE_FORMAT_RGBA8888); -} - -void Texture::Draw(int x, int y, int sw, int sh, int color) -{ - if (!g_ISurface->IsTextureIDValid(id)) - throw std::runtime_error("Invalid texture ID!"); - g_ISurface->DrawSetColor(*reinterpret_cast(&color)); - g_ISurface->DrawSetTexture(id); - g_ISurface->DrawTexturedRect(x, y, x + sw, y + sh); -}