Exemple #1
0
DWORD threadRun(LPVOID args) {
    int index = 0, y;

    WaitForSingleObject(hMutex, INFINITE);
    // SYNC {
    for (y = 0; y < 24; y++) {
        putAt('#', 10, y);
        putAt('#', 69, y);
    }
    // }
    ReleaseMutex(hMutex);

    while (TRUE) {

        WaitForSingleObject(hMutex, INFINITE);
        // SYNC {
        drawAnimation(index, 70, 0, 80, 24, 0);
        drawAnimation(index, 00, 0, 10, 24, 1);
        // }
        ReleaseMutex(hMutex);

        index++;
        Sleep(SLEEP_TIME);
    }
}
Exemple #2
0
void drawPlayer()
{
	/* Draw the image in the player structure */
	if(game.walkAnimationCount != 0)
	{
		if(input.yaw == NORTH) drawAnimation(&walkUpAnimation, player.x, player.y);
		if(input.yaw == SOUTH) drawAnimation(&walkDownAnimation, player.x, player.y);
		if(input.yaw == EAST) drawAnimation(&walkRightAnimation, player.x, player.y);
		if(input.yaw == WEST) drawAnimation(&walkLeftAnimation, player.x, player.y); 
	}
	else
	{
		drawImage(player.sprite, player.x, player.y);
	}
}
Exemple #3
0
void doPlayerWalkAnimation(Animation *anim)
{	
	drawAnimation(anim, player.x, player.y);
	doAnimation(anim);
		
	int direction = input.yaw;
		
	if(direction == NORTH)
	{
		player.y -= PLAYER_SPEED;
	}
	else if(direction == SOUTH)
	{
		player.y += PLAYER_SPEED;
	}
	else if(direction == EAST)
	{
		player.x += PLAYER_SPEED;
	}
	else
	{
		player.x -= PLAYER_SPEED;
	}
	
	game.walkAnimationCount++;

	if(game.walkAnimationCount == 4)
	{
		game.walkAnimationCount = 0;
	}
}
void Unitselect::PopAnimation(){
	Vec2f animation_pos;
	if (pop_animation == true)
	{
		for (auto itr = p_list_.begin(); itr != p_list_.end(); ++itr)
		{
			animation_pos = Vec2f(-100, -50) + (*itr)->GetSelectPos();
		}
		drawAnimation(animation_pos, Vec2f(300, 300), pop_offset_pos, Vec2f(256, 256), pop_tex, 30, 5, 0, animation_time);
		if (animation_time > 29 * 5)
		{
			animation_time = 0;
			pop_animation = false;
		}
	}
}
Exemple #5
0
void Parallaction::updateZones() {
	debugC(9, kDebugExec, "Parallaction::updateZones()\n");

	// go through all animations and mark/unmark each of them for display
	for (AnimationList::iterator ait = _location._animations.begin(); ait != _location._animations.end(); ++ait) {
		AnimationPtr anim = *ait;
		if ((anim->_flags & kFlagsRemove) != 0)	{
			// marks the animation as invisible for this frame
			_gfx->showGfxObj(anim->gfxobj, false);
			anim->_flags &= ~(kFlagsActive | kFlagsRemove);
		} else {
			// updates animation parameters
			drawAnimation(anim);
		}
	}

	// go through all zones and mark/unmark each of them for display
	for (ZoneList::iterator zit = _location._zones.begin(); zit != _location._zones.end(); ++zit) {
		drawZone(*zit);
	}

	debugC(9, kDebugExec, "Parallaction::updateZones done()\n");
}
void display() {
  //Clear buffers and set the transformation matrix to the identity matrix.
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glLoadIdentity();

  //Increment global angle variables (take FPS into account).
  a += 90 / FPS; b += 90 / FPS; c += 90 / FPS; d += 90 / FPS;
  a %= 360; b %= 360; c %= 360; d %= 360;

  //Draw scene depending on program state.
  switch (state) {
    case 1:
      rotateY(a);
      rotateZ(a);
      drawWireSphere();
    break;
    case 2:
      rotateX(20);
      rotateY(b);
      drawWireCone();
    break;
    case 3:
      rotateY(a);
      rotateZ(a);
      drawSphereNormals();
    break;
    case 4:
      rotateY(d);
      drawShadedSphere();
    break;
    case 5: drawAnimation();
    break;
  }

  //Swap buffers.
  SDL_GL_SwapBuffers();
}
Exemple #7
0
bool CMainMenuLayer::init()
{
	//////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }

	/////////////////////////////
	// 2. add a background image
	CCMenu* pMenu = nullptr;

	CCMenuItemImage *pOnTable = CCMenuItemImage::create(
										SHARED_MENU1_UNSELECTED.c_str(),
										SHARED_MENU1_SELECTED.c_str(),
										this,
										menu_selector(CMainMenuLayer::newgameCallback)
										);
    
	CCSprite* pMenuImg01 = CCSprite::create(MAIN_MENU1_IMG.c_str());
	pMenuImg01->setPosition(CCPoint(MAIN_MENU1_IMG_POS));
	pMenuImg01->setAnchorPoint(ccp(0,0));
	addChild(pMenuImg01,3);

	pOnTable->setAnchorPoint(ccp(0,0));
	pOnTable->setPosition(CCPoint(MAIN_MENU1_POS) );

	// create menu, it's an autorelease object
	pMenu = CCMenu::create(pOnTable, NULL);
	pMenu->setPosition(CCPointZero);
	this->addChild(pMenu, 1);

	CCMenuItemImage *pOnLine = CCMenuItemImage::create(
										SHARED_MENU2_UNSELECTED.c_str(),
										SHARED_MENU2_SELECTED.c_str(),
										this,
										menu_selector(CMainMenuLayer::multiplayCallback)
										);
    
	CCSprite* pMenuImg02 = CCSprite::create(MAIN_MENU2_IMG.c_str());
	pMenuImg02->setPosition(CCPoint(MAIN_MENU2_IMG_POS));
	pMenuImg02->setAnchorPoint(ccp(0,0));
	addChild(pMenuImg02,3);

	pOnLine->setAnchorPoint(ccp(0,0));
	pOnLine->setPosition(CCPoint(MAIN_MENU2_POS));

	// create menu, it's an autorelease object
	pMenu = CCMenu::create(pOnLine, NULL);
	pMenu->setPosition(CCPointZero);
	this->addChild(pMenu, 1);

	CCMenuItemImage *pSetting = CCMenuItemImage::create(
										SHARED_MENU3_UNSELECTED.c_str(),
										SHARED_MENU3_SELECTED.c_str(),
										this,
										menu_selector(CMainMenuLayer::settingCallback)
										);

	CCSprite* pMenuImg03 = CCSprite::create(MAIN_MENU3_IMG.c_str());
	pMenuImg03->setPosition(CCPoint(MAIN_MENU3_IMG_POS));
	pMenuImg03->setAnchorPoint(ccp(0,0));
	addChild(pMenuImg03,3);

	pSetting->setAnchorPoint(ccp(0,0));
	pSetting->setPosition(CCPoint(MAIN_MENU3_POS));

	// create menu, it's an autorelease object
	pMenu = CCMenu::create(pSetting, NULL);
	pMenu->setPosition(CCPointZero);
	this->addChild(pMenu, 1);

	//create menu title
	CCSprite* pMenuTitle = CCSprite::create(MAIN_MENU_TITLE.c_str());
	pMenuTitle->setPosition(CCPoint(MAIN_MENU_TITLE_POS));
	pMenuTitle->setAnchorPoint(ccp(0,0));
	addChild(pMenuTitle,3);
    
    drawAnimation();
    
    
    return true;
}
Exemple #8
0
int drawTile(int row, int col, int state) {
    updateRenderBuffer(row, col, state);
    drawAnimation(row,col,state);
}