2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#ifndef GAME_CLIENT_RENDER_H
|
|
|
|
#define GAME_CLIENT_RENDER_H
|
|
|
|
|
|
|
|
#include <base/vmath.h>
|
|
|
|
#include <game/mapitems.h>
|
|
|
|
#include "ui.h"
|
|
|
|
|
|
|
|
|
2010-07-05 18:57:07 +00:00
|
|
|
class CTeeRenderInfo
|
2010-05-29 07:25:38 +00:00
|
|
|
{
|
2010-07-05 18:57:07 +00:00
|
|
|
public:
|
2010-05-29 07:25:38 +00:00
|
|
|
CTeeRenderInfo()
|
|
|
|
{
|
|
|
|
m_Texture = -1;
|
|
|
|
m_ColorBody = vec4(1,1,1,1);
|
|
|
|
m_ColorFeet = vec4(1,1,1,1);
|
|
|
|
m_Size = 1.0f;
|
|
|
|
m_GotAirJump = 1;
|
|
|
|
};
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
int m_Texture;
|
|
|
|
vec4 m_ColorBody;
|
|
|
|
vec4 m_ColorFeet;
|
|
|
|
float m_Size;
|
|
|
|
int m_GotAirJump;
|
|
|
|
};
|
|
|
|
|
|
|
|
// sprite renderings
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
SPRITE_FLAG_FLIP_Y=1,
|
|
|
|
SPRITE_FLAG_FLIP_X=2,
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
LAYERRENDERFLAG_OPAQUE=1,
|
|
|
|
LAYERRENDERFLAG_TRANSPARENT=2,
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
TILERENDERFLAG_EXTEND=4,
|
|
|
|
};
|
|
|
|
|
2011-07-18 10:05:12 +00:00
|
|
|
typedef void (*ENVELOPE_EVAL)(float TimeOffset, int Env, float *pChannels, void *pUser);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
class CRenderTools
|
|
|
|
{
|
2018-03-13 20:53:54 +00:00
|
|
|
int m_TeeQuadContainerIndex;
|
2010-05-29 07:25:38 +00:00
|
|
|
public:
|
|
|
|
class IGraphics *m_pGraphics;
|
|
|
|
class CUI *m_pUI;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
class IGraphics *Graphics() const { return m_pGraphics; }
|
|
|
|
class CUI *UI() const { return m_pUI; }
|
|
|
|
|
2018-03-13 20:53:54 +00:00
|
|
|
void Init(class IGraphics *pGraphics, class CUI *pUI);
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
//typedef struct SPRITE;
|
|
|
|
|
2011-06-01 18:19:12 +00:00
|
|
|
void SelectSprite(struct CDataSprite *pSprite, int Flags=0, int sx=0, int sy=0);
|
2010-05-29 07:25:38 +00:00
|
|
|
void SelectSprite(int id, int Flags=0, int sx=0, int sy=0);
|
|
|
|
|
|
|
|
void DrawSprite(float x, float y, float size);
|
2018-03-13 20:53:54 +00:00
|
|
|
void QuadContainerAddSprite(int QuadContainerIndex, float x, float y, float size, bool DoSpriteScale = true);
|
|
|
|
void QuadContainerAddSprite(int QuadContainerIndex, float size, bool DoSpriteScale = true);
|
|
|
|
void QuadContainerAddSprite(int QuadContainerIndex, float X, float Y, float Width, float Height);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
// rects
|
|
|
|
void DrawRoundRect(float x, float y, float w, float h, float r);
|
|
|
|
void DrawRoundRectExt(float x, float y, float w, float h, float r, int Corners);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2018-03-13 20:53:54 +00:00
|
|
|
int CreateRoundRectQuadContainer(float x, float y, float w, float h, float r, int Corners);
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void DrawUIRect(const CUIRect *pRect, vec4 Color, int Corners, float Rounding);
|
|
|
|
|
2014-10-11 18:05:48 +00:00
|
|
|
void DrawCircle(float x, float y, float r, int Segments);
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// larger rendering methods
|
2013-12-20 11:27:10 +00:00
|
|
|
void RenderTilemapGenerateSkip(class CLayers *pLayers);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
// object render methods (gc_render_obj.cpp)
|
2011-04-09 06:41:31 +00:00
|
|
|
void RenderTee(class CAnimState *pAnim, CTeeRenderInfo *pInfo, int Emote, vec2 Dir, vec2 Pos, bool Alpha = false);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
// map render methods (gc_render_map.cpp)
|
|
|
|
static void RenderEvalEnvelope(CEnvPoint *pPoints, int NumPoints, int Channels, float Time, float *pResult);
|
2011-07-18 10:05:12 +00:00
|
|
|
void RenderQuads(CQuad *pQuads, int NumQuads, int Flags, ENVELOPE_EVAL pfnEval, void *pUser);
|
2014-05-08 13:58:59 +00:00
|
|
|
void ForceRenderQuads(CQuad *pQuads, int NumQuads, int Flags, ENVELOPE_EVAL pfnEval, void *pUser, float Alpha = 1.0f);
|
2011-07-18 10:05:12 +00:00
|
|
|
void RenderTilemap(CTile *pTiles, int w, int h, float Scale, vec4 Color, int RenderFlags, ENVELOPE_EVAL pfnEval, void *pUser, int ColorEnv, int ColorEnvOffset);
|
2017-03-16 15:37:40 +00:00
|
|
|
|
|
|
|
// render a rectangle made of IndexIn tiles, over a background made of IndexOut tiles
|
|
|
|
// the rectangle include all tiles in [RectX, RectX+RectW-1] x [RectY, RectY+RectH-1]
|
|
|
|
void RenderTileRectangle(int RectX, int RectY, int RectW, int RectH, unsigned char IndexIn, unsigned char IndexOut, float Scale, vec4 Color, int RenderFlags, ENVELOPE_EVAL pfnEval, void *pUser, int ColorEnv, int ColorEnvOffset);
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// helpers
|
|
|
|
void MapscreenToWorld(float CenterX, float CenterY, float ParallaxX, float ParallaxY,
|
2011-04-13 18:37:12 +00:00
|
|
|
float OffsetX, float OffsetY, float Aspect, float Zoom, float *pPoints);
|
2011-04-09 06:41:31 +00:00
|
|
|
|
|
|
|
// DDRace
|
|
|
|
|
2014-05-01 18:15:53 +00:00
|
|
|
void RenderTeleOverlay(CTeleTile *pTele, int w, int h, float Scale, float Alpha=1.0f);
|
|
|
|
void RenderSpeedupOverlay(CSpeedupTile *pTele, int w, int h, float Scale, float Alpha=1.0f);
|
|
|
|
void RenderSwitchOverlay(CSwitchTile *pSwitch, int w, int h, float Scale, float Alpha=1.0f);
|
|
|
|
void RenderTuneOverlay(CTuneTile *pTune, int w, int h, float Scale, float Alpha=1.0f);
|
2011-04-19 14:32:42 +00:00
|
|
|
void RenderTelemap(CTeleTile *pTele, int w, int h, float Scale, vec4 Color, int RenderFlags);
|
|
|
|
void RenderSpeedupmap(CSpeedupTile *pTele, int w, int h, float Scale, vec4 Color, int RenderFlags);
|
|
|
|
void RenderSwitchmap(CSwitchTile *pSwitch, int w, int h, float Scale, vec4 Color, int RenderFlags);
|
2014-03-12 22:42:51 +00:00
|
|
|
void RenderTunemap(CTuneTile *pTune, int w, int h, float Scale, vec4 Color, int RenderFlags);
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|