示例#1
0
  void Show(const PixelRect &rc) override {
    assert(!visible);
    visible = true;

    UpdatePositions(rc);
    UpdateVisibility();
  }
示例#2
0
/* If one or two player will collide, this function will call another function for winning/losing animation.
	Check Collision
		Resets game if collision detected
		Draw Box of black to wipe game screen
	Else
		Update Player Positions

	Update Screen

*/
void UpdateGame( struct Player* Player1, struct Player* Player2, int** Grid, int *GameStatus, alt_up_pixel_buffer_dma_dev* pixel_buffer) {
	int terminate =0;
	//===========================================================
	// Check Collision
	terminate = CheckPlayerCollision( Player1, Player2, Grid);


	if (terminate != 0){

		//===========================================================
		// If collision detected
		*GameStatus = 0;
		GameReset(Player1, Player2, Grid);

		//===========================================================
		// Draws black box to clear the positions
		alt_up_pixel_buffer_dma_draw_box(pixel_buffer, 150, 45, 299, 194, 0, 0);

		// Display win or lose

	}

	else{
		//===========================================================
		// Updating the grid
		UpdatePositions( Player1, Player2, Grid);

		//===========================================================
		// Draw pixels where the players are
		UpdateScreen(Player1, Player2, pixel_buffer);
	}
}
示例#3
0
void CGameClient::OnRender()
{
	/*Graphics()->Clear(1,0,0);

	menus->render_background();
	return;*/
	/*
	Graphics()->Clear(1,0,0);
	Graphics()->MapScreen(0,0,100,100);

	Graphics()->QuadsBegin();
		Graphics()->SetColor(1,1,1,1);
		Graphics()->QuadsDraw(50, 50, 30, 30);
	Graphics()->QuadsEnd();

	return;*/

	// update the local character and spectate position
	UpdatePositions();

	// dispatch all input to systems
	DispatchInput();

	// render all systems
	for(int i = 0; i < m_All.m_Num; i++)
		m_All.m_paComponents[i]->OnRender();
}
示例#4
0
void CGameClient::OnRender()
{
	/*Graphics()->Clear(1,0,0);

	menus->render_background();
	return;*/
	/*
	Graphics()->Clear(1,0,0);
	Graphics()->MapScreen(0,0,100,100);

	Graphics()->QuadsBegin();
		Graphics()->SetColor(1,1,1,1);
		Graphics()->QuadsDraw(50, 50, 30, 30);
	Graphics()->QuadsEnd();

	return;*/

	// update the local character and spectate position
	UpdatePositions();

	// dispatch all input to systems
	DispatchInput();

	// render all systems
	for(int i = 0; i < m_All.m_Num; i++)
		m_All.m_paComponents[i]->OnRender();

	// clear new tick flags
	m_NewTick = false;
	m_NewPredictedTick = false;

	// check if client info has to be resent
	if(m_LastSendInfo && Client()->State() == IClient::STATE_ONLINE && m_Snap.m_LocalClientID >= 0 && !m_pMenus->IsActive() && m_LastSendInfo+time_freq()*6 < time_get())
	{
		// resend if client info differs
		if(str_comp(g_Config.m_PlayerName, m_aClients[m_Snap.m_LocalClientID].m_aName) ||
			str_comp(g_Config.m_PlayerClan, m_aClients[m_Snap.m_LocalClientID].m_aClan) ||
			g_Config.m_PlayerCountry != m_aClients[m_Snap.m_LocalClientID].m_Country)
		{
			SendInfo(false);
		}
		for(int p = 0; p < NUM_SKINPARTS; p++)
		{
			if(str_comp(gs_apSkinVariables[p], m_aClients[m_Snap.m_LocalClientID].m_aaSkinPartNames[p]))
				SendInfo(false);
			else if(*gs_apUCCVariables[p] != m_aClients[m_Snap.m_LocalClientID].m_aUseCustomColors[p] ||
				*gs_apColorVariables[p] != m_aClients[m_Snap.m_LocalClientID].m_aSkinPartColors[p])
			{
				SendInfo(false);
			}
		}
		m_LastSendInfo = 0;
	}
}
示例#5
0
文件: main.cpp 项目: minh0722/HPC2015
void Universe_Run(float time, float delta, Result* result)
{
	for (float t = 0; t < time; t+=delta)
	{
		//if we have 1 collision between 2 objects, 2 objects died
		int aliveObjectsAmount = result->positions_count - result->collisions_count*2 - result->destructions_count;

		UpdatePositions(result, aliveObjectsAmount, delta);
		UpdateCollisionsAndDestructions(result, aliveObjectsAmount, t);
	}
}
示例#6
0
void CGameClient::OnRender()
{
	// update the local character and spectate position
	UpdatePositions();

	// render all systems
	for(int i = 0; i < m_All.m_Num; i++)
		m_All.m_paComponents[i]->OnRender();

	// clear all events/input for this frame
	Input()->Clear();
}
示例#7
0
void CGameClient::OnRender()
{
	/*Graphics()->Clear(1,0,0);

	menus->render_background();
	return;*/
	/*
	Graphics()->Clear(1,0,0);
	Graphics()->MapScreen(0,0,100,100);

	Graphics()->QuadsBegin();
		Graphics()->SetColor(1,1,1,1);
		Graphics()->QuadsDraw(50, 50, 30, 30);
	Graphics()->QuadsEnd();

	return;*/

	// update the local character and spectate position
	UpdatePositions();

	// dispatch all input to systems
	DispatchInput();

	// render all systems
	for(int i = 0; i < m_All.m_Num; i++)
		m_All.m_paComponents[i]->OnRender();

	// clear new tick flags
	m_NewTick = false;
	m_NewPredictedTick = false;

	// check if client info has to be resent
	if(m_LastSendInfo && Client()->State() == IClient::STATE_ONLINE && m_Snap.m_LocalClientID >= 0 && !m_pMenus->IsActive() && m_LastSendInfo+time_freq()*5 < time_get())
	{
		// resend if client info differs
		if(str_comp(g_Config.m_PlayerName, m_aClients[m_Snap.m_LocalClientID].m_aName) ||
			str_comp(g_Config.m_PlayerClan, m_aClients[m_Snap.m_LocalClientID].m_aClan) ||
			g_Config.m_PlayerCountry != m_aClients[m_Snap.m_LocalClientID].m_Country ||
			str_comp(g_Config.m_PlayerSkin, m_aClients[m_Snap.m_LocalClientID].m_aSkinName) ||
			(m_Snap.m_pGameInfoObj && !(m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_TEAMS) &&	// no teamgame?
			(g_Config.m_PlayerUseCustomColor != m_aClients[m_Snap.m_LocalClientID].m_UseCustomColor ||
			g_Config.m_PlayerColorBody != m_aClients[m_Snap.m_LocalClientID].m_ColorBody ||
			g_Config.m_PlayerColorFeet != m_aClients[m_Snap.m_LocalClientID].m_ColorFeet)))
		{
			SendInfo(false);
		}
		m_LastSendInfo = 0;
	}
}
示例#8
0
 void Move(const PixelRect &rc) override {
   UpdatePositions(rc);
 }
