void doFontification (struct spriteBank *sprites, unsigned int fontifySpaceWidth) {
	
	int which = 1;
	int fromColumn = 0;
	int yhot = (sprites->sprites[0].height * 3) / 4;
	
	for (int thisColumn = 0; thisColumn < sprites->sprites[0].width; thisColumn ++) {
		int y;
		
		// Find out if the column's empty...
		for (y = 0; y < sprites->sprites[0].height; y ++) {
			if (sprites->sprites[0].data[y*sprites->sprites[0].width*4 + thisColumn*4 + 3]) break;
		}
		
		int width = (thisColumn - fromColumn);
		
		// So was it?
		if (y == sprites->sprites[0].height || (thisColumn == sprites->sprites[0].width - 1)) {
			
			// Make sure we didn't find a blank column last time
			if (width) {
				
				// Reserve memory
				GLubyte * toHere = (GLubyte *) new GLubyte [width * sprites->sprites[0].height * 4];
				GLubyte * dataIfOK = toHere;
				if (toHere) {
					
					for (y = 0; y < sprites->sprites[0].height; y ++) {
						GLubyte * from = sprites->sprites[0].data + 4*sprites->sprites[0].width*y + fromColumn*4;
						for (int x = 0; x < width*4; x ++) {
							* (toHere ++) = from[x];
						}
					}
					
					addSprite (which, sprites);
					sprites->sprites[which].width = width;
					sprites->sprites[which].height = sprites->sprites[0].height;
					sprites->sprites[which].yhot = yhot;
					delete sprites->sprites[which].data;
					sprites->sprites[which].data = dataIfOK;
					which ++;
				}					
			}
			fromColumn = thisColumn + 1;
		}
	}
	
	addSprite (which, sprites);
	sprites->sprites[which].width = fontifySpaceWidth;
	sprites->sprites[which].height = 1;
	sprites->sprites[which].yhot = 0;
	delete sprites->sprites[which].data;
	sprites->sprites[which].data = new GLubyte [fontifySpaceWidth * 4];
	memset(sprites->sprites[which].data, 0, fontifySpaceWidth * 4);

	deleteSprite (0, sprites);
	
	loadSpriteTextures (sprites);	
}
void SpawnPointSpriteManager::update() {

	if (m_spawnPoint->isFree() && m_currentSprite.getImage() == Sprite::SPAWN_POINT_OCCUPIED) {
		m_currentSprite = Sprite(Sprite::SPAWN_POINT_FREE, m_spawnPoint->getShape());
		clearSprites();
		addSprite(m_currentSprite);
	} else if (!m_spawnPoint->isFree() && m_currentSprite.getImage() == Sprite::SPAWN_POINT_FREE) {
		clearSprites();
		m_currentSprite = Sprite(Sprite::SPAWN_POINT_OCCUPIED, m_spawnPoint->getShape());
		addSprite(m_currentSprite);
	}

	WorldSpriteManager::update();
}
Exemple #3
0
bool taskLayer::init() {

	if (!Layer::init())
	{
		return false;
	}
	audioFlag = DataXML::getInstence()->getInitialValue("sound");
	allCondition["multi2long"] =0;
	allCondition["useablebloodbutton"] = 0;
	allCondition["plus50"] = 0;
	allCondition["multi2short"] = 0;
	allCondition["blood_drop"] = 0;
	allCondition["beartrap"] = 0;
	allCondition["campfire"] = 0;
	allCondition["plaster"] = 0;
	allCondition["blade_low"] = 0;
	allCondition["e_fence"] = 0;
	count = 0;

	addSprite();
 	showTask();
 	addTool();
	

	NotificationCenter::getInstance()->addObserver(this,callfuncO_selector(taskLayer::testMessage),"task",NULL);
	return true;
}
Exemple #4
0
Main::Main(QGraphicsScene& c, QWidget* parent, const char* name, Qt::WindowFlags f) :
    Q3MainWindow(parent,name,f),
    canvas(c)
{
    editor = new FigureEditor(canvas,this);
    QMenuBar* menu = menuBar();

    Q3PopupMenu* file = new Q3PopupMenu( menu );
    file->insertItem("&Fill canvas", this, SLOT(init()), Qt::CTRL+Qt::Key_F);
    file->insertItem("&Erase canvas", this, SLOT(clear()), Qt::CTRL+Qt::Key_E);
    file->insertItem("&New view", this, SLOT(newView()), Qt::CTRL+Qt::Key_N);
    file->insertSeparator();
    file->insertItem("&Print...", this, SLOT(print()), Qt::CTRL+Qt::Key_P);
    file->insertSeparator();
    file->insertItem("E&xit", qApp, SLOT(quit()), Qt::CTRL+Qt::Key_Q);
    menu->insertItem("&File", file);

    Q3PopupMenu* edit = new Q3PopupMenu( menu );
    edit->insertItem("Add &Circle", this, SLOT(addCircle()), Qt::ALT+Qt::Key_C);
    edit->insertItem("Add &Hexagon", this, SLOT(addHexagon()), Qt::ALT+Qt::Key_H);
    edit->insertItem("Add &Polygon", this, SLOT(addPolygon()), Qt::ALT+Qt::Key_P);
    edit->insertItem("Add Spl&ine", this, SLOT(addSpline()), Qt::ALT+Qt::Key_I);
    edit->insertItem("Add &Text", this, SLOT(addText()), Qt::ALT+Qt::Key_T);
    edit->insertItem("Add &Line", this, SLOT(addLine()), Qt::ALT+Qt::Key_L);
    edit->insertItem("Add &Rectangle", this, SLOT(addRectangle()), Qt::ALT+Qt::Key_R);
    edit->insertItem("Add &Sprite", this, SLOT(addSprite()), Qt::ALT+Qt::Key_S);
    edit->insertItem("Create &Mesh", this, SLOT(addMesh()), Qt::ALT+Qt::Key_M );
    edit->insertItem("Add &Alpha-blended image", this, SLOT(addButterfly()), Qt::ALT+Qt::Key_A);
    menu->insertItem("&Edit", edit);

    Q3PopupMenu* view = new Q3PopupMenu( menu );
    view->insertItem("&Enlarge", this, SLOT(enlarge()), Qt::SHIFT+Qt::CTRL+Qt::Key_Plus);
    view->insertItem("Shr&ink", this, SLOT(shrink()), Qt::SHIFT+Qt::CTRL+Qt::Key_Minus);
    view->insertSeparator();
    view->insertItem("&Rotate clockwise", this, SLOT(rotateClockwise()), Qt::CTRL+Qt::Key_PageDown);
    view->insertItem("Rotate &counterclockwise", this, SLOT(rotateCounterClockwise()), Qt::CTRL+Qt::Key_PageUp);
    view->insertItem("&Zoom in", this, SLOT(zoomIn()), Qt::CTRL+Qt::Key_Plus);
    view->insertItem("Zoom &out", this, SLOT(zoomOut()), Qt::CTRL+Qt::Key_Minus);
    view->insertItem("Translate left", this, SLOT(moveL()), Qt::CTRL+Qt::Key_Left);
    view->insertItem("Translate right", this, SLOT(moveR()), Qt::CTRL+Qt::Key_Right);
    view->insertItem("Translate up", this, SLOT(moveU()), Qt::CTRL+Qt::Key_Up);
    view->insertItem("Translate down", this, SLOT(moveD()), Qt::CTRL+Qt::Key_Down);
    view->insertItem("&Mirror", this, SLOT(mirror()), Qt::CTRL+Qt::Key_Home);
    menu->insertItem("&View", view);

    menu->insertSeparator();

    Q3PopupMenu* help = new Q3PopupMenu( menu );
    help->insertItem("&About", this, SLOT(help()), Qt::Key_F1);
    help->setItemChecked(dbf_id, TRUE);
    menu->insertItem("&Help",help);

    statusBar();

    setCentralWidget(editor);

    printer = 0;

    init();
}
Exemple #5
0
void Sprite::setZIndex(float new_z_index){
  beginFrame();
  removeSprite(this);
  z_index = new_z_index;
  addSprite(this);
  endFrame();
}
// This will be gone soon.
void SpriteManager::createTimeBullet(b2World *world)
{
	b2Vec2 *offset = new b2Vec2(0,0);
	SpriteSheetData *data = new SpriteSheetData();
			data->numOfActions = 1;
			data->framesInAction = new int[1];
			data->framesInAction[0] = 10;
			data->drawHeight = 15;
			data->drawWidth = 15;
			data->type = GOOD_BULLET;
			data->timeBetweenFrames = 1/16;

	b2Body *body = Physics::createRectBody(world, 200, 200, 15, 15, true);
	sf::Texture *texture = new sf::Texture();
	texture->loadFromFile("images/testimage.png");

	AnimatedSprite* timeBulletSprite = new AnimatedSprite(*data, *texture, body);

	timeBullet = new Projectile(timeBulletSprite, player, *offset);

	// Add the sprite to the sprite list so it gets drawn:
	addSprite(timeBullet->getSprite());

	// Add the time bullet to the asset manager so it's easier to find later:
	AssetManager::getAssetManager()->setTimeBullet(timeBullet);

	body->SetUserData(timeBulletSprite);
	Physics::setFilterData(body, GOOD_BULLET, BADGUY);

}
void ResourceManager::addTextureMaterialSprite(
        const std::string&                  id,
              resource_group::ResourceGroup resourceGroup,
        const std::string&                  shader,
        const glm::vec4&                    colour,
        const std::string&                  texturePath,
              unsigned                      frameRate,
              bool                          repeat,
              unsigned                      begin,
              unsigned                      end,
              int                           layer,
        const glm::vec2&                    size,
        const glm::vec2&                    texSize,
        const glm::vec2&                    texOffset,
              unsigned                      textureFlags,
              unsigned                      materialFlags )
{
    // texture
    addTexture(
        id, resourceGroup, texturePath, frameRate,
        repeat, begin, end, textureFlags );
    // material
    addMaterial( id, resourceGroup, shader, colour, id, materialFlags );
    // sprite
    addSprite( id, resourceGroup, layer, id, size, texSize, texOffset );
}
void HelloWorld::onMouseDown(Event* event)
{
#ifdef MOUSE_DOUBLE_LISTEN_FUDGE
    mouseDownFudge = !mouseDownFudge;
    if(!mouseDownFudge)
        return;
#endif
    EventMouse* e = (EventMouse*)event;
    isMouseDown[e->getMouseButton()] = true;
    std::stringstream ss;
    ss << "Mouse Down ";
    ss << e->getMouseButton();

    if(e->getMouseButton() == 1)
    {
        if(!getChildByName("animtest"))
        {
            auto s = new O3Sprite("", true);
            addSprite(s);
            s->addAnimation("idle", "animtest", 9, 12);
            s->setAnimation("idle");
            s->playAnimation();
            s->setName("animtest");
        }
        else
        {
            removeChildByName("animtest");
        }
    }
}
Exemple #9
0
void CCutScene::addScrollContent()
{
    Size visibleSize = Director::getInstance()->getVisibleSize();
    
    int nIndex = 0;
    for (int i = 0; i < 5; i++)
    {
        CFoodInfo* pFood = CGlobalData::getSingleton()->getPanziFood(i);
        if (pFood == NULL) continue;
        if (pFood->getFoodType() == FT_ORIGIN)
        {
            addSprite("panzi.png", m_pContentLayer, Vec2(visibleSize.width - 200 - 400 * nIndex, 150), 0, Vec2::ANCHOR_MIDDLE);
            
            std::vector<int> vMaterial = pFood->getMaterials();
            MATERIAL_ID id = (MATERIAL_ID)vMaterial[0];
            if (id >= MI_MAX) return;
            std::string sName = MATERIAL_CONFIG[id].sName;
            CFoodMaterial* pFoodMaterial = CFoodMaterial::create(sName.c_str());
            if (pFoodMaterial != NULL)
            {
                m_pContentLayer->addChild(pFoodMaterial, 1);
                pFoodMaterial->setPosition(Vec2(visibleSize.width - 200 - 400 * nIndex, 150));
                std::vector<int> vMaterials;
                vMaterials.clear();
                vMaterials.push_back(id);
                int aTastes[2] = {0, 0};
                pFoodMaterial->initProperty(FT_ORIGIN, vMaterials, aTastes, pFood->getPanziIndex());
            }
            
            m_aFoods[nIndex ++] = pFoodMaterial;
        }
        
        PANZI_POSITION[i] = Vec2(visibleSize.width - 200 - 400 * i, 150);
    }
}
Exemple #10
0
Sprite::Sprite(const Sprite& other):
  z_index(other.z_index), pose(other.pose), visible(other.visible),
  color(other.color), fill(other.fill), penIsDown(other.penIsDown)
{
  //if(owner != NULL) owner->addPart(this);
  //else               // will not work with Composite.
  addSprite(this);     // Register to canvas
}  
Exemple #11
0
//---------------------------------------------------------------------------------
int main(void) {
    // Initialize SNES 
	consoleInit();
	
	// Put current handler to our function
	spr_queue = 0xff; spr_mutex = 0;
	__nmi_handler=myconsoleVblank; 

	// Init Sprites gfx and palette with default size of 16x16 (and don't load sprite tiles)
	oamInitGfxSet(&gfxpsrite, 2, &palsprite, 16*2, 0, ADRGFXSPR, OBJ_SIZE16);

	// Define sprites parmaters
	oamSet(0,  100, 100, 3, 0, 0, 0, 0); // Put sprite in 100,100, with maximum priority 3 from tile entry 0, palette 0
	oamSetEx(0, OBJ_SMALL, OBJ_SHOW);
	
	// Now Put in 16 color mode and disable all backgrounds
	setMode(BG_MODE1,0); bgSetDisable(0); bgSetDisable(1); bgSetDisable(2);

	// add new sprite to queue
	addSprite(&gfxpsrite, ADRGFXSPR);
	
	// Wait for nothing :P
	while(1) {
			// Refresh pad values in VBL and Get current #0 pad
		pad0 = padsCurrent(0);
		
		if (pad0) {
			// Key A pressed
			if(pad0 & KEY_A) {
				// if not yet pressed
				if (padkeya == 0) {
					padkeya=1;  // avoid adding new sprite continuisly
					// add new sprite to queue
					addSprite((&gfxpsrite)+8*4*2, ADRGFXSPR);
				}
				
			}
			else
				padkeya=0;
		}
		
		// Wait VBL 'and update sprites too ;-) )
		WaitForVBlank();
	}
	return 0;
}
void LHParallaxNode::addNode(CCNode* node, CCPoint ratio){
  
    if(LHSprite::isLHSprite(node)){
        addSprite((LHSprite*)node, ratio);
    }
    else{
        createParallaxPointObject(node, ratio);
    }
}
void SludgeFloorMaker::prepareOpenGL()
{
	if (! backdrop.total)
		addSprite(0, &backdrop);
	z = 0.0;
	r = g = b = 1.0;
	zmul = (1.0+z/20);
	setCoords();	
}
Exemple #14
0
void Sprite::init(Composite* owner){
  visible = true;
  color = COLOR("black");
  fill = false;
  penIsDown = false;
  z_index = ++ max_z_index;
  if(owner != NULL) owner->addPart(this);
  else addSprite(this);     // Register to canvas
}  
void ResourceManager::addSprite(ResourceKey key, GraphicsBuffer* GBuffer, int x, int y, int width, int height)
{
	Vector2D temp(x, y);

	Sprite* newSprite = New Sprite(GBuffer, temp, width, height);

	addSprite(key, newSprite);

}
Exemple #16
0
int wySpriteBatchNode::reorderChild(wyNode* child, int z) {
    wySpriteEx* spriteEx = dynamic_cast<wySpriteEx*>(child);
    if(!spriteEx || spriteEx->getParent() != this) {
        return -1;
    }
    int ret = wyNode::reorderChild(child, z);
    removeSprite(spriteEx);
    addSprite(spriteEx);
    return ret;
}
Exemple #17
0
void
CLLoader::addSprite(string const &path, Resources *resources, string const &name) {
  if (clresources == NULL) {
    cerr << "Resource file not loaded: " << resourceFile << endl;
    assert(!(clresources == NULL));
  }
  CLVisualContext &vc = (CLVisualContext &) resources->getVisualContext();
  CL_GraphicContext &gc = vc.getGraphicContext();
  addSprite(gc, path, clresources, resources, name);
}
Exemple #18
0
bool GameLayer::init(){
    
    if ( !LayerColor::initWithColor(Color4B(255, 255, 255, 255)) )
    {
        return false;
    }
    

    
    visibleSize = Director::getInstance()->getVisibleSize();

    gun = Gun::create();
    gun->setScale(0.25);
    gun->setPosition(Vec2(120,visibleSize.height/2-180));
    addChild(gun,1);

    touchTest();    //触摸检测
    
    
    this->schedule(schedule_selector(GameLayer::checkCollision), 0.1);//启动检测碰撞的函数

    ////////////////////////////

    //文件解析
    str="Data.xml";
//    xmller.giveBirthTo(str);
    xmller.createwithxmlfile(str);
    
    //更换背景
    std::string a= xmller.getLevel01();
    int i = atoi(a.c_str());

    log("哇擦了%d",i);
    auto levelNumber = __String::createWithFormat("bg%d.png",i);
    log("%s",levelNumber->getCString());
    auto bg = Sprite::create(levelNumber->getCString());
    bg->setPosition(visibleSize/2);
    
    auto fade1 = FadeTo::create(2.0, 150);
    auto fade2 = FadeIn::create(2.0);
    auto seq = RepeatForever::create( Sequence::create(fade1,fade2,NULL));
    bg->runAction(seq);
    addChild(bg);
    
    loadLayer();    //加载场景
    addSprite();    //添加界面UI元素
    
    //拿到子弹数量,给全局变量
    auto bulletnm = xmller.getLevel03();
    int b = atoi(bulletnm.c_str());
    bulletNumber = b;

    butemp =0;
    return true;
}
Exemple #19
0
void wySpriteBatchNode::addChild(wyNode* child, int z, int tag) {
    wySpriteEx* sprite = dynamic_cast<wySpriteEx*>(child);
    if(!sprite){
        LOGW("wySpriteBatchNode: Can't add a non-wySpriteEx node as child");
        return;
    }

    wyNode::addChild(child, z, tag);
    int index = wyArrayIndexOf(m_children, sprite, NULL, NULL);
    sprite->setAtlasIndex(index);
    addSprite(sprite);
}
Exemple #20
0
void GameState::addStringSprite(std::string index, int x, int y, int size, std::string text, int color){
	sf::Text * spr = new sf::Text(text, *stateHandler->getFont(), size);

	int r = ((color / 256) / 256) % 256;
	int g = (color / 256) % 256;
	int b = color % 256;
	spr->setColor(sf::Color(r, g, b));
	spr->setPosition(x, y);

	Sprite * sprite = new Sprite(index, spr);

	addSprite(sprite);
}
Exemple #21
0
void ComposerEngine::setCursor(uint16 id, const Common::Point &offset) {
	_mouseOffset = offset;
	if (_mouseSpriteId == id)
		return;

	if (_mouseSpriteId && _mouseVisible) {
		removeSprite(_mouseSpriteId, 0);
	}
	_mouseSpriteId = id;
	if (_mouseSpriteId && _mouseVisible) {
		addSprite(_mouseSpriteId, 0, 0, _lastMousePos - _mouseOffset);
	}
}
Exemple #22
0
bool BackgroundLayer::init()
{
	bool bRet = false;
	do
	{
		CC_BREAK_IF(!Layer::init());

		addSprite(bG, BACKGROUND_IMG, BACKGROUND_POSITION, BACKGROUND_SIZE, this); //½«±³¾°Í¼Æ¬Ìí¼Óµ½ÆÁÄ»

		bRet = true;
	} while (0);
	return bRet;
}
void SludgeZBufferMaker::prepareOpenGL()
{
	if (! backdrop.total) {
		addSprite(0, &backdrop);
		backdrop.sprites[0].width = 640;
		backdrop.sprites[0].height = 480;
	} else
		loadZTextures(&backdrop);

	z = 0.0;
	zmul = (1.0+z/20);
	setCoords();	
}
Exemple #24
0
void PonyAnimation::initialize(const char* source) {
  reset();

  const uint frameRate = 10;
  const uint width = 2880;
  const uint height = 1152;
  const uint frameWidth = 96;
  const uint frameHeight = 96;

  SpriteData data;
  data.m_image = source;
  data.m_frameRate = frameRate;
  data.m_frameWidth = (qreal)frameWidth / width;
  data.m_frameHeight = (qreal)frameHeight / height;

  data.m_name = "walking";
  data.m_next = data.m_name;
  data.m_frameCount = 6;
  data.m_frameX = data.m_frameWidth * 12.0;
  data.m_frameY = data.m_frameHeight * 3.0;
  addSprite(data);

  data.m_name = "prepareJump";
  data.m_next = "jumping";
  data.m_frameCount = 6;
  data.m_frameX = data.m_frameWidth * 0.0;
  data.m_frameY = data.m_frameHeight * 10.0;
  addSprite(data);

  data.m_name = "jumping";
  data.m_next = data.m_name;
  data.m_frameCount = 6;
  data.m_frameX = data.m_frameWidth * 12.0;
  data.m_frameY = data.m_frameHeight * 5.0;
  addSprite(data);

  data.m_name = "standStill";
  data.m_next = data.m_name;
  data.m_frameCount = 1;
  data.m_frameX = data.m_frameWidth * 2.0;
  data.m_frameY = data.m_frameHeight * 0.0;
  addSprite(data);

  data.m_name = "preparePunch";
  data.m_next = "punch";
  data.m_frameCount = 5;
  data.m_frameX = data.m_frameWidth * 0.0;
  data.m_frameY = data.m_frameHeight * 9.0;
  addSprite(data);

  data.m_name = "punch";
  data.m_next = "standStill";
  data.m_frameRate *= 0.5;
  data.m_frameCount = 1;
  data.m_frameX = data.m_frameWidth * 5.0;
  data.m_frameY = data.m_frameHeight * 9.0;
  addSprite(data);
}
Exemple #25
0
void GameState::addSprite(std::string index, int xpos, int ypos, std::string src, int width, int height, int clipX, int clipY, int clipWidth, int clipHeight){
	sf::Sprite * sprite = new sf::Sprite();

	sprite->setTexture(*stateHandler->getTexture(src));
	sprite->setPosition(xpos, ypos);

	if(clipWidth != 0 && clipHeight != 0){
		sprite->setTextureRect(sf::IntRect(clipX, clipY, clipWidth, clipHeight));
	}

	Sprite * spr = new Sprite(index, sprite, width, height);

	addSprite(spr);
}
void TextureCacheTest::loadingCallBack(CCObject *obj)
{
	++m_nNumberOfLoadedSprites;
	char tmp[10];
	sprintf(tmp,"%%%d", (int)(((float)m_nNumberOfLoadedSprites / m_nNumberOfSprites) * 100));
	m_pLabelPercent->setString(tmp);

	if (m_nNumberOfLoadedSprites == m_nNumberOfSprites)
	{
		this->removeChild(m_pLabelLoading, true);
		this->removeChild(m_pLabelPercent, true);
		addSprite();
	}
}
Exemple #27
0
void TextureCacheTest::loadingCallBack(cocos2d::Texture2D *texture)
{
    ++_numberOfLoadedSprites;
    char tmp[10];
    sprintf(tmp,"%%%d", (int)(((float)_numberOfLoadedSprites / _numberOfSprites) * 100));
    _labelPercent->setString(tmp);

    if (_numberOfLoadedSprites == _numberOfSprites)
    {
        this->removeChild(_labelLoading, true);
        this->removeChild(_labelPercent, true);
        addSprite();
    }
}
void MenuServeur::processEvents()
{
  sf::Event event;
  while (mWindow.pollEvent(event))
  {
      if (event.type==sf::Event::KeyPressed)
     {
      switch(event.key.code)
      {
        case sf::Keyboard::Escape:
             mWindow.close();
             break;
        case sf::Keyboard::Return: //retour menu
             break;
        case sf::Keyboard::R:
              resetGame();

        break;
     }}
    switch (event.type)
    {
    case sf::Event::MouseButtonPressed:
      if (event.mouseButton.button == sf::Mouse::Left)
      {
        Square square(squareClicked(event.mouseButton.x,event.mouseButton.y));
        if (square != UNKNOWN)
        {
          if (mBoard.addMove(mPlayer,square))
          {
            addSprite(square);
            updateOutcome();
            displayOutcome();
            if (mOutcome == UNFINISHED)
              swapPlayer();
            else
               // Xwin();
              resetGame();

          }
        }
      }
      break;

    case sf::Event::Closed:
      mWindow.close();
      break;
    }
  }
}
Exemple #29
0
void ComposerEngine::setCursorVisible(bool visible) {
	if (visible && !_mouseVisible) {
		_mouseVisible = true;
		if (_mouseSpriteId)
			addSprite(_mouseSpriteId, 0, 0, _lastMousePos - _mouseOffset);
		else
			CursorMan.showMouse(true);
		onMouseMove(_lastMousePos);
	} else if (!visible && _mouseVisible) {
		_mouseVisible = false;
		if (_mouseSpriteId)
			removeSprite(_mouseSpriteId, 0);
		else
			CursorMan.showMouse(false);
	}
}
void ResourceManager::addMaterialSprite(
        const std::string&                  id,
              resource_group::ResourceGroup resourceGroup,
        const std::string&                  shader,
        const glm::vec4&                    colour,
              int                           layer,
        const glm::vec2&                    size,
        const glm::vec2&                    texSize,
        const glm::vec2&                    texOffset,
              unsigned                      materialFlags )
{
    // material
    addMaterial( id, resourceGroup, shader, colour, materialFlags );
    // sprite
    addSprite( id, resourceGroup, layer, id, size, texSize, texOffset );
}