First running version for Windows 10
This commit is contained in:
1 parent
1ae34ae340
commit
49635589ee
33 files changed
+1342
-190
No files matched your search
Regular → Executable
+5
-5
@@ -75,20 +75,20 @@ namespace Util {
|
||||
|
||||
std::pair<bool, CellIterator> CellIterator::findTypeInCol(uint8_t t) const {
|
||||
if (isBlockType(t))
|
||||
return std::make_pair<bool, CellIterator>(true, *this);
|
||||
return std::make_pair<bool, CellIterator>(true, CellIterator(*this));
|
||||
CellIterator below = down();
|
||||
while (below.isValid()) {
|
||||
if (below.isBlockType(t))
|
||||
return std::make_pair<bool, CellIterator>(true, below);
|
||||
return std::make_pair<bool, CellIterator>(true, CellIterator(below));
|
||||
below = below.down();
|
||||
}
|
||||
CellIterator above = up();
|
||||
while (above.isValid()) {
|
||||
if (above.isBlockType(t))
|
||||
return std::make_pair<bool, CellIterator>(true, above);
|
||||
return std::make_pair<bool, CellIterator>(true, CellIterator(above));
|
||||
above = above.up();
|
||||
}
|
||||
return std::make_pair<bool, CellIterator>(false, *this);
|
||||
return std::make_pair<bool, CellIterator>(false, CellIterator(*this));
|
||||
}
|
||||
|
||||
std::pair<bool, CellIterator> CellIterator::findNeighbourWithType(
|
||||
@@ -135,7 +135,7 @@ namespace Util {
|
||||
// if (p.first) INFO << p.second.x << " " << p.second.y << " " << p.second.z << std::endl;
|
||||
if (p.first) return p;
|
||||
}
|
||||
return std::make_pair<bool, CellIterator>(false, *this);
|
||||
return std::make_pair<bool, CellIterator>(false, CellIterator(*this));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Regular → Executable
+20
-21
@@ -15,13 +15,13 @@ namespace GUI {
|
||||
id(0), rect(), color(), borderColor(), drawBorder(false),
|
||||
manager(ManagerHolder::Instance()) {
|
||||
copyRect(r);
|
||||
color.r = 255; color.g = 255; color.b = 255; color.unused = 255;
|
||||
color.r = 255; color.g = 255; color.b = 255; color.a = 255;
|
||||
}
|
||||
Object::Object(const size_t Id, const SDL_Rect & r) :
|
||||
id(Id), rect(), color(), borderColor(), drawBorder(false),
|
||||
manager(ManagerHolder::Instance()) {
|
||||
copyRect(r);
|
||||
color.r = 255; color.g = 255; color.b = 255; color.unused = 255;
|
||||
color.r = 255; color.g = 255; color.b = 255; color.a = 255;
|
||||
}
|
||||
Object::Object(const size_t Id, const SDL_Rect & r, const SDL_Color & c) :
|
||||
id(Id), rect(), color(), borderColor(), drawBorder(false),
|
||||
@@ -33,7 +33,7 @@ namespace GUI {
|
||||
glEnable (GL_BLEND);
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glColor4ub(color.r, color.g, color.b, color.unused);
|
||||
glColor4ub(color.r, color.g, color.b, color.a);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2i(rect.x, rect.y);
|
||||
@@ -47,7 +47,7 @@ namespace GUI {
|
||||
}
|
||||
void Object::draw_border() {
|
||||
glColor4ub(borderColor.r, borderColor.g, borderColor.b,
|
||||
borderColor.unused);
|
||||
borderColor.a);
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2i(rect.x, rect.y);
|
||||
glVertex2i(rect.x + rect.w, rect.y);
|
||||
@@ -65,13 +65,13 @@ namespace GUI {
|
||||
color.r = src.r;
|
||||
color.g = src.g;
|
||||
color.b = src.b;
|
||||
color.unused = src.unused;
|
||||
color.a = src.a;
|
||||
}
|
||||
void TexturedObject::draw() {
|
||||
if (texId == 0)
|
||||
return;
|
||||
const OpenGL::PagedTexture & tex = manager.getCachedImage(texId);
|
||||
glColor4ub(color.r, color.g, color.b, color.unused);
|
||||
glColor4ub(color.r, color.g, color.b, color.a);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, tex.inPage);
|
||||
glBegin(GL_QUADS);
|
||||
@@ -96,7 +96,7 @@ namespace GUI {
|
||||
assert(animation);
|
||||
size_t texId = animation->getCurrentFrame();
|
||||
const OpenGL::PagedTexture & tex = manager.getCachedImage(texId);
|
||||
glColor4ub(color.r, color.g, color.b, color.unused);
|
||||
glColor4ub(color.r, color.g, color.b, color.a);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, tex.inPage);
|
||||
glBegin(GL_QUADS);
|
||||
@@ -116,7 +116,7 @@ namespace GUI {
|
||||
|
||||
void Label::draw() {
|
||||
glPushMatrix();
|
||||
glColor4ub(color.r, color.g, color.b, color.unused);
|
||||
glColor4ub(color.r, color.g, color.b, color.a);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
if (align == 0) {
|
||||
glTranslatef(rect.x, rect.y, 0);
|
||||
@@ -146,7 +146,7 @@ namespace GUI {
|
||||
void Pager::draw() {
|
||||
|
||||
const OpenGL::PagedTexture & tex = manager.getCachedImage(texId);
|
||||
glColor4ub(color.r, color.g, color.b, color.unused);
|
||||
glColor4ub(color.r, color.g, color.b, color.a);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, tex.inPage);
|
||||
glBegin(GL_QUADS);
|
||||
@@ -163,11 +163,11 @@ namespace GUI {
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
glPushMatrix();
|
||||
glColor4ub(color.r, color.g, color.b, color.unused);
|
||||
glColor4ub(color.r, color.g, color.b, color.a);
|
||||
glTranslatef(rect.x+offset, rect.y+4, 0);
|
||||
int slen = (int)font->drawString("test - hello world, this is a really long message. it will not end. never... or maybe sometime, but not yet. The end.");
|
||||
if (slen + offset < -10) {
|
||||
color.unused = 0;
|
||||
color.a = 0;
|
||||
manager.remove(this);
|
||||
}
|
||||
INFO << slen <<" " << offset << std::endl;
|
||||
@@ -254,11 +254,11 @@ namespace GUI {
|
||||
}
|
||||
|
||||
void Manager::cacheImageRAW(const std::string & file, size_t k) {
|
||||
texCache.insert(std::make_pair<size_t, OpenGL::PagedTexture>(k, ImageUtil::loadImageRAW(file)));
|
||||
texCache.insert(std::make_pair(k, ImageUtil::loadImageRAW(file)));
|
||||
}
|
||||
|
||||
void Manager::cacheImageRAT(const std::string & file, const std::string & palette, size_t k) {
|
||||
texCache.insert(std::make_pair<size_t, OpenGL::PagedTexture>(k,
|
||||
texCache.insert(std::make_pair(k,
|
||||
ImageUtil::loadImageRATWithPalette(file, palette)));
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ namespace GUI {
|
||||
OpenGTA::GraphicsBase & graphics = OpenGTA::StyleHolder::Instance().get();
|
||||
PHYSFS_uint16 t = graphics.spriteNumbers.reIndex(id, OpenGTA::GraphicsBase::SpriteNumbers::ARROW);
|
||||
OpenGTA::GraphicsBase::SpriteInfo * info = graphics.getSprite(t);
|
||||
texCache.insert(std::make_pair<size_t, OpenGL::PagedTexture>(
|
||||
texCache.insert(std::make_pair(
|
||||
id, OpenGL::SpriteCacheHolder::Instance().createSprite(size_t(t), remap, 0, info)
|
||||
));
|
||||
return ImageUtil::WidthHeightPair(info->w, info->h);
|
||||
@@ -284,7 +284,7 @@ namespace GUI {
|
||||
if (l == guiLayers.end()) {
|
||||
GuiObjectList list;
|
||||
list.push_back(obj);
|
||||
guiLayers.insert(std::make_pair<uint8_t, GuiObjectList>(onLevel, list));
|
||||
guiLayers.insert(std::make_pair(onLevel, list));
|
||||
return;
|
||||
}
|
||||
GuiObjectList & list = l->second;
|
||||
@@ -375,7 +375,7 @@ namespace GUI {
|
||||
}
|
||||
void Manager::createAnimation(const std::vector<uint16_t> & indices, uint16_t fps, size_t k) {
|
||||
Animation * anim = new Animation(indices, fps);
|
||||
guiAnimations.insert(std::make_pair<size_t, Animation*>(k, anim));
|
||||
guiAnimations.insert(std::make_pair(k, anim));
|
||||
anim->set(Util::Animation::PLAY_FORWARD, Util::Animation::LOOP);
|
||||
}
|
||||
|
||||
@@ -455,6 +455,9 @@ namespace GUI {
|
||||
|
||||
|
||||
void screen_gamma_callback(float v) {
|
||||
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
|
||||
|
||||
/*
|
||||
screen_gamma = v;
|
||||
SDL_SetGamma(v, v, v);
|
||||
#ifdef WITH_LUA
|
||||
@@ -481,12 +484,8 @@ namespace GUI {
|
||||
os << "Gamma: " << v;
|
||||
static_cast<Label*>(o)->text = os.str();
|
||||
}
|
||||
/*
|
||||
Object * o2 = ManagerHolder::Instance().findObject(1001);
|
||||
if (o2) {
|
||||
static_cast<ImageStatusDisplay*>(o2)->number = screen_gamma * 3;
|
||||
}*/
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
AnimStatusDisplay* wantedLevel = NULL;
|
||||
|
||||
Regular → Executable
+18
-3
@@ -29,7 +29,9 @@
|
||||
#include "cistring.h"
|
||||
#include "opengta.h"
|
||||
#include "physfsrwops.h"
|
||||
#include "SDL_image.h"
|
||||
|
||||
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
|
||||
//#include "SDL_image.h"
|
||||
#include "m_exceptions.h"
|
||||
|
||||
namespace ImageUtil {
|
||||
@@ -76,7 +78,7 @@ using OpenGL::PagedTexture;
|
||||
|
||||
if (!(bpp && bpp * width * height == size))
|
||||
ERROR << "could not identify image: " << name << " size: " << size << std::endl;
|
||||
return std::make_pair<uint16_t, uint16_t>(width, height);
|
||||
return std::make_pair(width, height);
|
||||
}
|
||||
|
||||
|
||||
@@ -169,6 +171,16 @@ using OpenGL::PagedTexture;
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_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);
|
||||
|
||||
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
|
||||
|
||||
if (rgba) {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
}
|
||||
else {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
|
||||
}
|
||||
/*
|
||||
if (rgba) {
|
||||
if (mipmapTextures)
|
||||
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
@@ -180,7 +192,10 @@ using OpenGL::PagedTexture;
|
||||
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, w, h, GL_RGB, GL_UNSIGNED_BYTE, pixels);
|
||||
else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
if (supportedMaxAnisoDegree > 1.0f)
|
||||
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, &supportedMaxAnisoDegree);
|
||||
|
||||
|
||||
Regular → Executable
+3
-1
@@ -20,7 +20,9 @@
|
||||
* 3. This notice may not be removed or altered from any source *
|
||||
* distribution. *
|
||||
************************************************************************/
|
||||
#include <SDL_keysym.h>
|
||||
|
||||
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
|
||||
//#include <SDL_keysym.h>
|
||||
#include "key_handler.h"
|
||||
#include "log.h"
|
||||
|
||||
|
||||
Regular → Executable
+6
-5
@@ -3,7 +3,7 @@
|
||||
|
||||
namespace Util {
|
||||
void SpriteCreationArea::setRects(const SDL_Rect & allowed, const SDL_Rect & denied) {
|
||||
validRects = std::make_pair<SDL_Rect, SDL_Rect>(allowed, denied);
|
||||
validRects = std::make_pair(allowed, denied);
|
||||
onScreen = denied;
|
||||
}
|
||||
|
||||
@@ -25,11 +25,12 @@ namespace Util {
|
||||
TupleOfUint8 SpriteCreationArea::getValidCoord() {
|
||||
uint32_t x = rnd.nextUint(validRects.first.w) + validRects.first.x;
|
||||
uint32_t y = rnd.nextUint(validRects.first.h) + validRects.first.y;
|
||||
return std::make_pair<uint8_t, uint8_t>(x, y);
|
||||
return std::make_pair(x, y);
|
||||
}
|
||||
|
||||
int item_count(MapOfPair2Int & m, int a, int b) {
|
||||
MapOfPair2Int::iterator j = m.find( std::make_pair<int, int>(a, b) );
|
||||
|
||||
const auto& j = m.find({a, b});
|
||||
if (j == m.end())
|
||||
return 0;
|
||||
return j->second;
|
||||
@@ -37,13 +38,13 @@ namespace Util {
|
||||
|
||||
void register_item1(MapOfPair2Int & m, int a, int b) {
|
||||
m.insert( std::make_pair< Pair2Int, int>(
|
||||
std::make_pair<int, int>(a, b),
|
||||
std::make_pair(a, b),
|
||||
1)
|
||||
);
|
||||
}
|
||||
|
||||
void register_item(MapOfPair2Int & m, int a, int b) {
|
||||
Pair2Int _p(std::make_pair<int, int>(a, b));
|
||||
Pair2Int _p(std::make_pair(a, b));
|
||||
MapOfPair2Int::iterator j = m.find(_p);
|
||||
if (j == m.end())
|
||||
register_item1(m, a, b);
|
||||
|
||||
Regular → Executable
+1
-1
@@ -31,7 +31,7 @@ namespace Util {
|
||||
*/
|
||||
template <typename T>
|
||||
struct lt_pair {
|
||||
bool operator() (const T & a, const T & b) {
|
||||
bool operator() (const T & a, const T & b) const {
|
||||
if (a.first < b.first)
|
||||
return true;
|
||||
if (a.first > b.first)
|
||||
|
||||
Regular → Executable
+3
@@ -25,6 +25,9 @@
|
||||
#include "physfs.h"
|
||||
#include "SDL.h"
|
||||
|
||||
//Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com
|
||||
#define __EXPORT__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
Regular → Executable
+4
-4
@@ -134,16 +134,16 @@ void Timer::checkSimEvents() {
|
||||
|
||||
void Timer::registerCallback(bool simTime, CallbackType & c, const uint32_t & b, const uint32_t & e) {
|
||||
if (simTime)
|
||||
simTimeEvents.insert(std::make_pair<uint32_t, TimeEvent>(b, TimeEvent(b, e, c)));
|
||||
simTimeEvents.insert(std::make_pair(b, TimeEvent(b, e, c)));
|
||||
else
|
||||
realTimeEvents.insert(std::make_pair<uint32_t, TimeEvent>(b, TimeEvent(b, e, c)));
|
||||
realTimeEvents.insert(std::make_pair(b, TimeEvent(b, e, c)));
|
||||
}
|
||||
|
||||
void Timer::registerCallback(bool simTime, CallbackType & c, const uint32_t & b) {
|
||||
if (simTime)
|
||||
simTimeEvents.insert(std::make_pair<uint32_t, TimeEvent>(b, TimeEvent(b, c)));
|
||||
simTimeEvents.insert(std::make_pair(b, TimeEvent(b, c)));
|
||||
else
|
||||
realTimeEvents.insert(std::make_pair<uint32_t, TimeEvent>(b, TimeEvent(b, c)));
|
||||
realTimeEvents.insert(std::make_pair(b, TimeEvent(b, c)));
|
||||
}
|
||||
|
||||
void Timer::clearAllEvents() {
|
||||
|
||||
Reference in new issue
Block a user