84#ifndef OLC_PGEX_TRANSFORMEDVIEW_H
85#define OLC_PGEX_TRANSFORMEDVIEW_H
122 virtual void HandlePanAndZoom(
const int nMouseButton = 2,
const float fZoomRate = 0.1f,
const bool bPan =
true,
const bool bZoom =
true);
204 void DrawPolygonDecal(
olc::Decal* decal,
const std::vector<olc::vf2d>&pos,
const std::vector<olc::vf2d>&uv,
const std::vector<olc::Pixel> &tint);
208#if defined(OLC_PGEX_SHADER)
235#ifdef OLC_PGEX_TRANSFORMEDVIEW
236#undef OLC_PGEX_TRANSFORMEDVIEW
405 return Draw({ x, y }, p);
415 DrawLine({ x1, y1 }, { x2, y2 }, p, pattern);
485 DrawSprite({ x, y }, sprite, { scalex, scaley }, flip);
498 olc::vi2d vScreenPixelStart = (vSpritePixelStart).max({0,0});
501 olc::vf2d vPixelStep = 1.0f / vSpriteScaledSize;
503 for (vPixel.
y = vScreenPixelStart.
y; vPixel.
y < vScreenPixelEnd.
y; vPixel.
y++)
505 for (vPixel.
x = vScreenPixelStart.
x; vPixel.
x < vScreenPixelEnd.
x; vPixel.
x++)
517 DrawPartialSprite({ x,y }, sprite, { ox,oy }, { w, h }, { scalex, scaley }, flip);
526 olc::vf2d vSpritePixelStep = 1.0f /
olc::vf2d(
float(sprite->width),
float(sprite->height));
528 olc::vf2d vScreenPixelStep = 1.0f / vSpriteScaledSize;
530 for (vPixel.
y = vStart.
y; vPixel.
y < vEnd.y; vPixel.
y++)
532 for (vPixel.
x = vStart.
x; vPixel.
x < vEnd.x; vPixel.
x++)
534 olc::vf2d vSample = ((
olc::vf2d(vPixel - vStart) * vScreenPixelStep) * size * vSpritePixelStep) +
olc::vf2d(sourcepos) * vSpritePixelStep;
535 pge->
Draw(vPixel, sprite->Sample(vSample.
x, vSample.
y));
551 auto StringPlot = [&col](
const int x,
const int y,
const olc::Pixel& pSource,
const olc::Pixel& pDest)
553 return pSource.r > 1 ? col : pDest;
566 int32_t ox = ((c - 32) % 16) * 8;
567 int32_t oy = ((c - 32) / 16) * 8;
593 std::vector<olc::vf2d> vTransformed(elements);
594 for (uint32_t n = 0; n < elements; n++)
601 std::array<olc::vf2d, 4> vTransformed =
627 std::array<olc::vf2d, 4> vTransformed =
683 std::vector<olc::vf2d> vTransformed(pos.size());
684 for (uint32_t n = 0; n < pos.size(); n++)
691 std::vector<olc::vf2d> vTransformed(pos.size());
692 for (uint32_t n = 0; n < pos.size(); n++)
699 std::vector<olc::vf2d> vTransformed(pos.size());
700 for (uint32_t n = 0; n < pos.size(); n++)
707#if defined (OLC_PGEX_SHADER)
Definition olcPixelGameEngine.h:1089
Definition olcPixelGameEngine.h:1615
static PixelGameEngine * pge
Definition olcPixelGameEngine.h:1627
Definition olcPixelGameEngine.h:1225
void FillRectDecal(const olc::vf2d &pos, const olc::vf2d &size, const olc::Pixel col=olc::WHITE)
void GradientFillRectDecal(const olc::vf2d &pos, const olc::vf2d &size, const olc::Pixel colTL, const olc::Pixel colBL, const olc::Pixel colBR, const olc::Pixel colTR)
void DrawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2, Pixel p=olc::WHITE, uint32_t pattern=0xFFFFFFFF)
void DrawRect(int32_t x, int32_t y, int32_t w, int32_t h, Pixel p=olc::WHITE)
void DrawExplicitDecal(olc::Decal *decal, const olc::vf2d *pos, const olc::vf2d *uv, const olc::Pixel *col, uint32_t elements=4)
void DrawTriangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3, int32_t y3, Pixel p=olc::WHITE)
void DrawCircle(int32_t x, int32_t y, int32_t radius, Pixel p=olc::WHITE, uint8_t mask=0xFF)
void DrawPolygonDecal(olc::Decal *decal, const std::vector< olc::vf2d > &pos, const std::vector< olc::vf2d > &uv, const olc::Pixel tint=olc::WHITE)
void DrawRectDecal(const olc::vf2d &pos, const olc::vf2d &size, const olc::Pixel col=olc::WHITE)
void FillCircle(int32_t x, int32_t y, int32_t radius, Pixel p=olc::WHITE)
void DrawDecal(const olc::vf2d &pos, olc::Decal *decal, const olc::vf2d &scale={ 1.0f, 1.0f }, const olc::Pixel &tint=olc::WHITE)
void DrawWarpedDecal(olc::Decal *decal, const olc::vf2d(&pos)[4], const olc::Pixel &tint=olc::WHITE)
void DrawStringDecal(const olc::vf2d &pos, const std::string &sText, const Pixel col=olc::WHITE, const olc::vf2d &scale={ 1.0f, 1.0f })
void FillRect(int32_t x, int32_t y, int32_t w, int32_t h, Pixel p=olc::WHITE)
void DrawStringPropDecal(const olc::vf2d &pos, const std::string &sText, const Pixel col=olc::WHITE, const olc::vf2d &scale={ 1.0f, 1.0f })
void DrawPartialWarpedDecal(olc::Decal *decal, const olc::vf2d(&pos)[4], const olc::vf2d &source_pos, const olc::vf2d &source_size, const olc::Pixel &tint=olc::WHITE)
const olc::vi2d & GetMousePos() const
void DrawPartialDecal(const olc::vf2d &pos, olc::Decal *decal, const olc::vf2d &source_pos, const olc::vf2d &source_size, const olc::vf2d &scale={ 1.0f, 1.0f }, const olc::Pixel &tint=olc::WHITE)
virtual bool Draw(int32_t x, int32_t y, Pixel p=olc::WHITE)
int32_t GetMouseWheel() const
void DrawLineDecal(const olc::vf2d &pos1, const olc::vf2d &pos2, Pixel p=olc::WHITE)
int32_t ScreenWidth() const
void DrawPartialRotatedDecal(const olc::vf2d &pos, olc::Decal *decal, const float fAngle, const olc::vf2d ¢er, const olc::vf2d &source_pos, const olc::vf2d &source_size, const olc::vf2d &scale={ 1.0f, 1.0f }, const olc::Pixel &tint=olc::WHITE)
void DrawRotatedDecal(const olc::vf2d &pos, olc::Decal *decal, const float fAngle, const olc::vf2d ¢er={ 0.0f, 0.0f }, const olc::vf2d &scale={ 1.0f, 1.0f }, const olc::Pixel &tint=olc::WHITE)
int32_t ScreenHeight() const
HWButton GetMouse(uint32_t b) const
void FillTriangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3, int32_t y3, Pixel p=olc::WHITE)
Pixel::Mode GetPixelMode()
olc::Sprite * GetFontSprite()
void SetPixelMode(Pixel::Mode m)
Definition olcPixelGameEngine.h:1047
Pixel Sample(float x, float y) const
int32_t height
Definition olcPixelGameEngine.h:1060
@ NONE
Definition olcPixelGameEngine.h:1062
int32_t width
Definition olcPixelGameEngine.h:1059
Definition olcPixelGameEngine.h:593
v_2d< float > vf2d
Definition olcPixelGameEngine.h:894
static const Pixel WHITE(255, 255, 255)
Definition olcPixelGameEngine.h:924
Mode
Definition olcPixelGameEngine.h:931
constexpr v_2d clamp(const v_2d &v1, const v_2d &v2) const
Definition olcPixelGameEngine.h:702
T x
Definition olcPixelGameEngine.h:604
T y
Definition olcPixelGameEngine.h:606
constexpr v_2d ceil() const
Definition olcPixelGameEngine.h:660
constexpr v_2d floor() const
Definition olcPixelGameEngine.h:654