mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-10-31 19:36:16 +00:00
in SDL2, SDL_gfx functions seem to use a different order of components
This commit is contained in:
parent
b87a995871
commit
d8fd187986
@ -1039,11 +1039,11 @@ EX void drawCircle(int x, int y, int size, color_t color, color_t fillcolor IS(0
|
|||||||
#elif CAP_SDLGFX
|
#elif CAP_SDLGFX
|
||||||
if(pconf.stretch == 1) {
|
if(pconf.stretch == 1) {
|
||||||
if(fillcolor) filledCircleColor(srend, x, y, size, fillcolor);
|
if(fillcolor) filledCircleColor(srend, x, y, size, fillcolor);
|
||||||
if(color) ((vid.antialias && AA_NOGL)?aacircleColor:circleColor) (srend, x, y, size, color);
|
if(color) ((vid.antialias && AA_NOGL)?aacircleColor:circleColor) (srend, x, y, size, align(color));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(fillcolor) filledEllipseColor(srend, x, y, size, size * pconf.stretch, fillcolor);
|
if(fillcolor) filledEllipseColor(srend, x, y, size, size * pconf.stretch, fillcolor);
|
||||||
if(color) ((vid.antialias && AA_NOGL)?aaellipseColor:ellipseColor) (srend, x, y, size, size * pconf.stretch, color);
|
if(color) ((vid.antialias && AA_NOGL)?aaellipseColor:ellipseColor) (srend, x, y, size, size * pconf.stretch, align(color));
|
||||||
}
|
}
|
||||||
#elif CAP_SDL
|
#elif CAP_SDL
|
||||||
int pts = size * 4;
|
int pts = size * 4;
|
||||||
|
15
drawing.cpp
15
drawing.cpp
@ -558,21 +558,30 @@ void addpoly(const shiftmatrix& V, const vector<glvertex> &tab, int ofs, int cnt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX color_t align(color_t col) {
|
||||||
|
#if CAP_SDL2
|
||||||
|
swap(part(col, 0), part(col, 3));
|
||||||
|
swap(part(col, 1), part(col, 2));
|
||||||
|
#endif
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if CAP_SDLGFX
|
#if CAP_SDLGFX
|
||||||
void aapolylineColor(SDL_Renderer *s, int*x, int *y, int polyi, color_t col) {
|
void aapolylineColor(SDL_Renderer *s, int*x, int *y, int polyi, color_t col) {
|
||||||
for(int i=1; i<polyi; i++)
|
for(int i=1; i<polyi; i++)
|
||||||
aalineColor(s, x[i-1], y[i-1], x[i], y[i], col);
|
aalineColor(s, x[i-1], y[i-1], x[i], y[i], align(col));
|
||||||
}
|
}
|
||||||
|
|
||||||
void polylineColor(SDL_Renderer *s, int *x, int *y, int polyi, color_t col) {
|
void polylineColor(SDL_Renderer *s, int *x, int *y, int polyi, color_t col) {
|
||||||
for(int i=1; i<polyi; i++)
|
for(int i=1; i<polyi; i++)
|
||||||
lineColor(s, x[i-1], y[i-1], x[i], y[i], col);
|
lineColor(s, x[i-1], y[i-1], x[i], y[i], align(col));
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void filledPolygonColorI(SDL_Renderer *s, int* px, int *py, int polyi, color_t col) {
|
EX void filledPolygonColorI(SDL_Renderer *s, int* px, int *py, int polyi, color_t col) {
|
||||||
std::vector<Sint16> spx(px, px + polyi);
|
std::vector<Sint16> spx(px, px + polyi);
|
||||||
std::vector<Sint16> spy(py, py + polyi);
|
std::vector<Sint16> spy(py, py + polyi);
|
||||||
filledPolygonColor(s, spx.data(), spy.data(), polyi, col);
|
filledPolygonColor(s, spx.data(), spy.data(), polyi, align(col));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ EX namespace netgen {
|
|||||||
|
|
||||||
void blackline(vec v1, vec v2, color_t col = 0x000000FF) {
|
void blackline(vec v1, vec v2, color_t col = 0x000000FF) {
|
||||||
#if CAP_SDLGFX
|
#if CAP_SDLGFX
|
||||||
aalineColor(srend, int(v1.x), int(v1.y), int(v2.x), int(v2.y), col);
|
aalineColor(srend, int(v1.x), int(v1.y), int(v2.x), int(v2.y), align(col));
|
||||||
#elif CAP_SDL
|
#elif CAP_SDL
|
||||||
SDL_LockSurface(s);
|
SDL_LockSurface(s);
|
||||||
int len = abs(v1.x-v2.x) + abs(v1.y-v2.y);
|
int len = abs(v1.x-v2.x) + abs(v1.y-v2.y);
|
||||||
|
Loading…
Reference in New Issue
Block a user