示例#1
0
void FrameReader::NextFrame()
{
    if (!running || movie.size() < 2) {
    return;
    }
		QObject *invoice = qobject_cast<QObject *>(sender());
		if (!invoice) {
		disconnect(this);
		QTimer::singleShot(200, this, SLOT(NextFrame()));
		return;
		}
		const int grab = qBound (0,current,movie.size() - 1);
		APNGFRAME im = movie[grab];
		///////////cout <<  "ID " << grab << "from." << movie.size() << " time " << im.play << " l." << running_loop << "\r";
		fflush ( stdin );
		current++;
		current = qBound (1,current,movie.size());
		if (current == movie.size()) {
		current = 0;
		}
		if (parent) {
		qApp->postEvent(parent,new ImageEvent(im));
		disconnect(this);
		running_loop++;
		QTimer::singleShot(im.play, this, SLOT(NextFrame()));
		}
}
示例#2
0
文件: item.cpp 项目: oriac/joc-2d
void cPlayer::Draw(int tex_id)
{	
	float xo,yo,xf,yf;

	switch(GetState())
	{
		//1
		case STATE_LOOKLEFT:	xo = 0.25f;	yo = 0.5f;
								break;
		//4
		case STATE_LOOKRIGHT:	xo = 0.25f;	yo = 0.75f;
								break;
		//1..3
		case STATE_WALKLEFT:	xo = 0.0f + (GetFrame()*0.25f);	yo = 0.5f ;
								NextFrame(3);
								break;
		//4..6
		case STATE_WALKRIGHT:	xo = 0.0f+ (GetFrame()*0.25f); yo = 0.75f ;
								NextFrame(3);
								break;
		case STATE_LOOKUP:		xo = 0.25f;	yo = 1.0f;
								break;
		case STATE_WALKUP:		xo = 0.0f + (GetFrame()*0.25f); yo = 1.0;
								NextFrame(3);
								break;
		case STATE_WALKDOWN:	xo = 0.0f + (GetFrame()*0.25f); yo = 0.25f;
								NextFrame(3);
								break;
		
			//4						
		case STATE_LOOKDOWN:	xo = 0.25f;	yo = 0.25f;
								break;
		case STATE_SHOOT_LEFT:	xo = 0.25f; yo = 0.5f;
								break;
		case STATE_SHOOT_RIGHT: xo = 0.25f; yo = 0.75f;
								break;
		case STATE_DUPLEFT:		xo = 0.0f + (GetFrame()*0.25f); yo = 1.0;
								NextFrame(3);
								break;
		case STATE_DUPRIGHT:	xo = 0.0f + (GetFrame()*0.25f); yo = 1.0;
								NextFrame(3);
								break;
		case STATE_DDOWNLEFT:	xo = 0.0f + (GetFrame()*0.25f); yo = 0.25f;
								NextFrame(3);
								break;
		case STATE_DDOWNRIGHT:	xo = 0.0f + (GetFrame()*0.25f); yo = 0.25f;
								NextFrame(3);
								break;
		case STATE_EXPLOTE:		xo = 0.75f; yo = 0.25f + (GetFrame()*0.25f);
								if (yo == 1.0f) explote = false;
								NextFrame(4);
								break;
	}
	xf = xo + 0.25f;
	yf = yo - 0.25f;

	DrawRect(tex_id,xo,yo,xf,yf);
}
示例#3
0
void Enemy::Draw(int tex_id, bool pause)
{	
	float xo,yo,xf,yf;
	
switch(state)
	{
		case STATE_WALKLEFT:	xo = 0.125f*(1+GetFrame());	yo = 3*0.125f;
								xf =  0.125f*(2+GetFrame());	yf = 2*0.125; if(!pause)NextFrame(4);
								break;

		case STATE_WALKRIGHT:	xf = 0.125f*(1+GetFrame());	yo = 3*0.125f;
								xo =  0.125f*(2+GetFrame());	yf = 2*0.125; if(!pause)NextFrame(4);
								break;

		case STATE_JUMPLEFT:	xo = 0.125f*(GetFrame());	yo = 4*0.125f;
								xf =  0.125f*(1+GetFrame());	yf = 3*0.125; if(!pause)NextFrame(3);
								break;
		
		case STATE_JUMPRIGHT:	xf = 0.125f*(GetFrame());	 yo = 4*0.125f;
								xo =  0.125f*(1+GetFrame());	yf = 3*0.125; if(!pause)NextFrame(3);
								break;
		
		case STATE_LOOKLEFT:	xo = 0;	 yo = 3*0.125f;
								xf =  0.125f;	yf = 2*0.125; 
								break;
		
		case STATE_LOOKRIGHT:	xo = 0;	 yo = 3*0.125f;
								xf =  0.125f;	yf = 2*0.125; 
								break;
		case STATE_HIT:			xo=0.125*(life-1); xf=xo+0.125;
								yo=(GetFrame()+1)*0.125; yf = GetFrame()*0.125;
								if(!pause) NextFrame(2);
								break;
		case STATE_SNOWBALL:	xo=0.125*(life-1); xf=xo+0.125; yo=0.125; yf = 0;
								break;
        case STATE_STUNNED:	    xo = 0.125f*(GetFrame());	yo = 5*0.125f;
								xf =  0.125f*(1+GetFrame());	yf = 4*0.125; if(!pause) NextFrame(4);
								break;
		case STATE_THROWLEFT:	xo = 14*0.0625f+(seq*0.0625f); yo = 3*0.0625f;
								xf = xo + 0.0625f;		yf = yo - 0.0625f; 
								if(!pause) NextFrame(1);
								break;
		case STATE_THROWRIGHT:	xo = 14*0.0625f+(seq*0.0625f); yo = 4*0.0625f;
								xf = xo + 0.0625f;		yf = yo - 0.0625f; 
								if(!pause) NextFrame(1);
								break;
		case STATE_SNOWBALL_MOVING:	xo=0.125*(life-1); xf=xo+0.125; yo=0.125; yf = 0;
								break;
		case STATE_SNOWBALL_PLAYER:	xo=0.125*(life-1); xf=xo+0.125; yo=0.125*2; yf = 0.125;
								break;
	}

	if(enemyType==ENEMY_ONE) {
		for (int i = 0; i < int(projectiles.size()); ++i) 
		projectiles[i].Draw(tex_id);
	}
	DrawRect(tex_id,xo,yo,xf,yf);
}
示例#4
0
//---------------------------------------------------------------------------
// 函数:	HandleNotify
// 功能:	处理音乐播放中的通告消息
// 参数:	void
// 返回:	void
//---------------------------------------------------------------------------
BOOL KLMp4Video::HandleNotify()
{
	DWORD dwEvent;
	
	// wait for event[0..3] to be signaled
	dwEvent = WaitForMultipleObjects(
		2,				// How many possible events
		m_hEvent,		// Location of handles
		FALSE,			// Wait for all?
		INFINITE);		// How long to wait
	
    // WAIT_OBJECT_0 == 0 but is properly treated as an arbitrary
    // index value assigned to the first event, therefore we subtract
    // it from dwEvent to get the zero-based index of the event.
	dwEvent -= WAIT_OBJECT_0;
	
	// If event[0] was set then goto next frame
	if (dwEvent == 0)
	{
		m_bWait = true;
		BOOL bRet = NextFrame();
		m_bWait = false;
		return bRet;
	}	
	
	// If the event[1] was set then exit thread
	return (dwEvent != 1);
}
示例#5
0
int main(int argc, char *argv[])
{
  int done = 0;
  int i,sx,sy;
  Uint8 *keys;
  Init_All();
  gamesounds[0] = LoadSound("sounds/victory.wav",MIX_MAX_VOLUME/2);
  gamesounds[1] = LoadSound("sounds/failure.wav",MIX_MAX_VOLUME/2);
  GameOptions(&DeadGame,0);
  GiveInfo();
  do
  {
    ResetBuffer();
    SDL_PumpEvents();
    Update_ALL();
    Think_ALL();
    keys = SDL_GetKeyState(NULL);    
    if(keys[SDLK_ESCAPE] == 1)done = 1;
    if(keys[SDLK_F1] == 1)GameOptions(&DeadGame,1);
    Draw_ALL();
    if(keys[SDLK_b] == 1)SDL_SaveBMP(screen,"screen0.bmp");
   // ItsRaining(IndexColor(LightRed),10,200,-0.2);
    NextFrame();
  }while(!done);
    
  exit(0);
  return 0;
}
void cWeapon::Draw(float alfa, float pitch)
{
	//glPushMatrix();

	//Recortamos los frames de la animación para no tener el efecto de delay
	NextFrame(Model->GetLastFrame() + 1);
	int frame = Model->GetFirstFrame()+7 + GetFrame();
	if (GetState() == ANIM_CROUCH_DEATH && GetFrame() == Model->GetLastFrame() - 1)
	{
		frame = Model->GetLastFrame();
	}

	

	//glPopMatrix();

	for (auto i = projectiles.begin(); i != projectiles.end(); ++i)
	{
		i->Draw();
	}

	//if (projectile != NULL)
	//{
		//projectile->Draw();
	//}

	Model->Render(Position.x, Position.y + h / 2, Position.z, alfa, pitch, frame, 1, scale, 10, 0, 0, 0);
}
示例#7
0
int CMonsterClubB1::DoAction(/*CScreen* scr, */IObjectManager* objMan)
{
	mYMove= (CGTimer::Time()-oldmove)*mSpeed;
	oldmove=CGTimer::Time();
	int i = CheckCollision(objMan);
	if(mJumpDirect==1)
	{	if (GetBit(i,2)==1)
	{
		mJumpDirect=0;
	}
	else
		mYPos=mYPos-mYMove;

	}
	if(mJumpDirect==0)
	{	if (GetBit(i,3)==1)
	{
		return -1;
	}
	else
		mYPos=mYPos+mYMove;

	}

	NextFrame();
	return 1;
}
示例#8
0
void WinCaptureDevice::Close()
{
	EnableCapture = 0;
	while (Frames.Size() != 0)
		free(NextFrame());
	SafeRelease(&Reader);
	CoTaskMemFree(SymbolicLink);
	SymbolicLink = NULL;
}
示例#9
0
文件: game.c 项目: jam92/IT276-Aard
/**
*@brief Draws the Title Screen
*/
int StateTitle()
{
	printf("In title screen\n");
	SDL_RenderClear(GetRenderer());
    UpdateTitleButtons();
	DrawTitle();
	NextFrame();
	return 0;
}
void CLoadingWindow::OnTimer(UINT_PTR nIDEvent)
{
	if ( nIDEvent == m_nTimerId )
	{
		DrawFrontImage();
		NextFrame();
	}
	CDialog::OnTimer(nIDEvent);
}
void cDog::Draw(int tex_id)
{	
	float xo,yo,xf,yf;

	yo = 1.0f;
	switch(GetState())
	{
		//1
		case STATE_LOOKLEFT:	xo = 0.25f;
								break;
		//4
		case STATE_LOOKRIGHT:	xo = 0.75f;
								break;
		//1
		case STATE_LOOKUP:		xo = 0.5f;
								break;
		//4
		case STATE_LOOKDOWN:	xo = 0.0f;
								break;

		//1..3
		case STATE_WALKLEFT:	xo = 0.25f + (GetFrame()*0.125f);
								NextFrame(2);
								break;
		//4..6
		case STATE_WALKRIGHT:	xo = 0.75f + (GetFrame()*0.125f);
								NextFrame(2);
								break;
		//1..3
		case STATE_WALKUP:	xo = 0.5f + (GetFrame()*0.125f);
								NextFrame(2);
								break;
		//4..6
		case STATE_WALKDOWN:	xo = 0.0f + (GetFrame()*0.125f);
								NextFrame(2);
								break;
	}
	xf = xo + 0.125f;
	yf = 0.0f;

	bool haveToBeDrawn = manageInvincibility();

	if (haveToBeDrawn) DrawRect(tex_id,xo,yo,xf,yf);
}
示例#12
0
void FrameReader::ReadStream()
{
	Openchunk *invoice = qobject_cast<Openchunk *>(sender());
  if (!invoice) {
		return;
	}
	if (!invoice->validpng) {
		QMessageBox::warning(0, tr("Error on reader."),tr("Error say:%1").arg(invoice->error()));
	return;
	}
	////////qDebug() << "### valid image...say .." << invoice->error();
	//////qDebug() << "### valid image...say .." << invoice->validpng;
	QMap<int,APNGFRAME> framlist = invoice->list();
	QMap<int,APNGFRAME> readylist;
	readylist.clear();
	if (QThread::currentThread() == qApp->thread()) {
     qDebug() << "### can paint .." << framlist.size();
	   QMapIterator<int,APNGFRAME> i(framlist);
		 int rec = -1;
         while (i.hasNext()) {
                i.next();
					       APNGFRAME one = i.value();
					     if (one.item.isNull()) {
					       QImage tmpe;
					       QImage Pvidi(one.maxframe.width(),one.maxframe.height(),QImage::Format_ARGB32);
					       if (tmpe.loadFromData(one.dimg)) {
								 QPainter p(&Pvidi);
								 p.setRenderHint(QPainter::Antialiasing, true);
								 p.setBrush(one.bg);
								 p.drawRect(one.maxframe);
								 p.drawImage(one.point,tmpe);
								 p.end();
								 one.item = Pvidi;
								 ///////qDebug() << "### isNull() out theard .." << one.item.isNull();
								 readylist.insert(rec++,one);
								 }
							 }
				 }
  }
	if (readylist.size() > 0 ) {
		movie = readylist;
		framlist.clear();
	} else {
		movie = framlist;
	}
	if (movie.size() < 1) {
	buffer->LoadFile(qfile); /* stay on buffer to save  */
	} else {
		current = 0;
		running = true;
		ValidApng = true;
		disconnect(this);
		NextFrame();
	}
}
示例#13
0
HRESULT WinCaptureDevice::OnReadSample(HRESULT hrStatus, DWORD dwStreamIndex, DWORD dwStreamFlags, LONGLONG llTimestamp, IMFSample *pSample)
{
	HRESULT hr = S_OK;
	IMFMediaBuffer *pBuffer = NULL;
	if (FAILED(hrStatus))
		hr = hrStatus;

	if (SUCCEEDED(hr))
	{
		if (pSample)
		{
			hr = pSample->GetBufferByIndex(0, &pBuffer);
			if (SUCCEEDED(hr))
			{
				VideoBufferLock vbuffer(pBuffer);
				BYTE* scan0 = NULL;
				LONG stride = 0;
				hr = vbuffer.LockBuffer(InputDefaultStride, InputHeight, &scan0, &stride);
				if (SUCCEEDED(hr))
				{
					Image* img = new Image();
					if (img->Alloc(ImgFmt::RGB8u, InputWidth, InputHeight))
					{
						byte* lineIn = scan0;
						byte* lineOut = (byte*) img->Scan0;
						for (int iline = 0; iline < (int) InputHeight; iline++)
						{
							memcpy(lineOut, lineIn, InputWidth * 3);
							lineIn += stride;
							lineOut += img->Stride;
						}
						Frames.Add(img);
						// This method of keeping the frame count down is subject to race conditions, but you've already screwed up here by losing frames,
						// so losing even more is not the end of the world.
						// 'delete' is safe to call on null, so we're OK even if the above mentioned race condition catches us.
						while (Frames.Size() > MaxFrames)
							delete NextFrame();
					}
					else
					{
						delete img;
					}
				}

				SafeRelease(&pBuffer);
			}
		}
	}

	// Request the next frame.
	if (SUCCEEDED(hr) && EnableCapture == 1)
		hr = Reader->ReadSample((DWORD) MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, NULL, NULL, NULL, NULL);

	return hr;
}
示例#14
0
void FrameReader::start()
{
	if (movie.size() < 2) {
    return;
	}
	  QApplication::beep();
	  current = 0;
		running = true;
		ValidApng = true;
	  NextFrame();
}
//==============================================================================================================================
void TextureAnimation3D::Update(int speed)
{
	if (!bPause)
	{
		//Set the current frame
		mCurrTexture = m_pTextures[(int)fCurrFrameID];

		//Get the next frame
		NextFrame(speed);
	}
}
示例#16
0
void cVoladorEstatico::Draw(cData * dat) {
	float xo, yo, xf, yf;
	xo = 0.1796875f * GetFrame(); //cada uno son 46*50 y la imagen es de 256*64
	yo = 0.78125f;
	NextFrame(4);
	//coord textur: xo,yo
	xf = xo + 0.1796875f;//1/8 da el 0.125
	yf = 0.f; //xk la nave ocupa toda la altura d la textura

	DrawRect(dat->GetID(IMG_ESTATIC), xo, yo, xf, yf);
}
示例#17
0
/* ------------------------------------------------------------------------------------ */
bool CAnimGif::DisplayNextFrameTexture(const char *szTextureName, bool FFrame)
{
	if(!Active)
		return false;

	if(FFrame)
	{
		geBitmap_Info Info;
		geBitmap *theBitmap = geWorld_GetBitmapByName(CCD->World(), szTextureName);

		if(!theBitmap)
		{
			Active = false;
			return false;
		}

		geBitmap_GetInfo(theBitmap, &Info, NULL);

		if(nWidth!=Info.Width || nHeight!=Info.Height)
		{
			Active = false;
			return false;
		}

		if(theBmp)
		{
// changed QD 12/15/05
			geEngine_RemoveBitmap(CCD->Engine()->Engine(), theBmp);
// end change
			geBitmap_Destroy(&theBmp);
		}

		theBmp = theBitmap;
		Texture = true;
		TotalReadByte = 0;
		pcGifTrack=pcGif;
		VAnimTime = (float)CCD->FreeRunningCounter();

		if(GetImage(true))
		{
			FirstFrame = false;
			return true;
		}

		FirstFrame = false;
		return false;
	}
	else
	{
		NextFrame(true);
	}

	return true;
}
示例#18
0
inline void cProyectil::DrawPEnemigo(cData * dat)
{
	float xo, yo, xf, yf;
	xo = 0.203125f * GetFrame(); //cada uno son 13*12, la imagen util 52*12 y la imagen es de 64*16
	yo = 1.f;
	NextFrame(4);
	//coord textur: xo,yo
	xf = xo + 0.203125f;//1/8 da el 0.125
	yf = 0.f; //xk la nave ocupa toda la altura d la textura
	DrawRect(dat->GetID(IMG_BULLET_VOLADOR), xo, yo, xf, yf);

}
bool VideoReaderUnit::SkipFrames(int frames) {
  int64_t seek_time = current_pos_ + (double)frames / fps_ * 1e6;

  if (seek_time > 0) {
    if (Seek(seek_time))
      return NextFrame();
    else
      return false;
  }
  else {
    return false;
  }
}
void cEntity::Render(int alfa, int pitch)
{
	static float n = 0; n += 0.2;
	NextFrame(Model->GetLastFrame() + 1);
	//int frame = Model.GetFirstFrame() + (int)n% Model.GetLastFrame() + 1;
	int frame = Model->GetFirstFrame() + GetFrame();
	if (GetState() == ANIM_CROUCH_DEATH && GetFrame() == Model->GetLastFrame() - 1)
	{
		frame = Model->GetLastFrame();
	}

	Model->Render(Position.x, Position.y + h / 2, Position.z, alfa, pitch, frame, 1, scale, 10, 0, 0, 0);
}
示例#21
0
文件: game.c 项目: jam92/IT276-Aard
int StateEditor()
{

	SDL_RenderClear(GetRenderer());
	UpdateMousePosition();
	UpdateEditorPanel(MainEditorPanels); 
	UpdateWorkspace();	
	DrawWorkspace();
	DrawEditorPanels(MainEditorPanels);
	NextFrame();
	return 0;

}
示例#22
0
void cPowerUp::Draw(cData * dat)
{

	float xo, yo, xf, yf;
	xo = 0.25f *GetFrame(); //cada uno son 46*50 y la imagen es de 256*64
	yo = 1.0f;
	NextFrame(4);
	//coord textur: xo,yo
	xf = xo + 0.25f;//1/8 da el 0.125
	yf = 0.f; //xk la nave ocupa toda la altura d la textura

	if (type == POWER_SHIELD) DrawRect(dat->GetID(IMG_SHIELD_POWER), xo, yo, xf, yf);
	else if(type == BULLET_DOBLE) DrawRect(dat->GetID(IMG_BULLET_POWER), xo, yo, xf, yf);
}
void cTear::Draw(int tex_id)
{
    float xo,xf;
    float yo = 1.0;
    float yf = 0.0;

    float width = 1/14.0;

    xo = 8 * width + (GetFrame()*width);
    NextFrame(6);
    xf = xo + width;

    DrawRect(tex_id,xo,yo,xf,yf);
}
示例#24
0
文件: game.c 项目: jc429/276game
/*notice the default arguments for main.  SDL expects main to look like that, so don't change it*/
int main(int argc, char *argv[])
{
	
	debuginputs = 1,bsize = 5;

	/*defaults for placeholder reasons*/
	c1 = DEBUG;
	c2 = DEBUG;
	stage = ST_PLATFORM;
	/**/
	pause = 0;
	pausequeue = 0;
	fpress = 0;

	Init_All();
/*	SaveCFG(&f2,"res/test.txt");*/
	do
	{   
		UpdateMouse();
		if(pausequeue==1){
			pausequeue=0;
			GamePause();
		}
		pausetimer--;
		InputControl();
		if(GameState==VERSUS){
			DrawVersus();
			UpdateVersus();
		}else if(GameState==MAIN_MENU){
			DrawMainMenu();
			UpdateMenu();
		}else if(GameState==C_SELECT){
			DrawCharSel();
			UpdateCharSel();
		}else if(GameState==C_CREATOR){
			DrawCharCr();
			UpdateCharCr();
		}
		NextFrame();		
		if(endgame){
			done = 1;
		}
			
		ResetBuffer();
	}while(!done);
	exit(0);		/*technically this will end the program, but the compiler likes all functions that can return a value TO return a value*/
	return 0;
}
示例#25
0
void Espada::Logic(vector<int> map, int width, vector<cBicho*> enemies)
{


	Weapon::Logic(map, width, enemies);
	if (GetFrame() > 2) {
		actionFinished = true;
		if (enemy_id == -1 || attackDelay > 10)
		{
			active = false;
		}
	}
	NextFrame(4);


}
示例#26
0
inline void cProyectil::DrawRayo(cData * dat)
{
	float xo, yo, xf, yf;
	xo = 0.375f; //cada uno son 13*12, la imagen util 52*12 y la imagen es de 64*16
	yo = 0.f + GetFrame()* 0.09375f;
	if (h < 22 && GetFrame() == 0) ++h;
	w += 10;
	NextFrame(2);
	//coord textur: xo,yo
	xf = xo + 0.21875f;//1/8 da el 0.125
	yf = yo + 0.09375; //xk la nave ocupa toda la altura d la textura
	DrawRect(dat->GetID(IMG_BOSS_RAYO), xo, yo, xf, yf);
	if (w >= 32) DrawCirculo1(dat, x+w-32);
	if (w >= 64) DrawCirculo2(dat, x + w - 64);
	if (w >= 96) DrawCirculo3(dat, x + w - 96);
}
示例#27
0
void GameOptions(Game *game,int options)   /*new game, quit, select difficulty*/
{
  Uint8 *keys;
  Sprite *menu;
  int done = 0;
  menu = LoadSprite("images/menu.png",640,480);
  do
  {
    ResetBuffer();
    SDL_PumpEvents();
    MouseThink();
    keys = SDL_GetKeyState(NULL);    
    if(keys[SDLK_ESCAPE] == 1)
    {
        exit(0);
    }
    if(keys[SDLK_RETURN] == 1)
    {
      FreeSprite(menu);
      SDL_PumpEvents();
      return;
    }
    if(keys[SDLK_F2] == 1)
    {
      NewGame(game);
      NewLevel(game,8,4);  /*sets up a new level*/
      done = 1;
      FreeSprite(menu);
    }
    DrawMessages();
    DrawSprite(menu,screen,(screen->w - 640)/2,(screen->h - 480)/2,0);
    DrawText("New Game  : F2",screen,(screen->w - 640)/2 + 50,(screen->h - 480)/2 + 160,IndexColor(LightGreen),F_Medium);
    DrawText("Quit      : Escape",screen,(screen->w - 640)/2 + 50,(screen->h - 480)/2 + 200,IndexColor(LightGreen),F_Medium);
    if(options == 0)
    {
      DrawText("This Menu : F1",screen,(screen->w - 640)/2 + 50,(screen->h - 480)/2 + 180,IndexColor(LightGreen),F_Medium);
    }
    else
    {
      DrawText("Cancel    : Enter",screen,(screen->w - 640)/2 + 50,(screen->h - 480)/2 + 180,IndexColor(LightGreen),F_Medium);
      DrawText("Game Paused",screen,(screen->w / 2) - 80,(screen->h - 480)/2 + 440,IndexColor(LightRed),F_Small);
    }
    DrawMouse();
    NextFrame();
  }while(!done);
  
}
示例#28
0
文件: game.c 项目: ljg6/MyGame2D
int pause_menu()
{
  static int i = 0;
  SDL_Renderer *render;
  render = gt_graphics_get_active_renderer();
  SDL_RenderClear(gt_graphics_get_active_renderer());
  ResetBuffer();
  mainScreen = loadSprite("images/pause_screen.png",800,600,1);
  selection = loadSprite("images/selection.png",149,53,1);
  if(i == 0)
	{
		drawSprite(mainScreen,0,vec2d(0,0),vec2d(1,1),0,gt_graphics_get_active_renderer());
		drawSprite(selection,0,vec2d(311,294),vec2d(1,1),0,gt_graphics_get_active_renderer());
  }else if(i ==1)
  {
	  drawSprite(mainScreen,0,vec2d(0,0),vec2d(1,1),0,gt_graphics_get_active_renderer());
	  drawSprite(selection,0,vec2d(311,377),vec2d(1,1),0,gt_graphics_get_active_renderer());
	  
  }
  NextFrame();
  SDL_PumpEvents();
  keys = SDL_GetKeyboardState(NULL);
  if(keys[SDL_SCANCODE_ESCAPE])
    {
        done = 1;
    }
  if(keys[SDL_SCANCODE_DOWN])
    {
	  i = 1;
	}
  if(keys[SDL_SCANCODE_UP])
  {
	  i = 0;
  }
  if(keys[SDL_SCANCODE_RETURN])
  {
	  if(i == 0)
	  {
		  gameState = 1;
	  }
	  else
	  {
		  done = 1;
	  }
  }	  
   return 1;
}
示例#29
0
/* ------------------------------------------------------------------------------------ */
int CAnimGif::Play(int XPos, int YPos, bool Center)
{
	if(!Active)
		return RGF_FAILURE;

	if(Center)
	{
		XPos = (CCD->Engine()->Width() - nWidth) / 2;
		YPos = (CCD->Engine()->Height() - nHeight) / 2;
	}


	for(;;)
	{
		MSG msg;

		//	If Winblows has something to say, take it in and pass it on in the
		//	..off-chance someone cares.
		while (PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE))
		{
			GetMessage(&msg, NULL, 0, 0 );
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}

		if(!CCD->GetHasFocus())
			continue;

		if(!NextFrame(false))
			break;

		geEngine_BeginFrame(CCD->Engine()->Engine(), CCD->CameraManager()->Camera(), GE_TRUE);
		geEngine_DrawBitmap(CCD->Engine()->Engine(), theBmp, NULL, XPos, YPos);
		geEngine_EndFrame(CCD->Engine()->Engine());

		if((GetAsyncKeyState(VK_SPACE) & 0x8000) != 0)
		{
			while((GetAsyncKeyState(VK_SPACE) & 0x8000) != 0)
			{
			}
			break;
		}
	}

	return RGF_SUCCESS;
}
THISCLASS::Frame *THISCLASS::GetFutureFrameByNumber(int number) {
	while (mCurrentFrame != mFrames.end()) {
		if (mCurrentFrame->number == number) {
			return &*mCurrentFrame;
		}
		if (mCurrentFrame->number > number) {
			break;
		}
		if (! NextFrame()) {
			break;
		}
	}

	// If no frame is available for this frame number, pretend to have a frame with no particles
	mEmptyFrame.number = number;
	return &mEmptyFrame;
}