[Android] Make texture loading/deleting/drawing backend non-specific by making them happen in the backend instead of somewhere else. Just a clean up commit really.

This commit is contained in:
Ryan Houdek
2013-09-02 01:40:05 -05:00
parent 0219049c03
commit 831963616f
9 changed files with 83 additions and 47 deletions

View File

@ -21,6 +21,7 @@
#include <map>
#include "CommonPaths.h"
#include "Android/TextureLoader.h"
#include "VideoBackendBase.h"
namespace ButtonManager
{
@ -60,14 +61,21 @@ namespace ButtonManager
class Button
{
private:
GLuint m_tex;
int m_tex;
ButtonType m_button;
ButtonState m_state;
float m_coords[8];
public:
Button(std::string filename, ButtonType button, float *coords)
{
m_tex = LoadPNG((std::string(DOLPHIN_DATA_DIR "/") + filename).c_str());
u32 width, height;
char *image;
image = LoadPNG((std::string(DOLPHIN_DATA_DIR "/") + filename).c_str(), width, height);
m_tex = g_video_backend->Video_LoadTexture(image, width, height);
free(image);
m_button = button;
memcpy(m_coords, coords, sizeof(float) * 8);
m_state = BUTTON_RELEASED;
@ -83,7 +91,7 @@ namespace ButtonManager
GLuint GetTexture() { return m_tex; }
float *GetCoords() { return m_coords; }
~Button() { if(m_tex) glDeleteTextures(1, &m_tex); }
~Button() { g_video_backend->Video_DeleteTexture(m_tex); }
};
struct sBind