Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void DrawCircle(int x0, int y0, int radius, Engine::Color color)
- {
- int x = radius;
- int y = 0;
- int xChange = 1 - (radius << 1);
- int yChange = 0;
- int radiusError = 0;
- while (x >= y)
- {
- for (int i = x0 - x; i <= x0 + x; i++)
- {
- Engine::m_pRenderer->DrawRect ( i, y0 + y, 1, 1, color );
- Engine::m_pRenderer->DrawRect ( i, y0 - y, 1, 1, color );
- }
- for (int i = x0 - y; i <= x0 + y; i++)
- {
- Engine::m_pRenderer->DrawRect ( i, y0 + x, 1, 1, color );
- Engine::m_pRenderer->DrawRect ( i, y0 - x, 1, 1, color );
- }
- y++;
- radiusError += yChange;
- yChange += 2;
- if (((radiusError << 1) + xChange) > 0)
- {
- x--;
- radiusError += xChange;
- xChange += 2;
- }
- }
- }
- void DrawRoundedRect ( int x, int y, int w, int h, int smooth, Engine::Color color )
- {
- Engine::m_pRenderer->DrawRect ( x + smooth, y, w - smooth * 2, h, color );
- Engine::m_pRenderer->DrawRect ( x, y + smooth, w, h - smooth * 2, color );
- DrawCircle ( x + smooth, y + smooth, smooth, color ); // left top
- DrawCircle ( x + w - smooth, y + smooth, smooth - 1, color ); // right top
- DrawCircle ( x + smooth, y + h - smooth, smooth - 1, color ); // left bottom
- DrawCircle ( x + w - smooth, y + h - smooth, smooth - 1, color ); // right bottom
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement