Rework application class and framework

Make otclient's framework flexible enough to run console apps like
servers, so this mean is possible to build otclient versions without
graphical interface and use it's framework to code servers
This commit is contained in:
Eduardo Bart
2012-07-13 22:10:24 -03:00
parent 099716fe03
commit e3298d561c
131 changed files with 1228 additions and 1016 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 2010-2012 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 APNGLOADER_H
#define APNGLOADER_H
#include <sstream>
struct apng_data {
unsigned char *pdata;
unsigned int width;
unsigned int height;
unsigned int first_frame;
unsigned int last_frame;
unsigned char bpp;
unsigned char coltype;
unsigned int num_frames;
unsigned int num_plays;
unsigned short *frames_delay; // each frame delay in ms
};
// returns -1 on error, 0 on success
int load_apng(std::stringstream& file, struct apng_data *apng);
void save_png(std::stringstream& file, int width, int height, int channels, unsigned char *pixels);
void free_apng(struct apng_data *apng);
#endif

View File

@@ -25,7 +25,7 @@
#include "texture.h"
#include <framework/platform/platformwindow.h>
#include <framework/application.h>
#include <framework/core/application.h>
uint FrameBuffer::boundFbo = 0;
@@ -47,7 +47,7 @@ void FrameBuffer::internalCreate()
FrameBuffer::~FrameBuffer()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
if(g_graphics.ok() && m_fbo != 0)
glDeleteFramebuffers(1, &m_fbo);
}

View File

@@ -23,7 +23,7 @@
#include "hardwarebuffer.h"
#include "graphics.h"
#include <framework/application.h>
#include <framework/core/application.h>
#include <framework/core/logger.h>
HardwareBuffer::HardwareBuffer(Type type)
@@ -37,7 +37,7 @@ HardwareBuffer::HardwareBuffer(Type type)
HardwareBuffer::~HardwareBuffer()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
if(g_graphics.ok())
glDeleteBuffers(1, &m_id);
}

View File

@@ -24,7 +24,7 @@
#include "image.h"
#include <framework/core/resourcemanager.h>
#include <framework/thirdparty/apngloader.h>
#include <framework/graphics/apngloader.h>
Image::Image(const Size& size, int bpp, uint8 *pixels)
{

View File

@@ -25,7 +25,7 @@
#include "declarations.h"
#include "particlesystem.h"
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
#include <framework/otml/otml.h>
class ParticleEffectType : public LuaObject

View File

@@ -23,7 +23,7 @@
#include "shader.h"
#include "graphics.h"
#include <framework/application.h>
#include <framework/core/application.h>
#include <framework/core/resourcemanager.h>
Shader::Shader(Shader::ShaderType shaderType)
@@ -44,7 +44,7 @@ Shader::Shader(Shader::ShaderType shaderType)
Shader::~Shader()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
if(g_graphics.ok())
glDeleteShader(m_shaderId);
}

View File

@@ -23,7 +23,7 @@
#include "shaderprogram.h"
#include "graphics.h"
#include <framework/application.h>
#include <framework/core/application.h>
uint ShaderProgram::m_currentProgram = 0;
@@ -38,7 +38,7 @@ ShaderProgram::ShaderProgram()
ShaderProgram::~ShaderProgram()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
if(g_graphics.ok())
glDeleteProgram(m_programId);
}

View File

@@ -24,7 +24,7 @@
#define SHADERPROGRAM_H
#include "shader.h"
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
// @bindclass
class ShaderProgram : public LuaObject

View File

@@ -25,7 +25,7 @@
#include "framebuffer.h"
#include "image.h"
#include <framework/application.h>
#include <framework/core/application.h>
Texture::Texture()
{
@@ -79,7 +79,7 @@ Texture::Texture(const ImagePtr& image, bool buildMipmaps)
Texture::~Texture()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
// free texture from gl memory
if(g_graphics.ok() && m_id != 0)
glDeleteTextures(1, &m_id);

View File

@@ -26,7 +26,7 @@
#include "image.h"
#include <framework/core/resourcemanager.h>
#include <framework/thirdparty/apngloader.h>
#include <framework/graphics/apngloader.h>
TextureManager g_textures;