Skip to content

olc::PixelGameEngine

Javidx9 edited this page Feb 11, 2019 · 9 revisions

Setting Up

olc::rcode Construct(uint32_t screen_w, uint32_t screen_h, uint32_t pixel_w, uint32_t pixel_h)

olc::rcode Start()

Adding Functionality

virtual bool OnUserCreate()

virtual bool OnUserUpdate(float fElapsedTime)

virtual bool OnUserDestroy()

User Input

olc::HWButton GetMouse(uint32_t b)

int32_t GetMouseX()

int32_t GetMouseY()

Environment

int32_t ScreenWidth()

int32_t ScreenHeight()

int32_t GetDrawTargetWidth()

int32_t GetDrawTargetHeight()

olc::Sprite* GetDrawTarget()

void SetDrawTarget(olc::Sprite *target)

void SetSubPixelOffset(float ox, float oy)

Blending Routines

void SetPixelBlend(float fBlend)

void SetPixelMode(olc::Pixel::Mode m)

void SetPixelMode(std::function<olc::Pixel(const int x, const int y, const olc::Pixel& pSource, const olc::Pixel& pDest)> pixelMode)

olc::Pixel::Mode GetPixelMode()

Drawing Routines

void Clear(olc::Pixel p)

virtual bool Draw(int32_t x, int32_t y, olc::Pixel p = olc::WHITE)

void DrawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2, olc::Pixel p = olc::WHITE)

void DrawCircle(int32_t x, int32_t y, int32_t radius, olc::Pixel p = olc::WHITE)

void FillCircle(int32_t x, int32_t y, int32_t radius, olc::Pixel p = olc::WHITE)

void DrawRect(int32_t x, int32_t y, int32_t w, int32_t h, olc::Pixel p = olc::WHITE)

void FillRect(int32_t x, int32_t y, int32_t w, int32_t h, olc::Pixel p = olc::WHITE)

void DrawTriangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3, int32_t y3, olc::Pixel p = olc::WHITE)

void FillTriangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3, int32_t y3, olc::Pixel p = olc::WHITE)

void DrawSprite(int32_t x, int32_t y, olc::Sprite *sprite, uint32_t scale = 1)

void DrawPartialSprite(int32_t x, int32_t y, olc::Sprite *sprite, int32_t ox, int32_t oy, int32_t w, int32_t h, uint32_t scale = 1)

void DrawString(int32_t x, int32_t y, std::string sText, olc::Pixel col = olc::WHITE, uint32_t scale = 1)

Clone this wiki locally