Move graphics into seperate folder
This commit is contained in:
parent
94c9603d0c
commit
adc9cc0816
5
.gitignore
vendored
5
.gitignore
vendored
@ -26,4 +26,7 @@ Makefile.me
|
|||||||
*.manifest
|
*.manifest
|
||||||
*.manifest.res
|
*.manifest.res
|
||||||
*.pdb
|
*.pdb
|
||||||
*.sublime-*
|
*.sublime-*
|
||||||
|
*.project
|
||||||
|
*.cproject
|
||||||
|
*.settings
|
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#if defined(LIN32) || defined(LIN64)
|
#if defined(LIN32) || defined(LIN64)
|
||||||
#include "icon.h"
|
#include "icon.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Client.h"
|
#include "Client.h"
|
||||||
#include "MD5.h"
|
#include "MD5.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#include "Misc.h"
|
#include "Misc.h"
|
||||||
|
|
||||||
#include "interface/Point.h"
|
#include "interface/Point.h"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "GameView.h"
|
#include "GameView.h"
|
||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
#include "simulation/Air.h"
|
#include "simulation/Air.h"
|
||||||
#include "Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
#include "interface/Point.h"
|
#include "interface/Point.h"
|
||||||
#include "Brush.h"
|
#include "Brush.h"
|
||||||
#include "EllipseBrush.h"
|
#include "EllipseBrush.h"
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "client/SaveInfo.h"
|
#include "client/SaveInfo.h"
|
||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
#include "interface/Colour.h"
|
#include "interface/Colour.h"
|
||||||
#include "Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
#include "GameView.h"
|
#include "GameView.h"
|
||||||
#include "Brush.h"
|
#include "Brush.h"
|
||||||
#include "client/User.h"
|
#include "client/User.h"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "GameView.h"
|
#include "GameView.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#include "interface/Window.h"
|
#include "interface/Window.h"
|
||||||
#include "interface/Button.h"
|
#include "interface/Button.h"
|
||||||
#include "interface/Colour.h"
|
#include "interface/Colour.h"
|
||||||
|
@ -1,71 +1,3 @@
|
|||||||
#include "Graphics.h"
|
|
||||||
#include "font.h"
|
|
||||||
|
|
||||||
#ifdef OGLI
|
|
||||||
|
|
||||||
Graphics::Graphics():
|
|
||||||
sdl_scale(1)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
//Texture for main UI
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
|
||||||
|
|
||||||
glGenTextures(1, &vidBuf);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, vidBuf);
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, XRES+BARSIZE, YRES+MENUSIZE, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
|
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
|
|
||||||
glGenTextures(1, &textTexture);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, textTexture);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
}
|
|
||||||
|
|
||||||
Graphics::~Graphics()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Graphics::Reset()
|
|
||||||
{
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glLoadIdentity();
|
|
||||||
|
|
||||||
//glOrtho(0, (XRES+BARSIZE)*sdl_scale, 0, (YRES+MENUSIZE)*sdl_scale, -1, 1);
|
|
||||||
glOrtho(0, (XRES+BARSIZE)*sdl_scale, (YRES+MENUSIZE)*sdl_scale, 0, -1, 1);
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glLoadIdentity();
|
|
||||||
|
|
||||||
//glRasterPos2i(0, (YRES+MENUSIZE));
|
|
||||||
glRasterPos2i(0, 0);
|
|
||||||
glPixelZoom(1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Graphics::Clear()
|
|
||||||
{
|
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Graphics::Finalise()
|
|
||||||
{
|
|
||||||
glFlush();
|
|
||||||
}
|
|
||||||
|
|
||||||
int Graphics::drawtext(int x, int y, const char *s, int r, int g, int b, int a)
|
int Graphics::drawtext(int x, int y, const char *s, int r, int g, int b, int a)
|
||||||
{
|
{
|
||||||
if(!strlen(s))
|
if(!strlen(s))
|
||||||
@ -103,7 +35,7 @@ int Graphics::drawtext(int x, int y, const char *s, int r, int g, int b, int a)
|
|||||||
switch (s[1])
|
switch (s[1])
|
||||||
{
|
{
|
||||||
case 'w':
|
case 'w':
|
||||||
r = g = b = 255;
|
r = g = b = 255;
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
r = g = b = 192;
|
r = g = b = 192;
|
||||||
@ -396,6 +328,4 @@ void Graphics::draw_image(pixel *img, int x, int y, int w, int h, int a)
|
|||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
78
src/graphics/OpenGLGraphics.cpp
Normal file
78
src/graphics/OpenGLGraphics.cpp
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
#include "Graphics.h"
|
||||||
|
#include "font.h"
|
||||||
|
|
||||||
|
#ifdef OGLI
|
||||||
|
|
||||||
|
Graphics::Graphics():
|
||||||
|
sdl_scale(1)
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
//Texture for main UI
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
glGenTextures(1, &vidBuf);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, vidBuf);
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, XRES+BARSIZE, YRES+MENUSIZE, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
|
||||||
|
|
||||||
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
|
glGenTextures(1, &textTexture);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, textTexture);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
|
||||||
|
Graphics::~Graphics()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Graphics::Reset()
|
||||||
|
{
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
//glOrtho(0, (XRES+BARSIZE)*sdl_scale, 0, (YRES+MENUSIZE)*sdl_scale, -1, 1);
|
||||||
|
glOrtho(0, (XRES+BARSIZE)*sdl_scale, (YRES+MENUSIZE)*sdl_scale, 0, -1, 1);
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
//glRasterPos2i(0, (YRES+MENUSIZE));
|
||||||
|
glRasterPos2i(0, 0);
|
||||||
|
glPixelZoom(1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Graphics::Clear()
|
||||||
|
{
|
||||||
|
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Graphics::Finalise()
|
||||||
|
{
|
||||||
|
glFlush();
|
||||||
|
}
|
||||||
|
|
||||||
|
#define VIDXRES XRES+BARSIZE
|
||||||
|
#define VIDYRES YRES+MENUSIZE
|
||||||
|
#define PIXELMETHODS_CLASS Graphics
|
||||||
|
#include "OpenGLDrawMethods.inc"
|
||||||
|
#undef VIDYRES
|
||||||
|
#undef VIDXRES
|
||||||
|
#undef PIXELMETHODS_CLASS
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -27,7 +27,7 @@ void Graphics::Finalise()
|
|||||||
#define VIDXRES XRES+BARSIZE
|
#define VIDXRES XRES+BARSIZE
|
||||||
#define VIDYRES YRES+MENUSIZE
|
#define VIDYRES YRES+MENUSIZE
|
||||||
#define PIXELMETHODS_CLASS Graphics
|
#define PIXELMETHODS_CLASS Graphics
|
||||||
#include "PixelMethods.inc"
|
#include "RasterDrawMethods.inc"
|
||||||
#undef VIDYRES
|
#undef VIDYRES
|
||||||
#undef VIDXRES
|
#undef VIDXRES
|
||||||
#undef PIXELMETHODS_CLASS
|
#undef PIXELMETHODS_CLASS
|
@ -2197,6 +2197,12 @@ Renderer::~Renderer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define PIXELMETHODS_CLASS Renderer
|
#define PIXELMETHODS_CLASS Renderer
|
||||||
#include "PixelMethods.inc"
|
|
||||||
|
#ifdef OGLR
|
||||||
|
#include "OpenGLDrawMethods.inc"
|
||||||
|
#else
|
||||||
|
#include "RasterDrawMethods.inc"
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef PIXELMETHODS_CLASS
|
#undef PIXELMETHODS_CLASS
|
||||||
|
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "Border.h"
|
#include "Border.h"
|
||||||
#include "Colour.h"
|
#include "Colour.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
namespace ui
|
namespace ui
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "interface/Button.h"
|
#include "interface/Button.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#include "Engine.h"
|
#include "Engine.h"
|
||||||
#include "Misc.h"
|
#include "Misc.h"
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "interface/Window.h"
|
#include "interface/Window.h"
|
||||||
#include "interface/Platform.h"
|
#include "interface/Platform.h"
|
||||||
#include "interface/Engine.h"
|
#include "interface/Engine.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <stack>
|
#include <stack>
|
||||||
#include "Singleton.h"
|
#include "Singleton.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
|
|
||||||
namespace ui
|
namespace ui
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "SaveButton.h"
|
#include "SaveButton.h"
|
||||||
#include "client/SaveInfo.h"
|
#include "client/SaveInfo.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#include "Engine.h"
|
#include "Engine.h"
|
||||||
#include "client/Client.h"
|
#include "client/Client.h"
|
||||||
#include "simulation/SaveRenderer.h"
|
#include "simulation/SaveRenderer.h"
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
#include "client/SaveFile.h"
|
#include "client/SaveFile.h"
|
||||||
#include "client/SaveInfo.h"
|
#include "client/SaveInfo.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#include "search/Thumbnail.h"
|
#include "search/Thumbnail.h"
|
||||||
#include "interface/Colour.h"
|
#include "interface/Colour.h"
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "PowderToyJava.h"
|
#include "PowderToyJava.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
#include "game/GameController.h"
|
#include "game/GameController.h"
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "RenderView.h"
|
#include "RenderView.h"
|
||||||
#include "RenderModel.h"
|
#include "RenderModel.h"
|
||||||
#include "Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
#include "Controller.h"
|
#include "Controller.h"
|
||||||
|
|
||||||
class RenderView;
|
class RenderView;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "RenderView.h"
|
#include "RenderView.h"
|
||||||
#include "Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "simulation/ElementGraphics.h"
|
#include "simulation/ElementGraphics.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#include "Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
#include "RenderView.h"
|
#include "RenderView.h"
|
||||||
|
|
||||||
class RenderView::RenderModeAction: public ui::CheckboxAction
|
class RenderView::RenderModeAction: public ui::CheckboxAction
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "interface/Window.h"
|
#include "interface/Window.h"
|
||||||
#include "RenderController.h"
|
#include "RenderController.h"
|
||||||
#include "RenderModel.h"
|
#include "RenderModel.h"
|
||||||
#include "Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
#include "interface/Checkbox.h"
|
#include "interface/Checkbox.h"
|
||||||
|
|
||||||
class RenderController;
|
class RenderController;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define THUMBNAIL_H
|
#define THUMBNAIL_H
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#include "interface/Point.h"
|
#include "interface/Point.h"
|
||||||
|
|
||||||
class Thumbnail
|
class Thumbnail
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "Simulation.h"
|
#include "Simulation.h"
|
||||||
#include "Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
#include "Gravity.h"
|
#include "Gravity.h"
|
||||||
#include "Misc.h"
|
#include "Misc.h"
|
||||||
#include "ElementGraphics.h"
|
#include "ElementGraphics.h"
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SaveRenderer.h"
|
#include "SaveRenderer.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#include "Simulation.h"
|
#include "Simulation.h"
|
||||||
#include "Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
|
|
||||||
|
|
||||||
SaveRenderer::SaveRenderer(){
|
SaveRenderer::SaveRenderer(){
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Sign.h"
|
#include "Sign.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#include "Misc.h"
|
#include "Misc.h"
|
||||||
|
|
||||||
sign::sign(std::string text_, int x_, int y_, Justification justification_):
|
sign::sign(std::string text_, int x_, int y_, Justification justification_):
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
#include "Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
//#include "Elements.h"
|
//#include "Elements.h"
|
||||||
#include "Tools.h"
|
#include "Tools.h"
|
||||||
#include "Misc.h"
|
#include "Misc.h"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define ELEMENTCLASS_H
|
#define ELEMENTCLASS_H
|
||||||
|
|
||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
#include "Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
#include "simulation/Elements.h"
|
#include "simulation/Elements.h"
|
||||||
|
|
||||||
class Simulation;
|
class Simulation;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define SIMTOOL_H
|
#define SIMTOOL_H
|
||||||
|
|
||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
#include "Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
#include "simulation/Elements.h"
|
#include "simulation/Elements.h"
|
||||||
|
|
||||||
class Simulation;
|
class Simulation;
|
||||||
|
Loading…
Reference in New Issue
Block a user