- bugfix for mouse pointer rendering
This commit is contained in:
parent
c9be7a8677
commit
7d6e21b1e7
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "metrics.h"
|
#include "metrics.h"
|
||||||
|
|
||||||
#include "element_type.h"
|
//#include "element_type.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
|
|
@ -211,21 +211,25 @@ void BaseRenderer::renderMapPreview( const MapPreview *map, int x, int y,
|
||||||
|
|
||||||
assertGl();
|
assertGl();
|
||||||
|
|
||||||
|
glFrontFace(GL_CW);
|
||||||
|
glEnable(GL_CULL_FACE);
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
glOrtho(0, clientW, 0, clientH, 1, -1);
|
|
||||||
|
|
||||||
glViewport(screenX, screenY, renderMapWidth,renderMapHeight);
|
glViewport(screenX, screenY, renderMapWidth,renderMapHeight);
|
||||||
|
//glViewport(1, 1, renderMapWidth*4,renderMapHeight*4);
|
||||||
|
glOrtho(0, clientW, 0, clientH, -1, 1);
|
||||||
|
//glOrtho(-clientW, clientW, -clientH, clientH, -1000, 1000);
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
//glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
glPushAttrib(GL_CURRENT_BIT);
|
glPushAttrib(GL_CURRENT_BIT);
|
||||||
|
|
||||||
glTranslatef(static_cast<float>(x), static_cast<float>(y), 0.0f);
|
//glTranslatef(static_cast<float>(x), static_cast<float>(y), 0.0f);
|
||||||
glLineWidth(1);
|
glLineWidth(1);
|
||||||
//glClear(GL_COLOR_BUFFER_BIT);
|
//glClear(GL_COLOR_BUFFER_BIT);
|
||||||
glColor3f(0, 0, 0);
|
glColor3f(0, 0, 0);
|
||||||
|
@ -255,6 +259,7 @@ void BaseRenderer::renderMapPreview( const MapPreview *map, int x, int y,
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
//objects
|
//objects
|
||||||
|
if(renderAll == true) {
|
||||||
switch (map->getObject(i, j)) {
|
switch (map->getObject(i, j)) {
|
||||||
case 0: glColor3f(0.f, 0.f, 0.f); break;
|
case 0: glColor3f(0.f, 0.f, 0.f); break;
|
||||||
case 1: glColor3f(1.f, 0.f, 0.f); break;
|
case 1: glColor3f(1.f, 0.f, 0.f); break;
|
||||||
|
@ -275,14 +280,16 @@ void BaseRenderer::renderMapPreview( const MapPreview *map, int x, int y,
|
||||||
glVertex2i(i * cellSize + cellSize / 2, clientH - j * cellSize - cellSize / 2);
|
glVertex2i(i * cellSize + cellSize / 2, clientH - j * cellSize - cellSize / 2);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bool found = false;
|
// bool found = false;
|
||||||
|
|
||||||
//height lines
|
//height lines
|
||||||
// if (!found) {
|
// if (!found) {
|
||||||
glColor3fv((surfColor*0.5f).ptr());
|
|
||||||
//left
|
//left
|
||||||
if (i > 0 && map->getHeight(i - 1, j) > map->getHeight(i, j)) {
|
if (i > 0 && map->getHeight(i - 1, j) > map->getHeight(i, j)) {
|
||||||
|
glColor3fv((surfColor*0.5f).ptr());
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glVertex2f(i * cellSize, clientH - (j + 1) * cellSize);
|
glVertex2f(i * cellSize, clientH - (j + 1) * cellSize);
|
||||||
glVertex2f(i * cellSize, clientH - j * cellSize);
|
glVertex2f(i * cellSize, clientH - j * cellSize);
|
||||||
|
@ -290,21 +297,24 @@ void BaseRenderer::renderMapPreview( const MapPreview *map, int x, int y,
|
||||||
}
|
}
|
||||||
//down
|
//down
|
||||||
if (j > 0 && map->getHeight(i, j - 1) > map->getHeight(i, j)) {
|
if (j > 0 && map->getHeight(i, j - 1) > map->getHeight(i, j)) {
|
||||||
|
glColor3fv((surfColor*0.5f).ptr());
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glVertex2f(i * cellSize, clientH - j * cellSize);
|
glVertex2f(i * cellSize, clientH - j * cellSize);
|
||||||
glVertex2f((i + 1) * cellSize, clientH - j * cellSize);
|
glVertex2f((i + 1) * cellSize, clientH - j * cellSize);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
glColor3fv((surfColor*2.f).ptr());
|
|
||||||
//left
|
//left
|
||||||
if (i > 0 && map->getHeight(i - 1, j) < map->getHeight(i, j)) {
|
if (i > 0 && map->getHeight(i - 1, j) < map->getHeight(i, j)) {
|
||||||
|
glColor3fv((surfColor*2.f).ptr());
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glVertex2f(i * cellSize, clientH - (j + 1) * cellSize);
|
glVertex2f(i * cellSize, clientH - (j + 1) * cellSize);
|
||||||
glVertex2f(i * cellSize, clientH - j * cellSize);
|
glVertex2f(i * cellSize, clientH - j * cellSize);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
if (j > 0 && map->getHeight(i, j - 1) < map->getHeight(i, j)) {
|
if (j > 0 && map->getHeight(i, j - 1) < map->getHeight(i, j)) {
|
||||||
|
glColor3fv((surfColor*2.f).ptr());
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glVertex2f(i * cellSize, clientH - j * cellSize);
|
glVertex2f(i * cellSize, clientH - j * cellSize);
|
||||||
glVertex2f((i + 1) * cellSize, clientH - j * cellSize);
|
glVertex2f((i + 1) * cellSize, clientH - j * cellSize);
|
||||||
|
@ -313,6 +323,7 @@ void BaseRenderer::renderMapPreview( const MapPreview *map, int x, int y,
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//resources
|
//resources
|
||||||
|
if(renderAll == true) {
|
||||||
switch (map->getResource(i, j)) {
|
switch (map->getResource(i, j)) {
|
||||||
case 1: glColor3f(1.f, 1.f, 0.f); break;
|
case 1: glColor3f(1.f, 1.f, 0.f); break;
|
||||||
case 2: glColor3f(0.5f, 0.5f, 0.5f); break;
|
case 2: glColor3f(0.5f, 0.5f, 0.5f); break;
|
||||||
|
@ -330,6 +341,7 @@ void BaseRenderer::renderMapPreview( const MapPreview *map, int x, int y,
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,6 +377,8 @@ void BaseRenderer::renderMapPreview( const MapPreview *map, int x, int y,
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
|
|
||||||
|
glViewport(0, 0, 0, 0);
|
||||||
|
|
||||||
assertGl();
|
assertGl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user