Move graphics into seperate folder

This commit is contained in:
Simon Robertshaw 2012-07-06 16:06:26 +01:00
parent 94c9603d0c
commit adc9cc0816
35 changed files with 118 additions and 102 deletions

5
.gitignore vendored
View File

@ -26,4 +26,7 @@ Makefile.me
*.manifest
*.manifest.res
*.pdb
*.sublime-*
*.sublime-*
*.project
*.cproject
*.settings

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@
#include <sstream>
#include <string>
#include "Config.h"
#include "Graphics.h"
#include "graphics/Graphics.h"
#if defined(LIN32) || defined(LIN64)
#include "icon.h"
#endif

View File

@ -18,7 +18,7 @@
#include "Config.h"
#include "Client.h"
#include "MD5.h"
#include "Graphics.h"
#include "graphics/Graphics.h"
#include "Misc.h"
#include "interface/Point.h"

View File

@ -3,7 +3,7 @@
#include "GameView.h"
#include "simulation/Simulation.h"
#include "simulation/Air.h"
#include "Renderer.h"
#include "graphics/Renderer.h"
#include "interface/Point.h"
#include "Brush.h"
#include "EllipseBrush.h"

View File

@ -6,7 +6,7 @@
#include "client/SaveInfo.h"
#include "simulation/Simulation.h"
#include "interface/Colour.h"
#include "Renderer.h"
#include "graphics/Renderer.h"
#include "GameView.h"
#include "Brush.h"
#include "client/User.h"

View File

@ -4,7 +4,7 @@
#include "Config.h"
#include "Style.h"
#include "GameView.h"
#include "Graphics.h"
#include "graphics/Graphics.h"
#include "interface/Window.h"
#include "interface/Button.h"
#include "interface/Colour.h"

View File

@ -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)
{
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])
{
case 'w':
r = g = b = 255;
r = g = b = 255;
break;
case 'g':
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);
glDisable(GL_TEXTURE_2D);
}
#endif
}

View 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

View File

@ -27,7 +27,7 @@ void Graphics::Finalise()
#define VIDXRES XRES+BARSIZE
#define VIDYRES YRES+MENUSIZE
#define PIXELMETHODS_CLASS Graphics
#include "PixelMethods.inc"
#include "RasterDrawMethods.inc"
#undef VIDYRES
#undef VIDXRES
#undef PIXELMETHODS_CLASS

View File

@ -2197,6 +2197,12 @@ Renderer::~Renderer()
}
#define PIXELMETHODS_CLASS Renderer
#include "PixelMethods.inc"
#ifdef OGLR
#include "OpenGLDrawMethods.inc"
#else
#include "RasterDrawMethods.inc"
#endif
#undef PIXELMETHODS_CLASS

View File

@ -10,7 +10,7 @@
#include "Border.h"
#include "Colour.h"
#include "Graphics.h"
#include "graphics/Graphics.h"
namespace ui
{

View File

@ -7,7 +7,7 @@
#include <iostream>
#include "interface/Button.h"
#include "Graphics.h"
#include "graphics/Graphics.h"
#include "Engine.h"
#include "Misc.h"

View File

@ -6,7 +6,7 @@
#include "interface/Window.h"
#include "interface/Platform.h"
#include "interface/Engine.h"
#include "Graphics.h"
#include "graphics/Graphics.h"
using namespace ui;
using namespace std;

View File

@ -3,7 +3,7 @@
#include <stack>
#include "Singleton.h"
#include "Platform.h"
#include "Graphics.h"
#include "graphics/Graphics.h"
#include "Window.h"
namespace ui

View File

@ -2,7 +2,7 @@
#include "SaveButton.h"
#include "client/SaveInfo.h"
#include "Graphics.h"
#include "graphics/Graphics.h"
#include "Engine.h"
#include "client/Client.h"
#include "simulation/SaveRenderer.h"

View File

@ -6,7 +6,7 @@
#include "Component.h"
#include "client/SaveFile.h"
#include "client/SaveInfo.h"
#include "Graphics.h"
#include "graphics/Graphics.h"
#include "search/Thumbnail.h"
#include "interface/Colour.h"

View File

@ -7,7 +7,7 @@
#include "Config.h"
#include "PowderToyJava.h"
#include "Graphics.h"
#include "graphics/Graphics.h"
#include "game/GameController.h"

View File

@ -10,7 +10,7 @@
#include "RenderView.h"
#include "RenderModel.h"
#include "Renderer.h"
#include "graphics/Renderer.h"
#include "Controller.h"
class RenderView;

View File

@ -10,7 +10,7 @@
#include <vector>
#include "RenderView.h"
#include "Renderer.h"
#include "graphics/Renderer.h"
using namespace std;

View File

@ -6,8 +6,8 @@
*/
#include "simulation/ElementGraphics.h"
#include "Graphics.h"
#include "Renderer.h"
#include "graphics/Graphics.h"
#include "graphics/Renderer.h"
#include "RenderView.h"
class RenderView::RenderModeAction: public ui::CheckboxAction

View File

@ -13,7 +13,7 @@
#include "interface/Window.h"
#include "RenderController.h"
#include "RenderModel.h"
#include "Renderer.h"
#include "graphics/Renderer.h"
#include "interface/Checkbox.h"
class RenderController;

View File

@ -2,7 +2,7 @@
#define THUMBNAIL_H
#include <iostream>
#include "Graphics.h"
#include "graphics/Graphics.h"
#include "interface/Point.h"
class Thumbnail

View File

@ -4,7 +4,7 @@
#include <cmath>
#include "Simulation.h"
#include "Renderer.h"
#include "graphics/Renderer.h"
#include "Gravity.h"
#include "Misc.h"
#include "ElementGraphics.h"

View File

@ -6,9 +6,9 @@
*/
#include "SaveRenderer.h"
#include "Graphics.h"
#include "graphics/Graphics.h"
#include "Simulation.h"
#include "Renderer.h"
#include "graphics/Renderer.h"
SaveRenderer::SaveRenderer(){

View File

@ -6,7 +6,7 @@
*/
#include "Sign.h"
#include "Graphics.h"
#include "graphics/Graphics.h"
#include "Misc.h"
sign::sign(std::string text_, int x_, int y_, Justification justification_):

View File

@ -10,8 +10,8 @@
#include <cstring>
#include <cstddef>
#include "Config.h"
#include "Renderer.h"
#include "Graphics.h"
#include "graphics/Renderer.h"
#include "graphics/Graphics.h"
//#include "Elements.h"
#include "Tools.h"
#include "Misc.h"

View File

@ -2,7 +2,7 @@
#define ELEMENTCLASS_H
#include "simulation/Simulation.h"
#include "Renderer.h"
#include "graphics/Renderer.h"
#include "simulation/Elements.h"
class Simulation;

View File

@ -2,7 +2,7 @@
#define SIMTOOL_H
#include "simulation/Simulation.h"
#include "Renderer.h"
#include "graphics/Renderer.h"
#include "simulation/Elements.h"
class Simulation;