Mercurial > fife-parpg
comparison engine/core/video/sdl/sdlimage.cpp @ 631:f3457443c95f
* Added drawRectangle() and fillRectangle() functions to the renderers
* Modified FIFE::FloatingTextRenderer to use the new functions
* Updated some data types in FIFE::FloatingTextRenderer to use integer types defined in fife_stdint.h
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Tue, 05 Oct 2010 15:44:16 +0000 |
parents | 853d25234671 |
children | e3140f01749d |
comparison
equal
deleted
inserted
replaced
630:010da1d1ee1c | 631:f3457443c95f |
---|---|
757 drawLine(p1, p2, r, g, b, a); | 757 drawLine(p1, p2, r, g, b, a); |
758 drawLine(p2, p3, r, g, b, a); | 758 drawLine(p2, p3, r, g, b, a); |
759 drawLine(p3, p1, r, g, b, a); | 759 drawLine(p3, p1, r, g, b, a); |
760 } | 760 } |
761 | 761 |
762 void SDLImage::drawRectangle(const Point& p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a) { | |
763 Point p1, p2, p3, p4; | |
764 | |
765 p1.x = p.x; | |
766 p1.y = p.y; | |
767 p2.x = p.x+w; | |
768 p2.y = p.y; | |
769 p3.x = p.x+w; | |
770 p3.y = p.y+h; | |
771 p4.x = p.x; | |
772 p4.y = p.y+h; | |
773 | |
774 drawLine(p1, p2, r, g, b, a); | |
775 drawLine(p2, p3, r, g, b, a); | |
776 drawLine(p3, p4, r, g, b, a); | |
777 drawLine(p4, p1, r, g, b, a); | |
778 } | |
779 | |
780 void SDLImage::fillRectangle(const Point& p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a) { | |
781 SDL_Rect rect; | |
782 rect.x = p.x; | |
783 rect.y = p.y; | |
784 rect.w = w; | |
785 rect.h = h; | |
786 | |
787 Uint32 color = SDL_MapRGBA(m_surface->format, r, g, b, a); | |
788 SDL_FillRect(m_surface, &rect, color); | |
789 } | |
790 | |
762 void SDLImage::drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4, int r, int g, int b, int a) { | 791 void SDLImage::drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4, int r, int g, int b, int a) { |
763 drawLine(p1, p2, r, g, b, a); | 792 drawLine(p1, p2, r, g, b, a); |
764 drawLine(p2, p3, r, g, b, a); | 793 drawLine(p2, p3, r, g, b, a); |
765 drawLine(p3, p4, r, g, b, a); | 794 drawLine(p3, p4, r, g, b, a); |
766 drawLine(p4, p1, r, g, b, a); | 795 drawLine(p4, p1, r, g, b, a); |