Added cancel load button

This commit is contained in:
mathusummut
2019-02-20 02:37:59 +01:00
parent 1ad6245324
commit 3e50ea514f
29 changed files with 471 additions and 293 deletions

View File

@@ -941,7 +941,7 @@ namespace Shared {
this->components = components;
deletePixels();
if (getPixelByteCount() <= 0 || (h <= 0 || w <= 0 || components <= 0)) {
if (getPixelByteCount() < 0 || (h < 0 || w < 0 || components < 0)) {
char szBuf[8096];
snprintf(szBuf, 8096, "Invalid pixmap dimensions for [%s], h = %d, w = %d, components = %d\n", path.c_str(), h, w, components);
throw game_runtime_error(szBuf);
@@ -1098,8 +1098,10 @@ namespace Shared {
value = pixels[index] / 255.f;
}
//vector get
Vec4f Pixmap2D::getPixel4f(int x, int y) const {
Vec4f Pixmap2D::getPixel4f(int x, int y, bool fallback) const {
if (pixels == NULL && fallback) {
return Vec4f(0.f, 0.f, 0.f, 0.f);
}
Vec4f v(0.f);
for (int i = 0; i < components && i < 4; ++i) {
std::size_t index = (w*y + x)*components + i;

View File

@@ -79,9 +79,9 @@ namespace Shared {
int RandomGen::randRange(int min, int max, string lastCaller) {
if (min > max) {
char szBuf[8096] = "";
snprintf(szBuf, 8096, "In [%s::%s Line: %d] min > max, min = %d, max = %d", __FILE__, __FUNCTION__, __LINE__, min, max);
throw game_runtime_error(szBuf);
int temp = min;
min = max;
max = temp;
}
int diff = max - min;
@@ -97,9 +97,9 @@ namespace Shared {
float RandomGen::randRange(float min, float max, string lastCaller) {
if (min > max) {
char szBuf[8096] = "";
snprintf(szBuf, 8096, "In [%s::%s Line: %d] min > max, min = %f, max = %f", __FILE__, __FUNCTION__, __LINE__, min, max);
throw game_runtime_error(szBuf);
int temp = min;
min = max;
max = temp;
}
float rand01 = static_cast<float>(this->rand(lastCaller)) / (m - 1);