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

Method MapScreenToWorld

src/engine/graphics.cpp:31–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void IGraphics::MapScreenToWorld(float CenterX, float CenterY, float ParallaxX, float ParallaxY,
32 float ParallaxZoom, float OffsetX, float OffsetY, float Aspect, float Zoom, float *pPoints) const
33{
34 float Width, Height;
35 CalcScreenParams(Aspect, Zoom, &Width, &Height);
36
37 float Scale = (ParallaxZoom * (Zoom - 1.0f) + 100.0f) / 100.0f / Zoom;
38 Width *= Scale;
39 Height *= Scale;
40
41 CenterX *= ParallaxX / 100.0f;
42 CenterY *= ParallaxY / 100.0f;
43 pPoints[0] = OffsetX + CenterX - Width / 2;
44 pPoints[1] = OffsetY + CenterY - Height / 2;
45 pPoints[2] = pPoints[0] + Width;
46 pPoints[3] = pPoints[1] + Height;
47}
48
49void IGraphics::MapScreenToInterface(float CenterX, float CenterY, float Zoom)
50{

Callers 5

RenderCursorMethod · 0.80
RenderScreenSizesMethod · 0.80
ZoomMouseTargetMethod · 0.80
MappingMethod · 0.80
RenderMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected