mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-26 09:24:28 +02:00
Fix Line scaling for OpenGL inetrgsdfkjdslkfjs
This commit is contained in:
@@ -301,16 +301,21 @@ void Graphics::draw_line(int x, int y, int x2, int y2, int r, int g, int b, int
|
|||||||
|
|
||||||
void Graphics::drawrect(int x, int y, int width, int height, int r, int g, int b, int a)
|
void Graphics::drawrect(int x, int y, int width, int height, int r, int g, int b, int a)
|
||||||
{
|
{
|
||||||
x++;
|
float fx = float(x)+0.5f;
|
||||||
height--;
|
float fy = float(y)+0.5f;
|
||||||
width--;
|
float fwidth = width-1.0f;
|
||||||
|
float fheight = height-1.0f;
|
||||||
|
//x++;
|
||||||
|
//y++;
|
||||||
|
//height-=2;
|
||||||
|
//width-=2;
|
||||||
glColor4ub(r, g, b, a);
|
glColor4ub(r, g, b, a);
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
glVertex2f(x, y);
|
glVertex2f(fx, fy);
|
||||||
glVertex2f(x+width, y);
|
glVertex2f(fx+fwidth, fy);
|
||||||
glVertex2f(x+width, y+height);
|
glVertex2f(fx+fwidth, fy+fheight);
|
||||||
glVertex2f(x, y+height+1); //+1 is a hack to prevent squares from missing their corners, will make smoothed lines look like SHIT
|
glVertex2f(fx, fy+fheight); //+1 is a hack to prevent squares from missing their corners, will make smoothed lines look like SHIT
|
||||||
glVertex2f(x, y);
|
glVertex2f(fx, fy);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -206,6 +206,8 @@ int main(int argc, char * argv[])
|
|||||||
currentWidth = width;
|
currentWidth = width;
|
||||||
currentHeight = height;
|
currentHeight = height;
|
||||||
inputScale = float(XRES+BARSIZE)/currentWidth;
|
inputScale = float(XRES+BARSIZE)/currentWidth;
|
||||||
|
|
||||||
|
glLineWidth(currentWidth/float(XRES+BARSIZE));
|
||||||
if(sdl_scrn == NULL)
|
if(sdl_scrn == NULL)
|
||||||
{
|
{
|
||||||
std::cerr << "Oh bugger" << std::endl;
|
std::cerr << "Oh bugger" << std::endl;
|
||||||
|
Reference in New Issue
Block a user