Merge branch 'develop' of github.com:simtr/The-Powder-Toy into develop
This commit is contained in:
commit
74dcd4074e
10
SConscript
10
SConscript
@ -92,7 +92,9 @@ if msvc and platform != "Windows":
|
|||||||
FatalError("Error: --msvc only works on windows")
|
FatalError("Error: --msvc only works on windows")
|
||||||
|
|
||||||
#Create SCons Environment
|
#Create SCons Environment
|
||||||
if platform == "Windows" and not GetOption('msvc'):
|
if GetOption('msvc'):
|
||||||
|
env = Environment(tools = ['default'], ENV = {'PATH' : os.environ['PATH'], 'TMP' : os.environ['TMP']}, TARGET_ARCH = 'x86')
|
||||||
|
elif platform == "Windows" and not GetOption('msvc'):
|
||||||
env = Environment(tools = ['mingw'], ENV = {'PATH' : os.environ['PATH']})
|
env = Environment(tools = ['mingw'], ENV = {'PATH' : os.environ['PATH']})
|
||||||
else:
|
else:
|
||||||
env = Environment(tools = ['default'], ENV = {'PATH' : os.environ['PATH']})
|
env = Environment(tools = ['default'], ENV = {'PATH' : os.environ['PATH']})
|
||||||
@ -168,6 +170,7 @@ if GetOption("msvc"):
|
|||||||
env.Append(LIBPATH=['StaticLibs/'])
|
env.Append(LIBPATH=['StaticLibs/'])
|
||||||
else:
|
else:
|
||||||
env.Append(LIBPATH=['Libraries/'])
|
env.Append(LIBPATH=['Libraries/'])
|
||||||
|
env.Append(CPPPATH=['includes/'])
|
||||||
|
|
||||||
#Check 32/64 bit
|
#Check 32/64 bit
|
||||||
def CheckBit(context):
|
def CheckBit(context):
|
||||||
@ -282,7 +285,7 @@ def findLibs(env, conf):
|
|||||||
FatalError("bzip2 headers not found")
|
FatalError("bzip2 headers not found")
|
||||||
|
|
||||||
#Look for libz
|
#Look for libz
|
||||||
if not conf.CheckLib('z'):
|
if not conf.CheckLib(['z', 'zlib']):
|
||||||
FatalError("libz not found or not installed")
|
FatalError("libz not found or not installed")
|
||||||
|
|
||||||
#Look for pthreads
|
#Look for pthreads
|
||||||
@ -342,7 +345,7 @@ elif not GetOption('help'):
|
|||||||
conf.AddTest('CheckBit', CheckBit)
|
conf.AddTest('CheckBit', CheckBit)
|
||||||
if not conf.CheckCC() or not conf.CheckCXX():
|
if not conf.CheckCC() or not conf.CheckCXX():
|
||||||
FatalError("compiler not correctly configured")
|
FatalError("compiler not correctly configured")
|
||||||
if platform == compilePlatform and isX86 and not GetOption('32bit') and not GetOption('64bit'):
|
if platform == compilePlatform and isX86 and not GetOption('32bit') and not GetOption('64bit') and not GetOption('msvc'):
|
||||||
conf.CheckBit()
|
conf.CheckBit()
|
||||||
findLibs(env, conf)
|
findLibs(env, conf)
|
||||||
env = conf.Finish()
|
env = conf.Finish()
|
||||||
@ -381,6 +384,7 @@ if isX86:
|
|||||||
if not GetOption('no-sse'):
|
if not GetOption('no-sse'):
|
||||||
if GetOption('sse'):
|
if GetOption('sse'):
|
||||||
if msvc:
|
if msvc:
|
||||||
|
if not GetOption('sse2'):
|
||||||
env.Append(CCFLAGS=['/arch:SSE'])
|
env.Append(CCFLAGS=['/arch:SSE'])
|
||||||
else:
|
else:
|
||||||
env.Append(CCFLAGS=['-msse'])
|
env.Append(CCFLAGS=['-msse'])
|
||||||
|
@ -5,5 +5,7 @@
|
|||||||
class DebugInfo
|
class DebugInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Draw(ui::Point position) {}
|
DebugInfo(unsigned int id):ID(id) { }
|
||||||
|
unsigned int ID;
|
||||||
|
virtual void Draw() {}
|
||||||
};
|
};
|
||||||
|
52
src/debug/DebugLines.cpp
Normal file
52
src/debug/DebugLines.cpp
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#include "DebugLines.h"
|
||||||
|
#include "gui/interface/Engine.h"
|
||||||
|
#include "gui/game/GameView.h"
|
||||||
|
#include "gui/game/GameController.h"
|
||||||
|
|
||||||
|
DebugLines::DebugLines(unsigned int id, GameView * view, GameController * controller):
|
||||||
|
DebugInfo(id),
|
||||||
|
view(view),
|
||||||
|
controller(controller)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugLines::Draw()
|
||||||
|
{
|
||||||
|
Graphics * g = ui::Engine::Ref().g;
|
||||||
|
|
||||||
|
if (view->GetDrawingLine())
|
||||||
|
{
|
||||||
|
ui::Point drawPoint1 = controller->PointTranslate(view->GetLineStartCoords()), drawPoint2 = controller->PointTranslate(view->GetLineFinishCoords());
|
||||||
|
if (view->GetDrawSnap())
|
||||||
|
drawPoint2 = view->lineSnapCoords(drawPoint1, drawPoint2);
|
||||||
|
//g->draw_line(drawPoint1.X, drawPoint1.Y, drawPoint2.X, drawPoint2.Y, 255, 0, 255, 255);
|
||||||
|
|
||||||
|
g->draw_line(0, drawPoint1.Y, XRES, drawPoint1.Y, 255, 255, 255, 120);
|
||||||
|
g->draw_line(drawPoint1.X, 0, drawPoint1.X, YRES, 255, 255, 255, 120);
|
||||||
|
|
||||||
|
g->draw_line(0, drawPoint2.Y, XRES, drawPoint2.Y, 255, 255, 255, 120);
|
||||||
|
g->draw_line(drawPoint2.X, 0, drawPoint2.X, YRES, 255, 255, 255, 120);
|
||||||
|
|
||||||
|
std::stringstream info;
|
||||||
|
info << drawPoint2.X << " x " << drawPoint2.Y;
|
||||||
|
g->drawtext_outline(drawPoint2.X+(drawPoint2.X>drawPoint1.X?3:-g->textwidth(info.str().c_str())-3), drawPoint2.Y+(drawPoint2.Y<drawPoint1.Y?-10:3), info.str().c_str(), 255, 255, 255, 200);
|
||||||
|
|
||||||
|
info.str("");
|
||||||
|
info << drawPoint1.X << " x " << drawPoint1.Y;
|
||||||
|
g->drawtext_outline(drawPoint1.X+(drawPoint2.X<drawPoint1.X?3:-g->textwidth(info.str().c_str())-2), drawPoint1.Y+(drawPoint2.Y>drawPoint1.Y?-10:3), info.str().c_str(), 255, 255, 255, 200);
|
||||||
|
|
||||||
|
info.str("");
|
||||||
|
info << std::abs(drawPoint2.X-drawPoint1.X);
|
||||||
|
g->drawtext_outline((drawPoint1.X+drawPoint2.X)/2-g->textwidth(info.str().c_str())/2, drawPoint1.Y+(drawPoint2.Y>drawPoint1.Y?-10:3), info.str().c_str(), 255, 255, 255, 200);
|
||||||
|
|
||||||
|
info.str("");
|
||||||
|
info << std::abs(drawPoint2.Y-drawPoint1.Y);
|
||||||
|
g->drawtext_outline(drawPoint1.X+(drawPoint2.X<drawPoint1.X?3:-g->textwidth(info.str().c_str())-2), (drawPoint1.Y+drawPoint2.Y)/2-3, info.str().c_str(), 255, 255, 255, 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugLines::~DebugLines()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
15
src/debug/DebugLines.h
Normal file
15
src/debug/DebugLines.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "DebugInfo.h"
|
||||||
|
|
||||||
|
class GameView;
|
||||||
|
class GameController;
|
||||||
|
class DebugLines : public DebugInfo
|
||||||
|
{
|
||||||
|
GameView * view;
|
||||||
|
GameController * controller;
|
||||||
|
public:
|
||||||
|
DebugLines(unsigned int id, GameView * view, GameController * controller);
|
||||||
|
virtual void Draw();
|
||||||
|
virtual ~DebugLines();
|
||||||
|
};
|
55
src/debug/DebugParts.cpp
Normal file
55
src/debug/DebugParts.cpp
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#include "DebugParts.h"
|
||||||
|
#include "gui/interface/Engine.h"
|
||||||
|
#include "simulation/Simulation.h"
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
DebugParts::DebugParts(unsigned int id, Simulation * sim):
|
||||||
|
DebugInfo(id),
|
||||||
|
sim(sim)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugParts::Draw()
|
||||||
|
{
|
||||||
|
Graphics * g = ui::Engine::Ref().g;
|
||||||
|
|
||||||
|
int x = 0, y = 0, lpx = 0, lpy = 0;
|
||||||
|
std::stringstream info;
|
||||||
|
info << sim->parts_lastActiveIndex << "/" << NPART << " (" << std::fixed << std::setprecision(2) << (float)sim->parts_lastActiveIndex/(NPART)*100.0f << "%)";
|
||||||
|
for (int i = 0; i < NPART; i++)
|
||||||
|
{
|
||||||
|
if (sim->parts[i].type)
|
||||||
|
g->addpixel(x, y, 255, 255, 255, 180);
|
||||||
|
else
|
||||||
|
g->addpixel(x, y, 0, 0, 0, 180);
|
||||||
|
|
||||||
|
if (i == sim->parts_lastActiveIndex)
|
||||||
|
{
|
||||||
|
lpx = x;
|
||||||
|
lpy = y;
|
||||||
|
}
|
||||||
|
x++;
|
||||||
|
if(x >= XRES)
|
||||||
|
{
|
||||||
|
y++;
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g->draw_line(0, lpy, XRES, lpy, 0, 255, 120, 255);
|
||||||
|
g->draw_line(lpx, 0, lpx, YRES, 0, 255, 120, 255);
|
||||||
|
g->addpixel(lpx, lpy, 255, 50, 50, 220);
|
||||||
|
|
||||||
|
g->addpixel(lpx+1, lpy, 255, 50, 50, 120);
|
||||||
|
g->addpixel(lpx-1, lpy, 255, 50, 50, 120);
|
||||||
|
g->addpixel(lpx, lpy+1, 255, 50, 50, 120);
|
||||||
|
g->addpixel(lpx, lpy-1, 255, 50, 50, 120);
|
||||||
|
|
||||||
|
g->fillrect(7, YRES-26, g->textwidth(info.str().c_str())+5, 14, 0, 0, 0, 180);
|
||||||
|
g->drawtext(10, YRES-22, info.str().c_str(), 255, 255, 255, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugParts::~DebugParts()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
13
src/debug/DebugParts.h
Normal file
13
src/debug/DebugParts.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "DebugInfo.h"
|
||||||
|
|
||||||
|
class Simulation;
|
||||||
|
class DebugParts : public DebugInfo
|
||||||
|
{
|
||||||
|
Simulation * sim;
|
||||||
|
public:
|
||||||
|
DebugParts(unsigned int id, Simulation * sim);
|
||||||
|
virtual void Draw();
|
||||||
|
virtual ~DebugParts();
|
||||||
|
};
|
@ -3,17 +3,17 @@
|
|||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
|
|
||||||
ElementPopulationDebug::ElementPopulationDebug(Simulation * sim):
|
ElementPopulationDebug::ElementPopulationDebug(unsigned int id, Simulation * sim):
|
||||||
|
DebugInfo(id),
|
||||||
sim(sim),
|
sim(sim),
|
||||||
maxAverage(255.0f)
|
maxAverage(255.0f)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElementPopulationDebug::Draw(ui::Point position)
|
void ElementPopulationDebug::Draw()
|
||||||
{
|
{
|
||||||
Graphics * g = ui::Engine::Ref().g;
|
Graphics * g = ui::Engine::Ref().g;
|
||||||
//g->drawtext(10, 10, "Arse", 255, 255, 255, 255);
|
|
||||||
|
|
||||||
int yBottom = YRES-10;
|
int yBottom = YRES-10;
|
||||||
int xStart = 10;
|
int xStart = 10;
|
||||||
|
@ -8,7 +8,7 @@ class ElementPopulationDebug : public DebugInfo
|
|||||||
Simulation * sim;
|
Simulation * sim;
|
||||||
float maxAverage;
|
float maxAverage;
|
||||||
public:
|
public:
|
||||||
ElementPopulationDebug(Simulation * sim);
|
ElementPopulationDebug(unsigned int id, Simulation * sim);
|
||||||
virtual void Draw(ui::Point position);
|
virtual void Draw();
|
||||||
virtual ~ElementPopulationDebug();
|
virtual ~ElementPopulationDebug();
|
||||||
};
|
};
|
||||||
|
@ -26,12 +26,14 @@
|
|||||||
#include "gui/interface/Keys.h"
|
#include "gui/interface/Keys.h"
|
||||||
#include "simulation/Snapshot.h"
|
#include "simulation/Snapshot.h"
|
||||||
#include "debug/DebugInfo.h"
|
#include "debug/DebugInfo.h"
|
||||||
|
#include "debug/DebugParts.h"
|
||||||
|
#include "debug/ElementPopulation.h"
|
||||||
|
#include "debug/DebugLines.h"
|
||||||
#ifdef LUACONSOLE
|
#ifdef LUACONSOLE
|
||||||
#include "lua/LuaScriptInterface.h"
|
#include "lua/LuaScriptInterface.h"
|
||||||
#else
|
#else
|
||||||
#include "lua/TPTScriptInterface.h"
|
#include "lua/TPTScriptInterface.h"
|
||||||
#endif
|
#endif
|
||||||
//#include "debug/ElementPopulation.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -152,10 +154,11 @@ GameController::GameController():
|
|||||||
ActiveToolChanged(2, gameModel->GetActiveTool(2));
|
ActiveToolChanged(2, gameModel->GetActiveTool(2));
|
||||||
ActiveToolChanged(3, gameModel->GetActiveTool(3));
|
ActiveToolChanged(3, gameModel->GetActiveTool(3));
|
||||||
|
|
||||||
//sim = new Simulation();
|
|
||||||
Client::Ref().AddListener(this);
|
Client::Ref().AddListener(this);
|
||||||
|
|
||||||
//debugInfo.push_back(new ElementPopulationDebug(gameModel->GetSimulation()));
|
debugInfo.push_back(new DebugParts(0x1, gameModel->GetSimulation()));
|
||||||
|
debugInfo.push_back(new ElementPopulationDebug(0x2, gameModel->GetSimulation()));
|
||||||
|
debugInfo.push_back(new DebugLines(0x4, gameView, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
GameController::~GameController()
|
GameController::~GameController()
|
||||||
@ -741,7 +744,8 @@ void GameController::Tick()
|
|||||||
}
|
}
|
||||||
for(std::vector<DebugInfo*>::iterator iter = debugInfo.begin(), end = debugInfo.end(); iter != end; iter++)
|
for(std::vector<DebugInfo*>::iterator iter = debugInfo.begin(), end = debugInfo.end(); iter != end; iter++)
|
||||||
{
|
{
|
||||||
(*iter)->Draw(ui::Point(10, 10));
|
if ((*iter)->ID & debugFlags)
|
||||||
|
(*iter)->Draw();
|
||||||
}
|
}
|
||||||
commandInterface->OnTick();
|
commandInterface->OnTick();
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ private:
|
|||||||
OptionsController * options;
|
OptionsController * options;
|
||||||
CommandInterface * commandInterface;
|
CommandInterface * commandInterface;
|
||||||
vector<DebugInfo*> debugInfo;
|
vector<DebugInfo*> debugInfo;
|
||||||
|
unsigned int debugFlags;
|
||||||
public:
|
public:
|
||||||
bool HasDone;
|
bool HasDone;
|
||||||
class SearchCallback;
|
class SearchCallback;
|
||||||
@ -101,6 +102,7 @@ public:
|
|||||||
bool GetHudEnable();
|
bool GetHudEnable();
|
||||||
void SetDebugHUD(bool hudState);
|
void SetDebugHUD(bool hudState);
|
||||||
bool GetDebugHUD();
|
bool GetDebugHUD();
|
||||||
|
void SetDebugFlags(unsigned int flags) { debugFlags = flags; }
|
||||||
void SetActiveMenu(int menuID);
|
void SetActiveMenu(int menuID);
|
||||||
std::vector<Menu*> GetMenuList();
|
std::vector<Menu*> GetMenuList();
|
||||||
Tool * GetActiveTool(int selection);
|
Tool * GetActiveTool(int selection);
|
||||||
|
@ -113,8 +113,6 @@ private:
|
|||||||
|
|
||||||
int lastOffset;
|
int lastOffset;
|
||||||
void setToolButtonOffset(int offset);
|
void setToolButtonOffset(int offset);
|
||||||
virtual ui::Point lineSnapCoords(ui::Point point1, ui::Point point2);
|
|
||||||
virtual ui::Point rectSnapCoords(ui::Point point1, ui::Point point2);
|
|
||||||
|
|
||||||
void screenshot();
|
void screenshot();
|
||||||
void record();
|
void record();
|
||||||
@ -145,6 +143,14 @@ public:
|
|||||||
SelectMode GetSelectMode() { return selectMode; }
|
SelectMode GetSelectMode() { return selectMode; }
|
||||||
void BeginStampSelection();
|
void BeginStampSelection();
|
||||||
|
|
||||||
|
//all of these are only here for one debug lines
|
||||||
|
bool GetDrawingLine() { return drawMode == DrawLine && isMouseDown; }
|
||||||
|
bool GetDrawSnap() { return drawSnap; }
|
||||||
|
ui::Point GetLineStartCoords() { return drawPoint1; }
|
||||||
|
ui::Point GetLineFinishCoords() { return currentMouse; }
|
||||||
|
ui::Point lineSnapCoords(ui::Point point1, ui::Point point2);
|
||||||
|
ui::Point rectSnapCoords(ui::Point point1, ui::Point point2);
|
||||||
|
|
||||||
void AttachController(GameController * _c){ c = _c; }
|
void AttachController(GameController * _c){ c = _c; }
|
||||||
void NotifyRendererChanged(GameModel * sender);
|
void NotifyRendererChanged(GameModel * sender);
|
||||||
void NotifySimulationChanged(GameModel * sender);
|
void NotifySimulationChanged(GameModel * sender);
|
||||||
|
@ -215,7 +215,7 @@ OptionsView::OptionsView():
|
|||||||
{
|
{
|
||||||
//one of these should always be defined
|
//one of these should always be defined
|
||||||
#ifdef WIN
|
#ifdef WIN
|
||||||
const char* openCommand = "start ";
|
const char* openCommand = "explorer ";
|
||||||
#elif MACOSX
|
#elif MACOSX
|
||||||
const char* openCommand = "open ";
|
const char* openCommand = "open ";
|
||||||
//#elif LIN
|
//#elif LIN
|
||||||
|
@ -1885,7 +1885,9 @@ int luatpt_setfire(lua_State* l)
|
|||||||
|
|
||||||
int luatpt_setdebug(lua_State* l)
|
int luatpt_setdebug(lua_State* l)
|
||||||
{
|
{
|
||||||
return luaL_error(l, "setdebug: Deprecated"); //TODO: maybe use the debugInfo thing in GameController to implement this
|
int debugFlags = luaL_optint(l, 1, 0);
|
||||||
|
luacon_controller->SetDebugFlags(debugFlags);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int luatpt_setfpscap(lua_State* l)
|
int luatpt_setfpscap(lua_State* l)
|
||||||
|
@ -28,7 +28,7 @@ Element_PIPE::Element_PIPE()
|
|||||||
|
|
||||||
Temperature = 273.15f;
|
Temperature = 273.15f;
|
||||||
HeatConduct = 0;
|
HeatConduct = 0;
|
||||||
Description = "PIPE, moves particles around. Once the BRCK generates, erase some for the exit. Then the PIPE generates and is useable.";
|
Description = "PIPE, moves particles around. Once the BRCK generates, erase some for the exit. Then the PIPE generates and is usable.";
|
||||||
|
|
||||||
State = ST_SOLID;
|
State = ST_SOLID;
|
||||||
Properties = TYPE_SOLID|PROP_LIFE_DEC;
|
Properties = TYPE_SOLID|PROP_LIFE_DEC;
|
||||||
|
Loading…
Reference in New Issue
Block a user