示例#9
0
void CGameClient::OnRender()
{
    if (!m_Music)
    {
        m_Music = new CMusic(this);
    }
    if (!m_Msgs)
    {
        m_Msgs = new CNMsg(this);
    }
    if (!m_pLua)
    {
        m_pLua = new CLua(this);
        m_pLuaBinding = new CLuaBinding(this);
        Console()->Register("lua", "s?ssssssss", CFGFLAG_CLIENT, ConLua, this, "Exec a lua function");
        Console()->Register("+lua", "s?ssssssss", CFGFLAG_CLIENT, ConPlusLua, this, "Exec a lua function");
        Console()->Register("lua_eval", "r", CFGFLAG_CLIENT, ConLuaEval, this, "Evaluate a lua statement");
    }

    int64 overalltime = time_get(); //Debug timing
    m_Music->Tick();
    m_Msgs->Tick();
    m_pLua->Tick();

    if (Client()->State() != IClient::STATE_OFFLINE && m_pMenus->GetGamePage() != CMenus::PAGE_SETTINGS && !m_pMenus->IsActive() && m_pMenus->m_ActivLuaFile != -1 && m_pLua)
    {
        m_pLua->m_aLuaFiles[m_pMenus->m_ActivLuaFile].ConfigClose();
        m_pMenus->m_ActivLuaFile = -1;
    }
	// update the local character position
	UpdatePositions();

	// dispatch all input to systems
	DispatchInput();

	// render all systems
	for(int i = 0; i < m_All.m_Num; i++)
	{
        m_All.m_paComponents[i]->OnRender();
	}


	// clear new tick flags
	m_NewTick = false;
	m_NewPredictedTick = false;

	// check if client info has to be resent
	if(m_LastSendInfo && Client()->State() == IClient::STATE_ONLINE && !m_pMenus->IsActive() && m_LastSendInfo+time_freq()*5 < time_get())
	{
		// resend if client info differs
		if(str_comp(g_Config.m_PlayerName, m_aClients[m_Snap.m_LocalClientID].m_aName) ||
			str_comp(g_Config.m_PlayerClan, m_aClients[m_Snap.m_LocalClientID].m_aClan) ||
			g_Config.m_PlayerCountry != m_aClients[m_Snap.m_LocalClientID].m_Country ||
			str_comp(g_Config.m_PlayerSkin, m_aClients[m_Snap.m_LocalClientID].m_aSkinName) ||
			(m_Snap.m_pGameInfoObj && !(m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_TEAMS) &&	// no teamgame?
			(g_Config.m_PlayerUseCustomColor != m_aClients[m_Snap.m_LocalClientID].m_UseCustomColor ||
			g_Config.m_PlayerColorBody != m_aClients[m_Snap.m_LocalClientID].m_ColorBody ||
			g_Config.m_PlayerColorFeet != m_aClients[m_Snap.m_LocalClientID].m_ColorFeet)))
		{
			SendInfo(false);
		}
		m_LastSendInfo = 0;
	}
}
示例#10
0
void
StickyScrollContainer::ScrollPositionDidChange(nscoord aX, nscoord aY)
{
  UpdatePositions(nsPoint(aX, aY), nullptr);
}