mirror of
https://github.com/edubart/otclient.git
synced 2025-12-26 01:37:12 +01:00
merge total remake
This commit is contained in:
@@ -1,36 +1,7 @@
|
||||
/* The MIT License
|
||||
*
|
||||
* Copyright (c) 2010 OTClient, https://github.com/edubart/otclient
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GRAPHICS_H
|
||||
#define GRAPHICS_H
|
||||
|
||||
#include <global.h>
|
||||
#include <graphics/textures.h>
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glext.h>
|
||||
#include "graphicsdeclarations.h"
|
||||
|
||||
class Graphics
|
||||
{
|
||||
@@ -44,9 +15,7 @@ class Graphics
|
||||
};
|
||||
|
||||
public:
|
||||
Graphics() : m_drawMode(DRAW_NONE) { }
|
||||
|
||||
/// Initialize graphics
|
||||
/// Initialize default OpenGL states
|
||||
void init();
|
||||
|
||||
/// Termiante graphics
|
||||
@@ -55,7 +24,7 @@ public:
|
||||
/// Check if a GL extension is supported
|
||||
bool isExtensionSupported(const char *extension);
|
||||
|
||||
/// Called after every window resize
|
||||
/// Resizes OpenGL viewport
|
||||
void resize(const Size& size);
|
||||
|
||||
/// Restore original viewport
|
||||
@@ -66,27 +35,38 @@ public:
|
||||
|
||||
/// Called after every render
|
||||
void endRender();
|
||||
void disableDrawing();
|
||||
|
||||
// drawing API
|
||||
void drawTexturedRect(const Rect& screenCoords,
|
||||
const TexturePtr& texture,
|
||||
const Rect& textureCoords = Rect(),
|
||||
const Color& color = Color::white);
|
||||
|
||||
void drawRepeatedTexturedRect(const Rect& screenCoords,
|
||||
const TexturePtr& texture,
|
||||
const Rect& textureCoords,
|
||||
const Color& color = Color::white);
|
||||
|
||||
void drawFilledRect(const Rect& screenCoords,
|
||||
const Color& color);
|
||||
|
||||
void drawBoundingRect(const Rect& screenCoords,
|
||||
const Color& color = Color::green,
|
||||
int innerLineWidth = 1);
|
||||
|
||||
const Size& getScreenSize() const { return m_screenSize; }
|
||||
|
||||
void disableDrawing();
|
||||
void enableDrawing();
|
||||
|
||||
void drawTexturedRect(const Rect& screenCoords, const TexturePtr& texture, const Rect& textureCoords = Rect(), const Color& color = Color::white);
|
||||
void drawRepeatedTexturedRect(const Rect& screenCoords, const TexturePtr& texture, const Rect& textureCoords, const Color& color = Color::white);
|
||||
void drawFilledRect(const Rect& screenCoords, const Color& color);
|
||||
void drawBoundingRect(const Rect& screenCoords, const Color& color = Color::green, int innerLineWidth = 1);
|
||||
|
||||
private:
|
||||
void bindTexture(const TexturePtr& texture, const Color& color = Color::white);
|
||||
void bindColor(const Color& color);
|
||||
|
||||
TexturePtr m_bindedTexture;
|
||||
Color m_bindedColor;
|
||||
TexturePtr m_boundTexture;
|
||||
Color m_boundColor;
|
||||
Size m_screenSize;
|
||||
DrawMode m_drawMode;
|
||||
};
|
||||
|
||||
extern Graphics g_graphics;
|
||||
|
||||
#endif // GRAPHICS_H
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user