本文整理汇总了C++中QuadItem函数的典型用法代码示例。如果您正苦于以下问题:C++ QuadItem函数的具体用法?C++ QuadItem怎么用?C++ QuadItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QuadItem函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Graphics
void CAssetsEditor::RenderBackground()
{
Graphics()->TextureClear();
Graphics()->QuadsBegin();
Graphics()->SetColor(58.0f/255.0f, 58.0f/255.0f, 58.0f/255.0f, 1.0f);
IGraphics::CQuadItem QuadItem(m_DrawRect.w/2, m_DrawRect.h/2, m_DrawRect.w, m_DrawRect.h);
Graphics()->QuadsDraw(&QuadItem, 1);
Graphics()->QuadsEnd();
}
开发者ID:teeworlds-modapi,项目名称:teeworlds,代码行数:11,代码来源:assetseditor.cpp
示例2: Graphics
int CMenus::DoButton_Icon(int ImageId, int SpriteId, const CUIRect *pRect)
{
Graphics()->TextureSet(g_pData->m_aImages[ImageId].m_Id);
Graphics()->QuadsBegin();
RenderTools()->SelectSprite(SpriteId);
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
return 0;
}
开发者ID:DarkTwister,项目名称:TDTW-0.6-trunk,代码行数:12,代码来源:menus.cpp
示例3: Graphics
int CMenus::DoButton_BrowseIcon(int What, const CUIRect *pRect)
{
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BROWSEICONS].m_Id);
Graphics()->QuadsBegin();
RenderTools()->SelectSprite(What);
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
return 0;
}
开发者ID:wthnonck,项目名称:tdtw,代码行数:12,代码来源:menus.cpp
示例4: RenderTools
int CMenus::DoButton_DemoPlayer_Sprite(const void *pID, int SpriteId, int Checked, const CUIRect *pRect)
{
RenderTools()->DrawUIRect(pRect, vec4(1,1,1, Checked ? 0.10f : 0.5f)*ButtonColorMul(pID), CUI::CORNER_ALL, 5.0f);
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_DEMOBUTTONS].m_Id);
Graphics()->QuadsBegin();
RenderTools()->SelectSprite(SpriteId);
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
return UI()->DoButtonLogic(pID, "", Checked, pRect);
}
开发者ID:Landil,项目名称:teeworlds,代码行数:12,代码来源:menus_demo.cpp
示例5: Graphics
void CLayerTiles::BrushSelecting(CUIRect Rect)
{
Graphics()->TextureClear();
m_pEditor->Graphics()->QuadsBegin();
m_pEditor->Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.4f);
Snap(&Rect);
IGraphics::CQuadItem QuadItem(Rect.x, Rect.y, Rect.w, Rect.h);
m_pEditor->Graphics()->QuadsDrawTL(&QuadItem, 1);
m_pEditor->Graphics()->QuadsEnd();
char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d,%d", ConvertX(Rect.w), ConvertY(Rect.h));
TextRender()->Text(0, Rect.x+3.0f, Rect.y+3.0f, m_pEditor->m_ShowPicker?15.0f:15.0f*m_pEditor->m_WorldZoom, aBuf, -1);
}
开发者ID:Cokemonkey11,项目名称:teeworlds,代码行数:13,代码来源:layer_tiles.cpp
示例6: time_get
void CAStar::OnRender()
{
if(!g_Config.m_ClPathFinding)
return;
// find the path one second after joining to be buffered
{
static int64 activationTime = 0;
if(m_MapReloaded)
{
activationTime = time_get();
}
if(activationTime && time_get() > activationTime+time_freq())
{
//FillGrid(true);
m_pThread = thread_init(BuildPath, this);
//thread_detach(m_pThread);
activationTime = 0;
}
else
m_MapReloaded = false;
}
const CNetObj_Character * pPlayerChar = m_pClient->m_Snap.m_pLocalCharacter;
const CNetObj_Character * pPrevChar = m_pClient->m_Snap.m_pLocalPrevCharacter;
if (pPlayerChar && pPrevChar)
m_LastPos = mix(vec2(pPrevChar->m_X, pPrevChar->m_Y), vec2(pPlayerChar->m_X, pPlayerChar->m_Y), Client()->IntraGameTick());
if(Client()->State() != IClient::STATE_ONLINE)
return;
// visualize the path
Graphics()->BlendAdditive();
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_PARTICLES].m_Id);
Graphics()->QuadsBegin();
for(int i = 0; i < m_Path.size(); i++)
{
int aSprites[] = {SPRITE_PART_SPLAT01, SPRITE_PART_SPLAT02, SPRITE_PART_SPLAT03};
RenderTools()->SelectSprite(aSprites[i%3]);
//Graphics()->QuadsSetRotation(Client()->GameTick());
Graphics()->SetColor(0.9f, 0.9f, 0.9f, 0.85f);
IGraphics::CQuadItem QuadItem(m_Path[i].x, m_Path[i].y, 16, 16);
Graphics()->QuadsDraw(&QuadItem, 1);
}
Graphics()->QuadsEnd();
}
开发者ID:bertopm99,项目名称:AllTheHaxx,代码行数:50,代码来源:astar.cpp
示例7: RenderTools
int CMenus::DoButton_Sprite(const void *pID, int ImageID, int SpriteID, int Checked, const CUIRect *pRect, int Corners)
{
RenderTools()->DrawUIRect(pRect, Checked ? vec4(1.0f, 1.0f, 1.0f, 0.10f) : vec4(1.0f, 1.0f, 1.0f, 0.5f)*ButtonColorMul(pID), Corners, 5.0f);
Graphics()->TextureSet(g_pData->m_aImages[ImageID].m_Id);
Graphics()->QuadsBegin();
if(!Checked)
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.5f);
RenderTools()->SelectSprite(SpriteID);
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
return UI()->DoButtonLogic(pID, "", Checked, pRect);
}
开发者ID:TeeWorlds-org,项目名称:teeworlds,代码行数:14,代码来源:menus_demo.cpp
示例8: HexToRgba
void CLayerTiles::BrushSelecting(CUIRect Rect)
{
vec4 FillColor = HexToRgba(g_Config.m_EdColorSelectionTile);
Graphics()->TextureClear();
m_pEditor->Graphics()->QuadsBegin();
m_pEditor->Graphics()->SetColor(FillColor.r*FillColor.a, FillColor.g*FillColor.a, FillColor.b*FillColor.a, FillColor.a);
Snap(&Rect);
IGraphics::CQuadItem QuadItem(Rect.x, Rect.y, Rect.w, Rect.h);
m_pEditor->Graphics()->QuadsDrawTL(&QuadItem, 1);
m_pEditor->Graphics()->QuadsEnd();
char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d,%d", ConvertX(Rect.w), ConvertY(Rect.h));
TextRender()->Text(0, Rect.x+3.0f, Rect.y+3.0f, m_pEditor->m_ShowTilePicker?15.0f:15.0f*m_pEditor->m_WorldZoom, aBuf, -1);
}
开发者ID:Mailaender,项目名称:teeworlds,代码行数:15,代码来源:layer_tiles.cpp
示例9: ButtonFade
int CMenus::DoButton_Sprite(const void *pID, int ImageID, int SpriteID, const CUIRect *pRect, int Corners)
{
float Seconds = 0.6f; // 0.6 seconds for fade
float *pFade = ButtonFade(pID, Seconds);
RenderTools()->DrawUIRect(pRect, vec4(1.0f, 1.0f, 1.0f, 0.5f+(*pFade/Seconds)*0.25f), Corners, 5.0f);
Graphics()->TextureSet(g_pData->m_aImages[ImageID].m_Id);
Graphics()->QuadsBegin();
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.5f);
RenderTools()->SelectSprite(SpriteID);
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
return UI()->DoButtonLogic(pID, "", false, pRect);
}
开发者ID:KingteEGER,项目名称:teeworlds,代码行数:16,代码来源:menus_demo.cpp
示例10: GetAngle
void CPlayers::RenderHand(CTeeRenderInfo *pInfo, vec2 CenterPos, vec2 Dir, float AngleOffset, vec2 PostRotOffset)
{
// for drawing hand
//const skin *s = skin_get(skin_id);
float BaseSize = 15.0f;
//dir = normalize(hook_pos-pos);
vec2 HandPos = CenterPos + Dir;
float Angle = GetAngle(Dir);
if (Dir.x < 0)
Angle -= AngleOffset;
else
Angle += AngleOffset;
vec2 DirX = Dir;
vec2 DirY(-Dir.y,Dir.x);
if (Dir.x < 0)
DirY = -DirY;
HandPos += DirX * PostRotOffset.x;
HandPos += DirY * PostRotOffset.y;
//Graphics()->TextureSet(data->m_aImages[IMAGE_CHAR_DEFAULT].id);
Graphics()->TextureSet(pInfo->m_aTextures[CSkins::SKINPART_HANDS]);
Graphics()->QuadsBegin();
vec4 Color = pInfo->m_aColors[CSkins::SKINPART_HANDS];
Graphics()->SetColor(Color.r, Color.g, Color.b, Color.a);
// two passes
for (int i = 0; i < 2; i++)
{
bool OutLine = i == 0;
RenderTools()->SelectSprite(OutLine?SPRITE_TEE_HAND_OUTLINE:SPRITE_TEE_HAND, 0, 0, 0);
Graphics()->QuadsSetRotation(Angle);
IGraphics::CQuadItem QuadItem(HandPos.x, HandPos.y, 2*BaseSize, 2*BaseSize);
Graphics()->QuadsDraw(&QuadItem, 1);
}
Graphics()->QuadsSetRotation(0);
Graphics()->QuadsEnd();
}
开发者ID:4a4ik,项目名称:teeworlds,代码行数:44,代码来源:players.cpp
示例11: CALLSTACK_ADD
int CMenus::DoButton_Sprite(CButtonContainer *pBC, int ImageID, int SpriteID, int Checked, const CUIRect *pRect, int Corners, const char *pTooltip)
{
CALLSTACK_ADD();
RenderTools()->DrawUIRect(pRect, Checked ? vec4(1.0f, 1.0f, 1.0f, 0.10f) : vec4(1.0f, 1.0f, 1.0f, 0.5f)*ButtonColorMul(pBC), Corners, 5.0f);
Graphics()->TextureSet(g_pData->m_aImages[ImageID].m_Id);
Graphics()->QuadsBegin();
if(!Checked)
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.5f);
RenderTools()->SelectSprite(SpriteID);
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
if(UI()->MouseInside(pRect) && pTooltip)
m_pClient->m_pTooltip->SetTooltip(pTooltip);
return UI()->DoButtonLogic(pBC->GetID(), "", Checked, pRect);
}
开发者ID:AllTheHaxx,项目名称:AllTheHaxx,代码行数:19,代码来源:menus_demo.cpp
示例12: Graphics
void CRenderTools::RenderItem(int ItemID, vec2 Pos, int TextureBlocks, float Scale, vec2 WeaponSize, float Alpha, float Rot)
{
if (ItemID >= NUM_WEAPONS)
{
Graphics()->TextureSet(TextureBlocks);
RenderTile((ItemID-NUM_WEAPONS)%CBlockManager::MAX_BLOCKS, vec2(Pos.x+7.5f, Pos.y+3.5f), Scale, Alpha, Rot);
}
else
{
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
Graphics()->QuadsBegin();
SelectSprite(g_pData->m_Weapons.m_aId[ItemID%NUM_WEAPONS].m_pSpriteBody);
Graphics()->SetColor(1.0f, 1.0f, 1.0f, Alpha);
IGraphics::CQuadItem QuadItem(Pos.x, Pos.y, WeaponSize.x, WeaponSize.y);
Graphics()->QuadsSetRotation(Rot);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
}
}
开发者ID:CytraL,项目名称:MineTee,代码行数:19,代码来源:render.cpp
示例13: Graphics
void CItems::RenderFlag(const CNetObj_Flag *pPrev, const CNetObj_Flag *pCurrent)
{
float Angle = 0.0f;
float Size = 42.0f;
Graphics()->BlendNormal();
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
Graphics()->QuadsBegin();
if(pCurrent->m_Team == TEAM_RED)
RenderTools()->SelectSprite(SPRITE_FLAG_RED);
else
RenderTools()->SelectSprite(SPRITE_FLAG_BLUE);
Graphics()->QuadsSetRotation(Angle);
vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());
// make sure that the flag isn't interpolated between capture and return
if(pPrev->m_CarriedBy != pCurrent->m_CarriedBy)
Pos = vec2(pCurrent->m_X, pCurrent->m_Y);
// make sure to use predicted position if we are the carrier
if(m_pClient->m_Snap.m_pLocalInfo && pCurrent->m_CarriedBy == m_pClient->m_Snap.m_pLocalInfo->m_ClientID)
Pos = m_pClient->m_LocalCharacterPos;
if(pCurrent->m_Team == 0) // red team
{
//RenderTools()->SelectSprite(SPRITE_FLAG_RED);
if(g_Config.m_ClEffectsFlagtrail)
m_pClient->m_pEffects->PowerupShine(Pos, vec2(32,32),vec4(0.89f,0.16f,0.21f,1));
}
else
{
//RenderTools()->SelectSprite(SPRITE_FLAG_BLUE);
if(g_Config.m_ClEffectsFlagtrail)
m_pClient->m_pEffects->PowerupShine(Pos, vec2(32,32),vec4(0.098f,0.10f,0.89f,1));
}
IGraphics::CQuadItem QuadItem(Pos.x, Pos.y-Size*0.75f, Size, Size*2);
Graphics()->QuadsDraw(&QuadItem, 1);
Graphics()->QuadsEnd();
}
开发者ID:CoolerMAN,项目名称:tdtw,代码行数:43,代码来源:items.cpp
示例14: GetByCountryCode
void CCountryFlags::Render(int CountryCode, const vec4 *pColor, float x, float y, float w, float h)
{
const CCountryFlag *pFlag = GetByCountryCode(CountryCode);
if(pFlag->m_Texture != -1)
{
Graphics()->TextureSet(pFlag->m_Texture);
Graphics()->QuadsBegin();
Graphics()->SetColor(pColor->r, pColor->g, pColor->b, pColor->a);
IGraphics::CQuadItem QuadItem(x, y, w, h);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
}
else
{
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, x, y, 10.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = w;
TextRender()->TextEx(&Cursor, pFlag->m_aCountryCodeString, -1);
}
}
开发者ID:123pikapokapei,项目名称:HClient,代码行数:20,代码来源:countryflags.cpp
示例15: mix
void CBuildings::RenderStand(const CNetObj_Building *pCurrent, const CNetObj_Building *pPrev)
{
vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());
int s = pCurrent->m_Status;
bool Flip = s & (1<<BSTATUS_MIRROR);
int FlipY = Flip ? -1 : 1;
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BUILDINGS].m_Id);
Graphics()->QuadsBegin();
RenderTools()->SelectSprite(SPRITE_STAND, Flip ? SPRITE_FLAG_FLIP_Y : 0);
Graphics()->SetColor(1, 1, 1, 1);
Graphics()->QuadsSetRotation(0);
//RenderTools()->DrawSprite(pCurrent->m_X, pCurrent->m_Y-24, 96*1.3f);
float Scale = 0.8f;
IGraphics::CQuadItem QuadItem(Pos.x, Pos.y-25*FlipY, 96*Scale, 128*Scale); // -37
Graphics()->QuadsDraw(&QuadItem, 1);
Graphics()->QuadsEnd();
// skip tip if local player is undead
if (m_pClient->m_Snap.m_pGameInfoObj)
{
int Flags = m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags;
if (Flags & GAMEFLAG_INFECTION && CustomStuff()->m_LocalTeam == TEAM_BLUE)
return;
}
// render drop weapon tip for local player
if (distance(CustomStuff()->m_LocalPos, vec2(Pos.x, Pos.y+15)) < 45 && ValidForTurret(CustomStuff()->m_LocalWeapon))
{
TextRender()->TextColor(0.2f, 0.7f, 0.2f, 1);
TextRender()->Text(0, Pos.x + 22, Pos.y - 30 - 60*FlipY, 32, m_pClient->m_pBinds->GetKey("+dropweapon"), -1);
TextRender()->TextColor(1, 1, 1, 1);
}
}
开发者ID:Siile,项目名称:Ninslash,代码行数:40,代码来源:buildings.cpp
示例16: Graphics
void CItems::RenderFlag(const CNetObj_Flag *pPrev, const CNetObj_Flag *pCurrent, const CNetObj_GameData *pPrevGameData, const CNetObj_GameData *pCurGameData)
{
float Angle = 0.0f;
float Size = 42.0f;
Graphics()->BlendNormal();
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
Graphics()->QuadsBegin();
if(pCurrent->m_Team == TEAM_RED)
RenderTools()->SelectSprite(SPRITE_FLAG_RED);
else
RenderTools()->SelectSprite(SPRITE_FLAG_BLUE);
Graphics()->QuadsSetRotation(Angle);
vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());
if(pCurGameData)
{
// make sure that the flag isn't interpolated between capture and return
if(pPrevGameData &&
((pCurrent->m_Team == TEAM_RED && pPrevGameData->m_FlagCarrierRed != pCurGameData->m_FlagCarrierRed) ||
(pCurrent->m_Team == TEAM_BLUE && pPrevGameData->m_FlagCarrierBlue != pCurGameData->m_FlagCarrierBlue)))
Pos = vec2(pCurrent->m_X, pCurrent->m_Y);
// make sure to use predicted position if we are the carrier
if(m_pClient->m_Snap.m_pLocalInfo &&
((pCurrent->m_Team == TEAM_RED && pCurGameData->m_FlagCarrierRed == m_pClient->m_Snap.m_LocalClientID) ||
(pCurrent->m_Team == TEAM_BLUE && pCurGameData->m_FlagCarrierBlue == m_pClient->m_Snap.m_LocalClientID)))
Pos = m_pClient->m_LocalCharacterPos;
}
IGraphics::CQuadItem QuadItem(Pos.x, Pos.y-Size*0.75f, Size, Size*2);
Graphics()->QuadsDraw(&QuadItem, 1);
Graphics()->QuadsEnd();
}
开发者ID:Ryozuki,项目名称:TeeSmash,代码行数:37,代码来源:items.cpp
示例17: UpdateTextCache
void CTextRenderer::DrawText(CTextCache* pTextCache, ivec2 Position, vec4 Color)
{
UpdateTextCache(pTextCache);
Graphics()->TextureSet(m_GlyphCaches[pTextCache->m_GlyphCacheId]->m_Texture);
Graphics()->QuadsBegin();
for(int p=0; p<2; p++)
{
vec2 Offset = 0.0f;
if(p==0)
{
Graphics()->SetColor(0.0f, 0.0f, 0.0f, 0.5f*Color.a);
Offset = vec2(0.0f, 1.0f);
}
else
Graphics()->SetColor(Color, true);
for(int i=0; i<pTextCache->m_Quads.size(); i++)
{
Graphics()->QuadsSetSubset(
pTextCache->m_Quads[i].m_UVMin.x,
pTextCache->m_Quads[i].m_UVMin.y,
pTextCache->m_Quads[i].m_UVMax.x,
pTextCache->m_Quads[i].m_UVMax.y
);
IGraphics::CQuadItem QuadItem(
Position.x + pTextCache->m_Quads[i].m_QuadPos.x + Offset.x,
Position.y + pTextCache->m_Quads[i].m_QuadPos.y + Offset.y,
pTextCache->m_Quads[i].m_Size.x,
pTextCache->m_Quads[i].m_Size.y
);
Graphics()->QuadsDrawTL(&QuadItem, 1);
}
}
Graphics()->QuadsEnd();
}
开发者ID:teeworlds-modapi,项目名称:teeworlds,代码行数:36,代码来源:textrenderer.cpp
示例18: vec4
//.........这里部分代码省略.........
// check for ninja
if (Player.m_Weapon == WEAPON_NINJA)
{
// change the skin for the player to the ninja
int Skin = m_pClient->m_pSkins->Find("x_ninja");
if(Skin != -1)
{
if(IsTeamplay)
RenderInfo.m_Texture = m_pClient->m_pSkins->Get(Skin)->m_ColorTexture;
else
{
RenderInfo.m_Texture = m_pClient->m_pSkins->Get(Skin)->m_OrgTexture;
RenderInfo.m_ColorBody = vec4(1,1,1,1);
RenderInfo.m_ColorFeet = vec4(1,1,1,1);
}
}
}
float IntraTick = Client()->IntraGameTick();
if(Player.m_Health < 0) // dont render dead players
return;
// set size
RenderInfo.m_Size = 64.0f;
// use preditect players if needed
if(pInfo.m_Local && g_Config.m_ClPredict && Client()->State() != IClient::STATE_DEMOPLAYBACK)
{
if(!m_pClient->m_Snap.m_pLocalCharacter || (m_pClient->m_Snap.m_pLocalCharacter->m_Health < 0) || (m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver))
{
}
else
{
// apply predicted results
m_pClient->m_PredictedChar.Write(&Player);
m_pClient->m_PredictedPrevChar.Write(&Prev);
IntraTick = Client()->PredIntraGameTick();
}
}
vec2 Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), IntraTick);
if(Prev.m_Health < 0) // Don't flicker from previous position
Position = vec2(Player.m_X, Player.m_Y);
// draw hook
if (Prev.m_HookState>0 && Player.m_HookState>0)
{
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
Graphics()->QuadsBegin();
//Graphics()->QuadsBegin();
vec2 Pos = Position;
vec2 HookPos;
if(pPlayerChar->m_HookedPlayer != -1)
{
if(m_pClient->m_Snap.m_pLocalInfo && pPlayerChar->m_HookedPlayer == m_pClient->m_Snap.m_pLocalInfo->m_ClientId)
{
if(Client()->State() == IClient::STATE_DEMOPLAYBACK) // only use prediction if needed
HookPos = vec2(m_pClient->m_LocalCharacterPos.x, m_pClient->m_LocalCharacterPos.y);
else
HookPos = mix(vec2(m_pClient->m_PredictedPrevChar.m_Pos.x, m_pClient->m_PredictedPrevChar.m_Pos.y),
vec2(m_pClient->m_PredictedChar.m_Pos.x, m_pClient->m_PredictedChar.m_Pos.y), Client()->PredIntraGameTick());
}
else
HookPos = mix(vec2(pPrevChar->m_HookX, pPrevChar->m_HookY), vec2(pPlayerChar->m_HookX, pPlayerChar->m_HookY), Client()->IntraGameTick());
}
else
HookPos = mix(vec2(Prev.m_HookX, Prev.m_HookY), vec2(Player.m_HookX, Player.m_HookY), IntraTick);
float d = distance(Pos, HookPos);
vec2 Dir = normalize(Pos-HookPos);
Graphics()->QuadsSetRotation(GetAngle(Dir)+pi);
// render head
RenderTools()->SelectSprite(SPRITE_HOOK_HEAD);
IGraphics::CQuadItem QuadItem(HookPos.x, HookPos.y, 24,16);
Graphics()->QuadsDraw(&QuadItem, 1);
// render chain
RenderTools()->SelectSprite(SPRITE_HOOK_CHAIN);
IGraphics::CQuadItem Array[1024];
int i = 0;
for(float f = 24; f < d && i < 1024; f += 24, i++)
{
vec2 p = HookPos + Dir*f;
Array[i] = IGraphics::CQuadItem(p.x, p.y,24,16);
}
Graphics()->QuadsDraw(Array, i);
Graphics()->QuadsSetRotation(0);
Graphics()->QuadsEnd();
RenderHand(&RenderInfo, Position, normalize(HookPos-Pos), -pi/2, vec2(20, 0));
}
}
开发者ID:wthnonck,项目名称:tdtw,代码行数:101,代码来源:players.cpp
示例19: str_format
void CMenus::RenderSettingsPlayer(CUIRect MainView)
{
CUIRect Button, Label;
MainView.HSplitTop(10.0f, 0, &MainView);
// player name
MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(80.0f, &Label, &Button);
Button.VSplitLeft(150.0f, &Button, 0);
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Name"));
UI()->DoLabelScaled(&Label, aBuf, 14.0, -1);
static float s_OffsetName = 0.0f;
if(DoEditBox(g_Config.m_PlayerName, &Button, g_Config.m_PlayerName, sizeof(g_Config.m_PlayerName), 14.0f, &s_OffsetName))
m_NeedSendinfo = true;
// player clan
MainView.HSplitTop(5.0f, 0, &MainView);
MainView.HSplitTop(20.0f, &Button, &MainView);
Button.VSplitLeft(80.0f, &Label, &Button);
Button.VSplitLeft(150.0f, &Button, 0);
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Clan"));
UI()->DoLabelScaled(&Label, aBuf, 14.0, -1);
static float s_OffsetClan = 0.0f;
if(DoEditBox(g_Config.m_PlayerClan, &Button, g_Config.m_PlayerClan, sizeof(g_Config.m_PlayerClan), 14.0f, &s_OffsetClan))
m_NeedSendinfo = true;
// country flag selector
MainView.HSplitTop(20.0f, 0, &MainView);
static float s_ScrollValue = 0.0f;
int OldSelected = -1;
UiDoListboxStart(&s_ScrollValue, &MainView, 50.0f, Localize("Country"), "", m_pClient->m_pCountryFlags->Num(), 6, OldSelected, s_ScrollValue);
for(int i = 0; i < m_pClient->m_pCountryFlags->Num(); ++i)
{
const CCountryFlags::CCountryFlag *pEntry = m_pClient->m_pCountryFlags->GetByIndex(i);
if(pEntry->m_CountryCode == g_Config.m_PlayerCountry)
OldSelected = i;
CListboxItem Item = UiDoListboxNextItem(&pEntry->m_CountryCode, OldSelected == i);
if(Item.m_Visible)
{
Item.m_Rect.Margin(10.0f, &Item.m_Rect);
float OldWidth = Item.m_Rect.w;
Item.m_Rect.w = Item.m_Rect.h*2;
Item.m_Rect.x += (OldWidth-Item.m_Rect.w)/ 2.0f;
Graphics()->TextureSet(pEntry->m_Texture);
Graphics()->QuadsBegin();
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
IGraphics::CQuadItem QuadItem(Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
}
}
const int NewSelected = UiDoListboxEnd(&s_ScrollValue, 0);
if(OldSelected != NewSelected)
{
g_Config.m_PlayerCountry = m_pClient->m_pCountryFlags->GetByIndex(NewSelected)->m_CountryCode;
m_NeedSendinfo = true;
}
}
开发者ID:Slinack,项目名称:teeworlds,代码行数:62,代码来源:menus_settings.cpp
示例20: Graphics
//.........这里部分代码省略.........
{
if(mx<0)
mx = 0;
if(mx>=w)
mx = w-1;
if(my<0)
my = 0;
if(my>=h)
my = h-1;
}
else
{
if(mx<0)
continue; // mx = 0;
if(mx>=w)
continue; // mx = w-1;
if(my<0)
continue; // my = 0;
if(my>=h)
continue; // my = h-1;
}
int c = mx + my*w;
unsigned char Index = pSwitchTile[c].m_Type;
if(Index)
{
unsigned char Flags = pSwitchTile[c].m_Flags;
bool Render = false;
if(Flags&TILEFLAG_OPAQUE)
{
if(RenderFlags&LAYERRENDERFLAG_OPAQUE)
Render = true;
}
else
{
if(RenderFlags&LAYERRENDERFLAG_TRANSPARENT)
Render = true;
}
if(Render)
{
int tx = Index%16;
int ty = Index/16;
int Px0 = tx*(1024/16);
int Py0 = ty*(1024/16);
int Px1 = Px0+(1024/16)-1;
int Py1 = Py0+(1024/16)-1;
float x0 = Nudge + Px0/TexSize+Frac;
float y0 = Nudge + Py0/TexSize+Frac;
float x1 = Nudge + Px1/TexSize-Frac;
float y1 = Nudge + Py0/TexSize+Frac;
float x2 = Nudge + Px1/TexSize-Frac;
float y2 = Nudge + Py1/TexSize-Frac;
float x3 = Nudge + Px0/TexSize+Frac;
float y3 = Nudge + Py1/TexSize-Frac;
if(Flags&TILEFLAG_VFLIP)
{
x0 = x2;
x1 = x3;
x2 = x3;
x3 = x0;
}
if(Flags&TILEFLAG_HFLIP)
{
y0 = y3;
y2 = y1;
y3 = y1;
y1 = y0;
}
if(Flags&TILEFLAG_ROTATE)
{
float Tmp = x0;
x0 = x3;
x3 = x2;
x2 = x1;
x1 = Tmp;
Tmp = y0;
y0 = y3;
y3 = y2;
y2 = y1;
y1 = Tmp;
}
Graphics()->QuadsSetSubsetFree(x0, y0, x1, y1, x2, y2, x3, y3);
IGraphics::CQuadItem QuadItem(x*Scale, y*Scale, Scale, Scale);
Graphics()->QuadsDrawTL(&QuadItem, 1);
}
}
}
Graphics()->QuadsEnd();
Graphics()->MapScreen(ScreenX0, ScreenY0, ScreenX1, ScreenY1);
}
开发者ID:Fear-cool,项目名称:DDRace,代码行数:101,代码来源:render_map.cpp
注:本文中的QuadItem函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论