You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

71 lines
1.6 KiB

#include <string.h>
#include "coreElement.h"
#include "../gui_sdl.h"
sdlGraphicElement::sdlGraphicElement(int x, int y, int w, int h):m_bInitComplete(false){
m_pGUI = classGUI_SDL::getInstance();
setGeometry(x, y, w, h);
m_bHidden = false;
m_eType = GEL_NONE;
m_nVisualStage = 0;
m_pEnabled = true;
};
sdlGraphicElement::sdlGraphicElement(SDL_Rect &R):m_bInitComplete(false) {
m_pGUI = classGUI_SDL::getInstance();
setGeometry(R);
m_bHidden = false;
m_eType = GEL_NONE;
m_nVisualStage = 0;
m_pEnabled = true;
};
sdlGraphicElement::sdlGraphicElement(SDL_Rect* R):m_bInitComplete(false) {
m_pGUI = classGUI_SDL::getInstance();
setGeometry(R);
m_bHidden = false;
m_eType = GEL_NONE;
m_nVisualStage = 0;
m_pEnabled = true;
};
sdlGraphicElement::~sdlGraphicElement() {
};
void sdlGraphicElement::setGeometry(int x, int y, int w, int h) {
m_sGeometry.x = x;
m_sGeometry.y = y;
m_sGeometry.w = w;
m_sGeometry.h = h;
m_bUpdateReq = true;
};
void sdlGraphicElement::setGeometry(SDL_Rect& R) {
memcpy(&m_sGeometry, &R, sizeof(SDL_Rect));
m_bUpdateReq = true;
};
void sdlGraphicElement::setGeometry(SDL_Rect* R) {
memcpy(&m_sGeometry, R, sizeof(SDL_Rect));
m_bUpdateReq = true;
};
void sdlGraphicElement::moveTo(int x, int y) {
m_sGeometry.x = x;
m_sGeometry.y = y;
m_bUpdateReq = true;
};
void sdlGraphicElement::setVisibility(bool val) {
m_bHidden = !val;
m_bUpdateReq = true;
};
void DestroyTextureHeapItem(TEXTURE_HEAP_ITEM*& ptr) {
if (ptr != NULL) {
if (ptr->texture != NULL) {
SDL_DestroyTexture(ptr->texture);
};
free(ptr);
ptr = NULL;
};
};