mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
fixes toward mingw compatibility
This commit is contained in:
parent
a7b158fada
commit
841ac10e5c
@ -10,8 +10,10 @@ add_definitions ( -DUSE_CMAKE_CONFIG_H )
|
||||
|
||||
if(WIN32)
|
||||
# Windows
|
||||
# Surpress some useless warnings
|
||||
add_definitions ( /D "_CRT_SECURE_NO_DEPRECATE" /W1 )
|
||||
if(MSVC)
|
||||
# Surpress some useless warnings
|
||||
add_definitions ( /D "_CRT_SECURE_NO_DEPRECATE" /W1 )
|
||||
endif()
|
||||
# Zlib stuff
|
||||
set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../zlib/zlib-1.2.5"
|
||||
CACHE PATH "Zlib include directory")
|
||||
|
@ -197,7 +197,7 @@ DebugStacker::~DebugStacker()
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
#if CATCH_UNHANDLED_EXCEPTIONS == 1
|
||||
void se_trans_func(unsigned int u, EXCEPTION_POINTERS* pExp)
|
||||
{
|
||||
|
31
src/debug.h
31
src/debug.h
@ -238,18 +238,7 @@ private:
|
||||
assert(0);\
|
||||
}
|
||||
#ifdef _WIN32 // Windows
|
||||
|
||||
/*class SE_Exception : public std::exception
|
||||
{
|
||||
private:
|
||||
unsigned int nSE;
|
||||
public:
|
||||
SE_Exception() {}
|
||||
SE_Exception( unsigned int n ) : nSE( n ) {}
|
||||
~SE_Exception() {}
|
||||
unsigned int getSeNumber() { return nSE; }
|
||||
};*/
|
||||
|
||||
#ifdef _MSC_VER // MSVC
|
||||
void se_trans_func(unsigned int, EXCEPTION_POINTERS*);
|
||||
|
||||
class FatalSystemException : public BaseException
|
||||
@ -259,14 +248,18 @@ public:
|
||||
BaseException(s)
|
||||
{}
|
||||
};
|
||||
#define BEGIN_DEBUG_EXCEPTION_HANDLER \
|
||||
BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER\
|
||||
_set_se_translator(se_trans_func);
|
||||
|
||||
#define BEGIN_DEBUG_EXCEPTION_HANDLER \
|
||||
BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER\
|
||||
_set_se_translator(se_trans_func);
|
||||
|
||||
#define END_DEBUG_EXCEPTION_HANDLER \
|
||||
END_PORTABLE_DEBUG_EXCEPTION_HANDLER
|
||||
|
||||
#define END_DEBUG_EXCEPTION_HANDLER \
|
||||
END_PORTABLE_DEBUG_EXCEPTION_HANDLER
|
||||
#else // Probably mingw
|
||||
#define BEGIN_DEBUG_EXCEPTION_HANDLER\
|
||||
BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER
|
||||
#define END_DEBUG_EXCEPTION_HANDLER\
|
||||
END_PORTABLE_DEBUG_EXCEPTION_HANDLER
|
||||
#endif
|
||||
#else // Posix
|
||||
#define BEGIN_DEBUG_EXCEPTION_HANDLER\
|
||||
BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER
|
||||
|
36
src/main.cpp
36
src/main.cpp
@ -2050,6 +2050,8 @@ int main(int argc, char *argv[])
|
||||
// A test
|
||||
//throw con::PeerNotFoundException("lol");
|
||||
|
||||
core::list<float> frametime_log;
|
||||
|
||||
/*
|
||||
Main loop
|
||||
*/
|
||||
@ -2147,6 +2149,23 @@ int main(int argc, char *argv[])
|
||||
dtime = 0;
|
||||
lasttime = time;
|
||||
|
||||
/*
|
||||
Log frametime for visualization
|
||||
*/
|
||||
frametime_log.push_back(dtime);
|
||||
if(frametime_log.size() > 100)
|
||||
{
|
||||
core::list<float>::Iterator i = frametime_log.begin();
|
||||
frametime_log.erase(i);
|
||||
}
|
||||
|
||||
/*
|
||||
Visualize frametime in terminal
|
||||
*/
|
||||
/*for(u32 i=0; i<dtime*400; i++)
|
||||
std::cout<<"X";
|
||||
std::cout<<std::endl;*/
|
||||
|
||||
/*
|
||||
Time average and jitter calculation
|
||||
*/
|
||||
@ -2979,8 +2998,25 @@ int main(int argc, char *argv[])
|
||||
displaycenter + core::vector2d<s32>(0,10),
|
||||
video::SColor(255,255,255,255));
|
||||
|
||||
/*
|
||||
Frametime log
|
||||
*/
|
||||
{
|
||||
s32 x = 10;
|
||||
for(core::list<float>::Iterator
|
||||
i = frametime_log.begin();
|
||||
i != frametime_log.end();
|
||||
i++)
|
||||
{
|
||||
driver->draw2DLine(v2s32(x,50),
|
||||
v2s32(x,50+(*i)*1000),
|
||||
video::SColor(255,255,255,255));
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
} // timer
|
||||
|
||||
//timer10.stop();
|
||||
//TimeTaker //timer11("//timer11");
|
||||
|
||||
|
@ -755,7 +755,7 @@ void MapBlock::updateMesh(u32 daynight_ratio)
|
||||
material.Lighting = false;
|
||||
material.BackfaceCulling = false;
|
||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_OFF);
|
||||
//material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_OFF);
|
||||
//material.setFlag(video::EMF_ANTI_ALIASING, video::EAAM_SIMPLE);
|
||||
material.setFlag(video::EMF_FOG_ENABLE, true);
|
||||
|
||||
|
30
src/tile.cpp
30
src/tile.cpp
@ -387,10 +387,16 @@ void TextureSource::buildMainAtlas()
|
||||
sourcelist.push_back("sand.png^mineral_coal.png");
|
||||
sourcelist.push_back("sand.png^mineral_iron.png");
|
||||
|
||||
// Padding to disallow texture bleeding
|
||||
s32 padding = 8;
|
||||
|
||||
/*
|
||||
First pass: generate almost everything
|
||||
*/
|
||||
core::position2d<s32> pos_in_atlas(0,0);
|
||||
|
||||
pos_in_atlas.Y += padding;
|
||||
|
||||
for(u32 i=0; i<sourcelist.size(); i++)
|
||||
{
|
||||
std::string name = sourcelist[i];
|
||||
@ -423,6 +429,28 @@ void TextureSource::buildMainAtlas()
|
||||
NULL);
|
||||
}
|
||||
|
||||
// Copy the borders a few times to disallow texture bleeding
|
||||
for(u32 side=0; side<2; side++) // top and bottom
|
||||
for(s32 y0=0; y0<padding; y0++)
|
||||
for(s32 x0=0; x0<(s32)xwise_tiling*(s32)dim.Width; x0++)
|
||||
{
|
||||
s32 dst_y;
|
||||
s32 src_y;
|
||||
if(side==0)
|
||||
{
|
||||
dst_y = y0 + pos_in_atlas.Y + dim.Height;
|
||||
src_y = pos_in_atlas.Y + dim.Height - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst_y = -y0 + pos_in_atlas.Y-1;
|
||||
src_y = pos_in_atlas.Y;
|
||||
}
|
||||
s32 x = x0 + pos_in_atlas.X * dim.Width;
|
||||
video::SColor c = atlas_img->getPixel(x, src_y);
|
||||
atlas_img->setPixel(x,dst_y,c);
|
||||
}
|
||||
|
||||
img2->drop();
|
||||
|
||||
/*
|
||||
@ -447,7 +475,7 @@ void TextureSource::buildMainAtlas()
|
||||
m_name_to_id.insert(name, id);
|
||||
|
||||
// Increment position
|
||||
pos_in_atlas.Y += dim.Height;
|
||||
pos_in_atlas.Y += dim.Height + padding * 2;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user