MCPcopy Create free account
hub / github.com/ddnet/ddnet / SelectSprite

Method SelectSprite

src/engine/client/graphics_threaded_sprites.cpp:8–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include <generated/client_data7.h>
7
8void CGraphics_Threaded::SelectSprite(const CDataSprite *pSprite, int Flags)
9{
10 int x = pSprite->m_X;
11 int y = pSprite->m_Y;
12 int w = pSprite->m_W;
13 int h = pSprite->m_H;
14 int cx = pSprite->m_pSet->m_Gridx;
15 int cy = pSprite->m_pSet->m_Gridy;
16
17 GetSpriteScaleImpl(w, h, m_SpriteScale.x, m_SpriteScale.y);
18
19 float x1 = x / (float)cx + 0.5f / (float)(cx * 32);
20 float x2 = (x + w) / (float)cx - 0.5f / (float)(cx * 32);
21 float y1 = y / (float)cy + 0.5f / (float)(cy * 32);
22 float y2 = (y + h) / (float)cy - 0.5f / (float)(cy * 32);
23
24 if(Flags & SPRITE_FLAG_FLIP_Y)
25 std::swap(y1, y2);
26
27 if(Flags & SPRITE_FLAG_FLIP_X)
28 std::swap(x1, x2);
29
30 QuadsSetSubset(x1, y1, x2, y2);
31}
32
33void CGraphics_Threaded::SelectSprite(int Id, int Flags)
34{

Callers 6

RenderIconMethod · 0.80
DoButton_ToggleMethod · 0.80
DoLaserPreviewMethod · 0.80
RenderMethod · 0.80
RenderMethod · 0.80
RenderSpeedupOverlayMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected