Flatten include trees
This commit is contained in:
parent
711453ad65
commit
0179cefc78
@ -12,7 +12,7 @@ def generateElements(elementFiles, outputCpp, outputH):
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "simulation/Element.h"
|
#include "simulation/SimulationData.h"
|
||||||
#include "simulation/elements/Element.h"
|
#include "simulation/elements/Element.h"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -106,7 +106,8 @@ std::vector<Element> GetElements();
|
|||||||
#endif
|
#endif
|
||||||
"""
|
"""
|
||||||
|
|
||||||
elementContent = """#include "ElementClasses.h"
|
elementContent = """#include "simulation/ElementDefs.h"
|
||||||
|
#include "ElementClasses.h"
|
||||||
|
|
||||||
std::vector<Element> GetElements()
|
std::vector<Element> GetElements()
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
|
#include "Format.h"
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include "common/String.h"
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
#include <cstring>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include "Format.h"
|
|
||||||
#include "graphics/Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
ByteString format::URLEncode(ByteString source)
|
ByteString format::URLEncode(ByteString source)
|
||||||
|
11
src/Misc.cpp
11
src/Misc.cpp
@ -1,11 +1,12 @@
|
|||||||
#include <cstdio>
|
#include "Misc.h"
|
||||||
#include <cstdlib>
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "icondoc.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "Config.h"
|
|
||||||
#include "Misc.h"
|
|
||||||
#include "icondoc.h"
|
|
||||||
#include "common/tpt-minmax.h"
|
#include "common/tpt-minmax.h"
|
||||||
|
|
||||||
//Signum function
|
//Signum function
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include "Platform.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -15,7 +17,7 @@
|
|||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
#endif
|
#endif
|
||||||
#include "Platform.h"
|
|
||||||
#include "Misc.h"
|
#include "Misc.h"
|
||||||
|
|
||||||
namespace Platform
|
namespace Platform
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/String.h"
|
||||||
|
|
||||||
void EngineProcess();
|
void EngineProcess();
|
||||||
void ClipboardPush(ByteString text);
|
void ClipboardPush(ByteString text);
|
||||||
ByteString ClipboardPull();
|
ByteString ClipboardPull();
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#if defined(RENDERER)
|
#if defined(RENDERER)
|
||||||
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
#include "graphics/Renderer.h"
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -9,8 +12,6 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
#include "gui/interface/Engine.h"
|
#include "gui/interface/Engine.h"
|
||||||
#include "graphics/Graphics.h"
|
|
||||||
#include "graphics/Renderer.h"
|
|
||||||
|
|
||||||
#include "client/GameSave.h"
|
#include "client/GameSave.h"
|
||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef RENDERER
|
#ifndef RENDERER
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "common/String.h"
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#ifdef WIN
|
#ifdef WIN
|
||||||
@ -18,7 +17,6 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "graphics/Graphics.h"
|
|
||||||
#if defined(LIN)
|
#if defined(LIN)
|
||||||
#include "icon.h"
|
#include "icon.h"
|
||||||
#endif
|
#endif
|
||||||
@ -34,22 +32,23 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
|
#include "Misc.h"
|
||||||
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
|
#include "client/SaveInfo.h"
|
||||||
#include "client/GameSave.h"
|
#include "client/GameSave.h"
|
||||||
#include "client/SaveFile.h"
|
#include "client/SaveFile.h"
|
||||||
#include "simulation/SaveRenderer.h"
|
|
||||||
#include "client/Client.h"
|
#include "client/Client.h"
|
||||||
#include "Misc.h"
|
|
||||||
|
|
||||||
#include "gui/game/GameController.h"
|
#include "gui/game/GameController.h"
|
||||||
#include "gui/game/GameView.h"
|
#include "gui/game/GameView.h"
|
||||||
|
|
||||||
#include "gui/font/FontEditor.h"
|
#include "gui/font/FontEditor.h"
|
||||||
|
|
||||||
#include "gui/dialogues/ErrorMessage.h"
|
#include "gui/dialogues/ErrorMessage.h"
|
||||||
#include "gui/dialogues/ConfirmPrompt.h"
|
#include "gui/dialogues/ConfirmPrompt.h"
|
||||||
#include "gui/interface/Keys.h"
|
#include "gui/interface/Keys.h"
|
||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
|
#include "gui/interface/Engine.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -13,9 +13,10 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Probability.h"
|
||||||
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "Probability.h"
|
|
||||||
#include "common/tpt-rand.h"
|
#include "common/tpt-rand.h"
|
||||||
|
|
||||||
namespace Probability
|
namespace Probability
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include "Update.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#ifndef WIN
|
#ifndef WIN
|
||||||
@ -21,7 +23,6 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Update.h"
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
// returns 1 on failure, 0 on success
|
// returns 1 on failure, 0 on success
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
|
#include "Client.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <deque>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
@ -28,25 +29,23 @@
|
|||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
#include "Client.h"
|
|
||||||
#include "MD5.h"
|
#include "MD5.h"
|
||||||
#include "graphics/Graphics.h"
|
|
||||||
#include "Misc.h"
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Update.h"
|
#include "Update.h"
|
||||||
|
|
||||||
#include "simulation/SaveRenderer.h"
|
#include "ClientListener.h"
|
||||||
#include "gui/interface/Point.h"
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
|
#include "gui/preview/Comment.h"
|
||||||
|
|
||||||
#include "client/SaveInfo.h"
|
#include "client/SaveInfo.h"
|
||||||
#include "client/SaveFile.h"
|
#include "client/SaveFile.h"
|
||||||
#include "client/GameSave.h"
|
#include "client/GameSave.h"
|
||||||
#include "client/UserInfo.h"
|
#include "client/UserInfo.h"
|
||||||
#include "gui/preview/Comment.h"
|
|
||||||
#include "ClientListener.h"
|
|
||||||
#include "client/http/Request.h"
|
#include "client/http/Request.h"
|
||||||
#include "client/http/RequestManager.h"
|
#include "client/http/RequestManager.h"
|
||||||
|
|
||||||
#include "json/json.h"
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
#ifndef CLIENT_H
|
#ifndef CLIENT_H
|
||||||
#define CLIENT_H
|
#define CLIENT_H
|
||||||
|
|
||||||
#include <queue>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#include "Config.h"
|
|
||||||
#include "common/Singleton.h"
|
#include "common/Singleton.h"
|
||||||
|
#include "json/json.h"
|
||||||
|
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include "UserInfo.h"
|
|
||||||
|
|
||||||
#include "json/json.h"
|
|
||||||
|
|
||||||
class SaveInfo;
|
class SaveInfo;
|
||||||
class SaveFile;
|
class SaveFile;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef CLIENTLISTENER_H_
|
#ifndef CLIENTLISTENER_H_
|
||||||
#define CLIENTLISTENER_H_
|
#define CLIENTLISTENER_H_
|
||||||
|
|
||||||
|
#include "common/String.h"
|
||||||
|
|
||||||
class Client;
|
class Client;
|
||||||
class ClientListener
|
class ClientListener
|
||||||
{
|
{
|
||||||
|
@ -1,18 +1,20 @@
|
|||||||
#include "common/tpt-minmax.h"
|
#include "GameSave.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <bzlib.h>
|
#include <bzlib.h>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
#include "GameSave.h"
|
|
||||||
#include "simulation/SimulationData.h"
|
|
||||||
#include "ElementClasses.h"
|
|
||||||
#include "hmap.h"
|
#include "hmap.h"
|
||||||
|
|
||||||
|
#include "simulation/Simulation.h"
|
||||||
|
#include "ElementClasses.h"
|
||||||
|
|
||||||
GameSave::GameSave(GameSave & save):
|
GameSave::GameSave(GameSave & save):
|
||||||
majorVersion(save.majorVersion),
|
majorVersion(save.majorVersion),
|
||||||
waterEEnabled(save.waterEEnabled),
|
waterEEnabled(save.waterEEnabled),
|
||||||
@ -2785,3 +2787,19 @@ GameSave::~GameSave()
|
|||||||
{
|
{
|
||||||
dealloc();
|
dealloc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameSave& GameSave::operator << (Particle &v)
|
||||||
|
{
|
||||||
|
if(particlesCount<NPART && v.type)
|
||||||
|
{
|
||||||
|
particles[particlesCount++] = v;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameSave& GameSave::operator << (sign &v)
|
||||||
|
{
|
||||||
|
if(signs.size()<MAXSIGNS && v.text.length())
|
||||||
|
signs.push_back(v);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
@ -8,10 +8,9 @@
|
|||||||
|
|
||||||
#include "bson/BSON.h"
|
#include "bson/BSON.h"
|
||||||
#include "json/json.h"
|
#include "json/json.h"
|
||||||
#include "simulation/Sign.h"
|
|
||||||
#include "simulation/Particle.h"
|
|
||||||
|
|
||||||
//using namespace std;
|
struct sign;
|
||||||
|
struct Particle;
|
||||||
|
|
||||||
struct ParseException: public std::exception {
|
struct ParseException: public std::exception {
|
||||||
enum ParseResult { OK = 0, Corrupt, WrongVersion, InvalidDimensions, InternalError, MissingElement };
|
enum ParseResult { OK = 0, Corrupt, WrongVersion, InvalidDimensions, InternalError, MissingElement };
|
||||||
@ -134,21 +133,8 @@ public:
|
|||||||
static bool TypeInTmp(int type);
|
static bool TypeInTmp(int type);
|
||||||
static bool TypeInTmp2(int type, int tmp2);
|
static bool TypeInTmp2(int type, int tmp2);
|
||||||
|
|
||||||
inline GameSave& operator << (Particle v)
|
GameSave& operator << (Particle &v);
|
||||||
{
|
GameSave& operator << (sign &v);
|
||||||
if(particlesCount<NPART && v.type)
|
|
||||||
{
|
|
||||||
particles[particlesCount++] = v;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline GameSave& operator << (sign v)
|
|
||||||
{
|
|
||||||
if(signs.size()<MAXSIGNS && v.text.length())
|
|
||||||
signs.push_back(v);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool expanded;
|
bool expanded;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "SaveFile.h"
|
#include "SaveFile.h"
|
||||||
#include "GameSave.h"
|
#include "GameSave.h"
|
||||||
#include "Client.h"
|
|
||||||
|
|
||||||
SaveFile::SaveFile(SaveFile & save):
|
SaveFile::SaveFile(SaveFile & save):
|
||||||
gameSave(NULL),
|
gameSave(NULL),
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "SaveInfo.h"
|
#include "SaveInfo.h"
|
||||||
#include "GameSave.h"
|
#include "GameSave.h"
|
||||||
#include "Client.h"
|
|
||||||
|
|
||||||
SaveInfo::SaveInfo(SaveInfo & save):
|
SaveInfo::SaveInfo(SaveInfo & save):
|
||||||
id(save.id),
|
id(save.id),
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
#define SAVE_H
|
#define SAVE_H
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
|
||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#include <cstdlib>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#ifdef GetUserName
|
#ifdef GetUserName
|
||||||
# undef GetUserName // dammit windows
|
# undef GetUserName // dammit windows
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "AvatarRequest.h"
|
#include "AvatarRequest.h"
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
namespace http
|
namespace http
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#define AVATARREQUEST2_H
|
#define AVATARREQUEST2_H
|
||||||
|
|
||||||
#include "ImageRequest.h"
|
#include "ImageRequest.h"
|
||||||
#include "common/String.h"
|
|
||||||
|
|
||||||
namespace http
|
namespace http
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#include "GetUserInfoRequest.h"
|
#include "GetUserInfoRequest.h"
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "client/UserInfo.h"
|
||||||
|
|
||||||
namespace http
|
namespace http
|
||||||
{
|
{
|
||||||
GetUserInfoRequest::GetUserInfoRequest(ByteString username) :
|
GetUserInfoRequest::GetUserInfoRequest(ByteString username) :
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
#ifndef GETUSERINFOREQUEST2_H
|
#ifndef GETUSERINFOREQUEST2_H
|
||||||
#define GETUSERINFOREQUEST2_H
|
#define GETUSERINFOREQUEST2_H
|
||||||
|
|
||||||
#include "Request.h"
|
|
||||||
#include "common/String.h"
|
|
||||||
#include "json/json.h"
|
|
||||||
#include "client/Client.h"
|
|
||||||
#include "APIRequest.h"
|
#include "APIRequest.h"
|
||||||
|
|
||||||
#include <memory>
|
class UserInfo;
|
||||||
#include <map>
|
|
||||||
|
|
||||||
namespace http
|
namespace http
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class VideoBuffer;
|
class VideoBuffer;
|
||||||
|
|
||||||
namespace http
|
namespace http
|
||||||
{
|
{
|
||||||
class ImageRequest : public Request
|
class ImageRequest : public Request
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "Request.h"
|
#include "Request.h"
|
||||||
|
|
||||||
#include "RequestManager.h"
|
#include "RequestManager.h"
|
||||||
#include "Platform.h"
|
|
||||||
|
|
||||||
namespace http
|
namespace http
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include "RequestManager.h"
|
#include "RequestManager.h"
|
||||||
#include "Request.h"
|
|
||||||
#include "Config.h"
|
|
||||||
#include "Platform.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "Request.h"
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
const int curl_multi_wait_timeout_ms = 100;
|
const int curl_multi_wait_timeout_ms = 100;
|
||||||
const long curl_max_host_connections = 6;
|
const long curl_max_host_connections = 6;
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <ctime>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include "common/Singleton.h"
|
#include "common/Singleton.h"
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
#include "SaveUserInfoRequest.h"
|
#include "SaveUserInfoRequest.h"
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "client/UserInfo.h"
|
||||||
|
|
||||||
namespace http
|
namespace http
|
||||||
{
|
{
|
||||||
SaveUserInfoRequest::SaveUserInfoRequest(UserInfo info) :
|
SaveUserInfoRequest::SaveUserInfoRequest(UserInfo &info) :
|
||||||
APIRequest(SCHEME SERVER "/Profile.json")
|
APIRequest(SCHEME SERVER "/Profile.json")
|
||||||
{
|
{
|
||||||
AddPostData({
|
AddPostData({
|
||||||
|
@ -1,21 +1,16 @@
|
|||||||
#ifndef SAVEUSERINFOREQUEST2_H
|
#ifndef SAVEUSERINFOREQUEST2_H
|
||||||
#define SAVEUSERINFOREQUEST2_H
|
#define SAVEUSERINFOREQUEST2_H
|
||||||
|
|
||||||
#include "Request.h"
|
|
||||||
#include "common/String.h"
|
|
||||||
#include "json/json.h"
|
|
||||||
#include "client/Client.h"
|
|
||||||
#include "APIRequest.h"
|
#include "APIRequest.h"
|
||||||
|
|
||||||
#include <memory>
|
class UserInfo;
|
||||||
#include <map>
|
|
||||||
|
|
||||||
namespace http
|
namespace http
|
||||||
{
|
{
|
||||||
class SaveUserInfoRequest : public APIRequest
|
class SaveUserInfoRequest : public APIRequest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SaveUserInfoRequest(UserInfo info);
|
SaveUserInfoRequest(UserInfo &info);
|
||||||
virtual ~SaveUserInfoRequest();
|
virtual ~SaveUserInfoRequest();
|
||||||
|
|
||||||
bool Finish();
|
bool Finish();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "ThumbnailRequest.h"
|
#include "ThumbnailRequest.h"
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
namespace http
|
namespace http
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#define THUMBNAILREQUEST2_H
|
#define THUMBNAILREQUEST2_H
|
||||||
|
|
||||||
#include "ImageRequest.h"
|
#include "ImageRequest.h"
|
||||||
#include "common/String.h"
|
|
||||||
|
|
||||||
namespace http
|
namespace http
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "gui/interface/Point.h"
|
#include "gui/interface/Point.h"
|
||||||
#include "common/tpt-compat.h"
|
|
||||||
|
|
||||||
class DebugInfo
|
class DebugInfo
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
#include "DebugLines.h"
|
#include "DebugLines.h"
|
||||||
|
|
||||||
#include "gui/game/GameView.h"
|
#include "gui/game/GameView.h"
|
||||||
|
|
||||||
#include "gui/game/GameController.h"
|
#include "gui/game/GameController.h"
|
||||||
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
DebugLines::DebugLines(unsigned int id, GameView * view, GameController * controller):
|
DebugLines::DebugLines(unsigned int id, GameView * view, GameController * controller):
|
||||||
DebugInfo(id),
|
DebugInfo(id),
|
||||||
view(view),
|
view(view),
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
#include <iomanip>
|
|
||||||
#include "DebugParts.h"
|
#include "DebugParts.h"
|
||||||
|
|
||||||
#include "gui/interface/Engine.h"
|
#include "gui/interface/Engine.h"
|
||||||
|
|
||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
DebugParts::DebugParts(unsigned int id, Simulation * sim):
|
DebugParts::DebugParts(unsigned int id, Simulation * sim):
|
||||||
DebugInfo(id),
|
DebugInfo(id),
|
||||||
sim(sim)
|
sim(sim)
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
#include "ElementPopulation.h"
|
#include "ElementPopulation.h"
|
||||||
|
|
||||||
#include "gui/interface/Engine.h"
|
#include "gui/interface/Engine.h"
|
||||||
|
|
||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
#include "Format.h"
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
ElementPopulationDebug::ElementPopulationDebug(unsigned int id, Simulation * sim):
|
ElementPopulationDebug::ElementPopulationDebug(unsigned int id, Simulation * sim):
|
||||||
DebugInfo(id),
|
DebugInfo(id),
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include "ParticleDebug.h"
|
#include "ParticleDebug.h"
|
||||||
#include "gui/interface/Engine.h"
|
|
||||||
#include "gui/game/GameView.h"
|
#include "gui/game/GameModel.h"
|
||||||
#include "gui/game/GameController.h"
|
|
||||||
|
#include "simulation/Simulation.h"
|
||||||
|
|
||||||
ParticleDebug::ParticleDebug(unsigned int id, Simulation * sim, GameModel * model):
|
ParticleDebug::ParticleDebug(unsigned int id, Simulation * sim, GameModel * model):
|
||||||
DebugInfo(id),
|
DebugInfo(id),
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
|
#include "Graphics.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
#include <bzlib.h>
|
#include <bzlib.h>
|
||||||
#include "common/String.h"
|
|
||||||
#include "Config.h"
|
|
||||||
#include "Misc.h"
|
|
||||||
#include "Graphics.h"
|
|
||||||
#include "FontReader.h"
|
#include "FontReader.h"
|
||||||
#ifdef HIGH_QUALITY_RESAMPLE
|
#ifdef HIGH_QUALITY_RESAMPLE
|
||||||
#include "resampler/resampler.h"
|
#include "resampler/resampler.h"
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
#define GRAPHICS_H
|
#define GRAPHICS_H
|
||||||
|
|
||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
|
||||||
#include <vector>
|
|
||||||
#if defined(OGLI)
|
#if defined(OGLI)
|
||||||
#include "OpenGLHeaders.h"
|
#include "OpenGLHeaders.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#include "Graphics.h"
|
#include "Graphics.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#ifndef OGLI
|
#ifndef OGLI
|
||||||
|
|
||||||
Graphics::Graphics():
|
Graphics::Graphics():
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include "Renderer.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
@ -6,15 +8,18 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Misc.h"
|
#include "Misc.h"
|
||||||
#include "Renderer.h"
|
|
||||||
#include "Graphics.h"
|
|
||||||
#include "common/tpt-compat.h"
|
|
||||||
#include "common/tpt-minmax.h"
|
|
||||||
#include "common/tpt-rand.h"
|
#include "common/tpt-rand.h"
|
||||||
|
#include "common/tpt-compat.h"
|
||||||
|
|
||||||
#include "gui/game/RenderPreset.h"
|
#include "gui/game/RenderPreset.h"
|
||||||
#include "simulation/Elements.h"
|
|
||||||
|
#include "simulation/Simulation.h"
|
||||||
#include "simulation/ElementGraphics.h"
|
#include "simulation/ElementGraphics.h"
|
||||||
#include "simulation/Air.h"
|
#include "simulation/Air.h"
|
||||||
|
#include "simulation/Gravity.h"
|
||||||
|
#include "ElementClasses.h"
|
||||||
|
|
||||||
#ifdef LUACONSOLE
|
#ifdef LUACONSOLE
|
||||||
#include "lua/LuaScriptInterface.h"
|
#include "lua/LuaScriptInterface.h"
|
||||||
#include "lua/LuaScriptHelper.h"
|
#include "lua/LuaScriptHelper.h"
|
||||||
|
@ -6,13 +6,12 @@
|
|||||||
#include "OpenGLHeaders.h"
|
#include "OpenGLHeaders.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Config.h"
|
|
||||||
#include "Graphics.h"
|
#include "Graphics.h"
|
||||||
|
#include "Config.h"
|
||||||
#include "gui/interface/Point.h"
|
#include "gui/interface/Point.h"
|
||||||
|
|
||||||
class RenderPreset;
|
class RenderPreset;
|
||||||
class Simulation;
|
class Simulation;
|
||||||
class Graphics;
|
|
||||||
|
|
||||||
struct gcache_item
|
struct gcache_item
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
#include "gui/interface/Colour.h"
|
|
||||||
|
|
||||||
namespace style {
|
namespace style {
|
||||||
ui::Colour Colour::InformationTitle = ui::Colour(140, 140, 255);
|
ui::Colour Colour::InformationTitle = ui::Colour(140, 140, 255);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef STYLE_H_
|
#ifndef STYLE_H_
|
||||||
#define STYLE_H_
|
#define STYLE_H_
|
||||||
|
|
||||||
namespace ui { class Colour; }
|
#include "gui/interface/Colour.h"
|
||||||
|
|
||||||
namespace style
|
namespace style
|
||||||
{
|
{
|
||||||
@ -20,6 +20,7 @@ namespace style
|
|||||||
static ui::Colour ActiveBackground;
|
static ui::Colour ActiveBackground;
|
||||||
static ui::Colour InactiveBackground;
|
static ui::Colour InactiveBackground;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Metrics
|
class Metrics
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
#include <algorithm>
|
|
||||||
#include <iomanip>
|
|
||||||
#include "ColourPickerActivity.h"
|
#include "ColourPickerActivity.h"
|
||||||
|
|
||||||
#include "gui/interface/Textbox.h"
|
#include "gui/interface/Textbox.h"
|
||||||
|
#include "gui/interface/Button.h"
|
||||||
#include "gui/interface/Label.h"
|
#include "gui/interface/Label.h"
|
||||||
#include "gui/interface/Keys.h"
|
#include "gui/interface/Keys.h"
|
||||||
#include "gui/game/Tool.h"
|
|
||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
#include "Format.h"
|
|
||||||
#include "gui/game/GameModel.h"
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
|
#include "Misc.h"
|
||||||
|
|
||||||
ColourPickerActivity::ColourPickerActivity(ui::Colour initialColour, ColourPickedCallback * callback) :
|
ColourPickerActivity::ColourPickerActivity(ui::Colour initialColour, ColourPickedCallback * callback) :
|
||||||
WindowActivity(ui::Point(-1, -1), ui::Point(266, 175)),
|
WindowActivity(ui::Point(-1, -1), ui::Point(266, 175)),
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#include "Activity.h"
|
#include "Activity.h"
|
||||||
#include "gui/interface/Window.h"
|
#include "gui/interface/Colour.h"
|
||||||
#include "gui/interface/Textbox.h"
|
|
||||||
|
namespace ui
|
||||||
|
{
|
||||||
|
class Textbox;
|
||||||
|
class Label;
|
||||||
|
}
|
||||||
|
|
||||||
class ColourPickedCallback
|
class ColourPickedCallback
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef CONSOLECOMMAND_H_
|
#ifndef CONSOLECOMMAND_H_
|
||||||
#define CONSOLECOMMAND_H_
|
#define CONSOLECOMMAND_H_
|
||||||
|
|
||||||
|
#include "common/String.h"
|
||||||
|
|
||||||
class ConsoleCommand
|
class ConsoleCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
#include <stack>
|
|
||||||
#include "ConsoleController.h"
|
#include "ConsoleController.h"
|
||||||
|
|
||||||
|
#include "Controller.h"
|
||||||
|
#include "ConsoleView.h"
|
||||||
|
#include "ConsoleModel.h"
|
||||||
|
#include "ConsoleCommand.h"
|
||||||
|
|
||||||
|
#include "lua/CommandInterface.h"
|
||||||
|
|
||||||
ConsoleController::ConsoleController(ControllerCallback * callback, CommandInterface * commandInterface):
|
ConsoleController::ConsoleController(ControllerCallback * callback, CommandInterface * commandInterface):
|
||||||
HasDone(false)
|
HasDone(false)
|
||||||
{
|
{
|
||||||
|
@ -2,15 +2,13 @@
|
|||||||
#define CONSOLECONTROLLER_H_
|
#define CONSOLECONTROLLER_H_
|
||||||
|
|
||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#include "Controller.h"
|
|
||||||
#include "ConsoleView.h"
|
|
||||||
#include "ConsoleModel.h"
|
|
||||||
#include "ConsoleCommand.h"
|
|
||||||
#include "lua/CommandInterface.h"
|
|
||||||
|
|
||||||
|
class CommandInterface;
|
||||||
class ConsoleModel;
|
class ConsoleModel;
|
||||||
class ConsoleView;
|
class ConsoleView;
|
||||||
class ConsoleController {
|
class ControllerCallback;
|
||||||
|
class ConsoleController
|
||||||
|
{
|
||||||
ControllerCallback * callback;
|
ControllerCallback * callback;
|
||||||
ConsoleView * consoleView;
|
ConsoleView * consoleView;
|
||||||
ConsoleModel * consoleModel;
|
ConsoleModel * consoleModel;
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#include "client/Client.h"
|
|
||||||
#include "ConsoleModel.h"
|
#include "ConsoleModel.h"
|
||||||
|
|
||||||
|
#include "ConsoleView.h"
|
||||||
|
|
||||||
|
#include "client/Client.h"
|
||||||
|
|
||||||
ConsoleModel::ConsoleModel() {
|
ConsoleModel::ConsoleModel() {
|
||||||
std::vector<String> previousHistory = Client::Ref().GetPrefStringArray("Console.History");
|
std::vector<String> previousHistory = Client::Ref().GetPrefStringArray("Console.History");
|
||||||
for(std::vector<String>::reverse_iterator iter = previousHistory.rbegin(), end = previousHistory.rend(); iter != end; ++iter)
|
for(std::vector<String>::reverse_iterator iter = previousHistory.rbegin(), end = previousHistory.rend(); iter != end; ++iter)
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include "ConsoleView.h"
|
|
||||||
#include "ConsoleCommand.h"
|
#include "ConsoleCommand.h"
|
||||||
|
|
||||||
class ConsoleView;
|
class ConsoleView;
|
||||||
class ConsoleModel {
|
class ConsoleModel
|
||||||
|
{
|
||||||
size_t currentCommandIndex;
|
size_t currentCommandIndex;
|
||||||
std::vector<ConsoleView*> observers;
|
std::vector<ConsoleView*> observers;
|
||||||
std::deque<ConsoleCommand> previousCommands;
|
std::deque<ConsoleCommand> previousCommands;
|
||||||
|
@ -1,5 +1,19 @@
|
|||||||
#include "ConsoleView.h"
|
#include "ConsoleView.h"
|
||||||
|
|
||||||
|
#include "ConsoleController.h"
|
||||||
|
#include "ConsoleModel.h"
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
#include "ConsoleCommand.h"
|
||||||
|
|
||||||
#include "gui/interface/Keys.h"
|
#include "gui/interface/Keys.h"
|
||||||
|
#include "gui/interface/Label.h"
|
||||||
|
#include "gui/interface/Textbox.h"
|
||||||
|
|
||||||
ConsoleView::ConsoleView():
|
ConsoleView::ConsoleView():
|
||||||
ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, 150)),
|
ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, 150)),
|
||||||
|
@ -2,18 +2,18 @@
|
|||||||
#define CONSOLEVIEW_H_
|
#define CONSOLEVIEW_H_
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <queue>
|
|
||||||
#include "gui/interface/Label.h"
|
|
||||||
#include "gui/interface/Window.h"
|
#include "gui/interface/Window.h"
|
||||||
#include "ConsoleController.h"
|
|
||||||
#include "ConsoleModel.h"
|
|
||||||
#include "gui/interface/Textbox.h"
|
|
||||||
#include "ConsoleCommand.h"
|
|
||||||
|
|
||||||
|
namespace ui
|
||||||
|
{
|
||||||
|
class Label;
|
||||||
|
class Textbox;
|
||||||
|
}
|
||||||
|
|
||||||
class ConsoleController;
|
class ConsoleController;
|
||||||
class ConsoleModel;
|
class ConsoleModel;
|
||||||
class ConsoleView: public ui::Window {
|
class ConsoleView: public ui::Window
|
||||||
|
{
|
||||||
ConsoleController * c;
|
ConsoleController * c;
|
||||||
ui::Textbox * commandField;
|
ui::Textbox * commandField;
|
||||||
std::vector<ui::Label*> commandList;
|
std::vector<ui::Label*> commandList;
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
#include "ConfirmPrompt.h"
|
#include "ConfirmPrompt.h"
|
||||||
|
|
||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
|
|
||||||
#include "gui/interface/Button.h"
|
#include "gui/interface/Button.h"
|
||||||
#include "gui/interface/Engine.h"
|
#include "gui/interface/Engine.h"
|
||||||
#include "gui/interface/Label.h"
|
#include "gui/interface/Label.h"
|
||||||
#include "gui/interface/ScrollPanel.h"
|
#include "gui/interface/ScrollPanel.h"
|
||||||
|
|
||||||
#include "PowderToy.h"
|
#include "PowderToy.h"
|
||||||
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
ConfirmPrompt::ConfirmPrompt(String title, String message, ConfirmDialogueCallback * callback_):
|
ConfirmPrompt::ConfirmPrompt(String title, String message, ConfirmDialogueCallback * callback_):
|
||||||
ui::Window(ui::Point(-1, -1), ui::Point(250, 35)),
|
ui::Window(ui::Point(-1, -1), ui::Point(250, 35)),
|
||||||
callback(callback_)
|
callback(callback_)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef CONFIRMPROMPT_H_
|
#ifndef CONFIRMPROMPT_H_
|
||||||
#define CONFIRMPROMPT_H_
|
#define CONFIRMPROMPT_H_
|
||||||
|
|
||||||
#include "common/String.h"
|
|
||||||
#include "gui/interface/Window.h"
|
#include "gui/interface/Window.h"
|
||||||
|
|
||||||
class ConfirmDialogueCallback;
|
class ConfirmDialogueCallback;
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
#include "gui/Style.h"
|
|
||||||
#include "ErrorMessage.h"
|
#include "ErrorMessage.h"
|
||||||
|
|
||||||
|
#include "gui/Style.h"
|
||||||
|
|
||||||
#include "gui/interface/Button.h"
|
#include "gui/interface/Button.h"
|
||||||
#include "gui/interface/Engine.h"
|
#include "gui/interface/Engine.h"
|
||||||
#include "gui/interface/Label.h"
|
#include "gui/interface/Label.h"
|
||||||
|
|
||||||
#include "PowderToy.h"
|
#include "PowderToy.h"
|
||||||
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
ErrorMessage::ErrorMessage(String title, String message, ErrorMessageCallback * callback_):
|
ErrorMessage::ErrorMessage(String title, String message, ErrorMessageCallback * callback_):
|
||||||
ui::Window(ui::Point(-1, -1), ui::Point(200, 35)),
|
ui::Window(ui::Point(-1, -1), ui::Point(200, 35)),
|
||||||
callback(callback_)
|
callback(callback_)
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
#include "gui/Style.h"
|
|
||||||
#include "InformationMessage.h"
|
#include "InformationMessage.h"
|
||||||
|
|
||||||
|
#include "gui/Style.h"
|
||||||
#include "gui/interface/Button.h"
|
#include "gui/interface/Button.h"
|
||||||
#include "gui/interface/Engine.h"
|
#include "gui/interface/Engine.h"
|
||||||
#include "gui/interface/Label.h"
|
#include "gui/interface/Label.h"
|
||||||
#include "gui/interface/ScrollPanel.h"
|
#include "gui/interface/ScrollPanel.h"
|
||||||
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
InformationMessage::InformationMessage(String title, String message, bool large):
|
InformationMessage::InformationMessage(String title, String message, bool large):
|
||||||
ui::Window(ui::Point(-1, -1), ui::Point(200, 35))
|
ui::Window(ui::Point(-1, -1), ui::Point(200, 35))
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
#include "gui/Style.h"
|
|
||||||
#include "SaveIDMessage.h"
|
#include "SaveIDMessage.h"
|
||||||
|
|
||||||
|
#include "gui/Style.h"
|
||||||
|
|
||||||
#include "graphics/Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
#include "gui/interface/Button.h"
|
#include "gui/interface/Button.h"
|
||||||
#include "gui/interface/CopyTextButton.h"
|
#include "gui/interface/CopyTextButton.h"
|
||||||
#include "gui/interface/Label.h"
|
#include "gui/interface/Label.h"
|
||||||
|
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
|
|
||||||
SaveIDMessage::SaveIDMessage(int id):
|
SaveIDMessage::SaveIDMessage(int id):
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
#include <iostream>
|
|
||||||
#include "TextPrompt.h"
|
#include "TextPrompt.h"
|
||||||
|
|
||||||
#include "gui/interface/Label.h"
|
#include "gui/interface/Label.h"
|
||||||
#include "gui/interface/Button.h"
|
#include "gui/interface/Button.h"
|
||||||
#include "gui/interface/Engine.h"
|
#include "gui/interface/Engine.h"
|
||||||
|
#include "gui/interface/Textbox.h"
|
||||||
|
|
||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
#include "PowderToy.h"
|
#include "PowderToy.h"
|
||||||
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
class CloseAction: public ui::ButtonAction
|
class CloseAction: public ui::ButtonAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -2,10 +2,15 @@
|
|||||||
#define TEXTPROMPT_H_
|
#define TEXTPROMPT_H_
|
||||||
|
|
||||||
#include "gui/interface/Window.h"
|
#include "gui/interface/Window.h"
|
||||||
#include "gui/interface/Textbox.h"
|
|
||||||
|
namespace ui
|
||||||
|
{
|
||||||
|
class Textbox;
|
||||||
|
}
|
||||||
|
|
||||||
class TextDialogueCallback;
|
class TextDialogueCallback;
|
||||||
class TextPrompt: public ui::Window {
|
class TextPrompt: public ui::Window
|
||||||
|
{
|
||||||
protected:
|
protected:
|
||||||
ui::Textbox * textField;
|
ui::Textbox * textField;
|
||||||
public:
|
public:
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include <algorithm>
|
|
||||||
#include "common/String.h"
|
|
||||||
#include "ElementSearchActivity.h"
|
#include "ElementSearchActivity.h"
|
||||||
|
|
||||||
#include "gui/interface/Textbox.h"
|
#include "gui/interface/Textbox.h"
|
||||||
#include "gui/interface/Label.h"
|
#include "gui/interface/Label.h"
|
||||||
#include "gui/interface/Keys.h"
|
#include "gui/interface/Keys.h"
|
||||||
@ -8,6 +7,9 @@
|
|||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
#include "gui/game/Favorite.h"
|
#include "gui/game/Favorite.h"
|
||||||
#include "gui/game/GameController.h"
|
#include "gui/game/GameController.h"
|
||||||
|
#include "gui/game/ToolButton.h"
|
||||||
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
class ElementSearchActivity::ToolAction: public ui::ButtonAction
|
class ElementSearchActivity::ToolAction: public ui::ButtonAction
|
||||||
{
|
{
|
||||||
|
@ -3,13 +3,18 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Activity.h"
|
#include "Activity.h"
|
||||||
#include "gui/interface/Window.h"
|
#include "common/String.h"
|
||||||
#include "gui/interface/Textbox.h"
|
#include "gui/interface/Point.h"
|
||||||
#include "gui/game/ToolButton.h"
|
|
||||||
|
|
||||||
class Tool;
|
class Tool;
|
||||||
|
class ToolButton;
|
||||||
class GameController;
|
class GameController;
|
||||||
|
|
||||||
|
namespace ui
|
||||||
|
{
|
||||||
|
class Textbox;
|
||||||
|
}
|
||||||
|
|
||||||
class ElementSearchActivity: public WindowActivity
|
class ElementSearchActivity: public WindowActivity
|
||||||
{
|
{
|
||||||
Tool * firstResult;
|
Tool * firstResult;
|
||||||
|
@ -1,21 +1,24 @@
|
|||||||
#include <iostream>
|
|
||||||
#include <algorithm>
|
|
||||||
#include "FileBrowserActivity.h"
|
#include "FileBrowserActivity.h"
|
||||||
|
|
||||||
#include "gui/interface/Label.h"
|
#include "gui/interface/Label.h"
|
||||||
#include "gui/interface/Textbox.h"
|
#include "gui/interface/Textbox.h"
|
||||||
#include "gui/interface/ScrollPanel.h"
|
#include "gui/interface/ScrollPanel.h"
|
||||||
#include "gui/interface/SaveButton.h"
|
#include "gui/interface/SaveButton.h"
|
||||||
#include "gui/interface/ProgressBar.h"
|
#include "gui/interface/ProgressBar.h"
|
||||||
|
|
||||||
#include "client/Client.h"
|
#include "client/Client.h"
|
||||||
#include "client/SaveFile.h"
|
#include "client/SaveFile.h"
|
||||||
#include "client/GameSave.h"
|
#include "client/GameSave.h"
|
||||||
|
|
||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
#include "tasks/Task.h"
|
#include "tasks/Task.h"
|
||||||
#include "simulation/SaveRenderer.h"
|
|
||||||
#include "gui/dialogues/TextPrompt.h"
|
#include "gui/dialogues/TextPrompt.h"
|
||||||
#include "gui/dialogues/ConfirmPrompt.h"
|
#include "gui/dialogues/ConfirmPrompt.h"
|
||||||
#include "gui/dialogues/ErrorMessage.h"
|
#include "gui/dialogues/ErrorMessage.h"
|
||||||
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
class SaveSelectedAction: public ui::SaveButtonAction
|
class SaveSelectedAction: public ui::SaveButtonAction
|
||||||
{
|
{
|
||||||
FileBrowserActivity * a;
|
FileBrowserActivity * a;
|
||||||
|
@ -3,10 +3,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#include "Activity.h"
|
#include "Activity.h"
|
||||||
#include "gui/interface/Window.h"
|
|
||||||
#include "tasks/TaskListener.h"
|
#include "tasks/TaskListener.h"
|
||||||
|
|
||||||
|
|
||||||
class SaveFile;
|
class SaveFile;
|
||||||
class FileSelectedCallback
|
class FileSelectedCallback
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "FontEditor.h"
|
#include "FontEditor.h"
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
#include "gui/interface/Textbox.h"
|
||||||
#include "gui/interface/Engine.h"
|
#include "gui/interface/Engine.h"
|
||||||
#include "gui/interface/Point.h"
|
#include "gui/interface/Point.h"
|
||||||
#include "gui/interface/Button.h"
|
#include "gui/interface/Button.h"
|
||||||
|
@ -8,7 +8,13 @@
|
|||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
|
||||||
#include "gui/interface/Window.h"
|
#include "gui/interface/Window.h"
|
||||||
#include "gui/interface/Textbox.h"
|
|
||||||
|
namespace ui
|
||||||
|
{
|
||||||
|
class Textbox;
|
||||||
|
class Label;
|
||||||
|
class Button;
|
||||||
|
}
|
||||||
|
|
||||||
#define MAX_WIDTH 64
|
#define MAX_WIDTH 64
|
||||||
class FontEditor: public ui::Window
|
class FontEditor: public ui::Window
|
||||||
|
80
src/gui/game/BitmapBrush.cpp
Normal file
80
src/gui/game/BitmapBrush.cpp
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
#include "BitmapBrush.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include "Misc.h"
|
||||||
|
|
||||||
|
#include "common/tpt-minmax.h"
|
||||||
|
|
||||||
|
BitmapBrush::BitmapBrush(std::vector<unsigned char> newBitmap, ui::Point rectSize_):
|
||||||
|
Brush(ui::Point(0, 0)),
|
||||||
|
origSize(0, 0)
|
||||||
|
{
|
||||||
|
ui::Point newSize = rectSize_;
|
||||||
|
|
||||||
|
//Ensure the rect has odd dimensions so we can pull an integer radius with a 1x1 centre
|
||||||
|
if(!(newSize.X % 2))
|
||||||
|
newSize.X += 1;
|
||||||
|
if(!(newSize.Y % 2))
|
||||||
|
newSize.Y += 1;
|
||||||
|
|
||||||
|
radius = (newSize-ui::Point(1, 1))/2;
|
||||||
|
size = newSize;
|
||||||
|
origSize = size;
|
||||||
|
|
||||||
|
origBitmap = new unsigned char[size.X*size.Y];
|
||||||
|
std::fill(origBitmap, origBitmap+(size.X*size.Y), 0);
|
||||||
|
for(int y = 0; y < rectSize_.Y; y++)
|
||||||
|
{
|
||||||
|
for(int x = 0; x < rectSize_.X; x++)
|
||||||
|
{
|
||||||
|
if(newBitmap[(y*rectSize_.X)+x] >= 128)
|
||||||
|
origBitmap[(y*size.X)+x] = newBitmap[(y*rectSize_.X)+x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetRadius(radius);
|
||||||
|
};
|
||||||
|
|
||||||
|
void BitmapBrush::GenerateBitmap()
|
||||||
|
{
|
||||||
|
if(origBitmap)
|
||||||
|
{
|
||||||
|
delete[] bitmap;
|
||||||
|
bitmap = new unsigned char[size.X*size.Y];
|
||||||
|
if(size == origSize)
|
||||||
|
std::copy(origBitmap, origBitmap+(origSize.X*origSize.Y), bitmap);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Bilinear interpolation
|
||||||
|
float factorX = ((float)origSize.X)/((float)size.X);
|
||||||
|
float factorY = ((float)origSize.Y)/((float)size.Y);
|
||||||
|
for(int y = 0; y < size.Y; y++)
|
||||||
|
{
|
||||||
|
for(int x = 0; x < size.X; x++)
|
||||||
|
{
|
||||||
|
float originalY = ((float)y)*factorY;
|
||||||
|
float originalX = ((float)x)*factorX;
|
||||||
|
|
||||||
|
int lowerX = std::floor(originalX);
|
||||||
|
int upperX = std::min((float)(origSize.X-1), std::floor(originalX+1.0f));
|
||||||
|
int lowerY = std::floor(originalY);
|
||||||
|
int upperY = std::min((float)(origSize.Y-1), std::floor(originalY+1.0f));
|
||||||
|
|
||||||
|
unsigned char topRight = origBitmap[(lowerY*origSize.X)+upperX];
|
||||||
|
unsigned char topLeft = origBitmap[(lowerY*origSize.X)+lowerX];
|
||||||
|
unsigned char bottomRight = origBitmap[(upperY*origSize.X)+upperX];
|
||||||
|
unsigned char bottomLeft = origBitmap[(upperY*origSize.X)+lowerX];
|
||||||
|
float top = LinearInterpolate<float>(topLeft, topRight, lowerX, upperX, originalX);
|
||||||
|
float bottom = LinearInterpolate<float>(bottomLeft, bottomRight, lowerX, upperX, originalX);
|
||||||
|
float mid = LinearInterpolate<float>(top, bottom, lowerY, upperY, originalY);
|
||||||
|
bitmap[(y*size.X)+x] = mid > 128 ? 255 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BitmapBrush::~BitmapBrush()
|
||||||
|
{
|
||||||
|
delete[] origBitmap;
|
||||||
|
}
|
@ -9,7 +9,6 @@
|
|||||||
#define BTIMAPBRUSH_H_
|
#define BTIMAPBRUSH_H_
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cmath>
|
|
||||||
#include "Brush.h"
|
#include "Brush.h"
|
||||||
|
|
||||||
class BitmapBrush: public Brush
|
class BitmapBrush: public Brush
|
||||||
@ -18,77 +17,9 @@ protected:
|
|||||||
ui::Point origSize;
|
ui::Point origSize;
|
||||||
unsigned char * origBitmap;
|
unsigned char * origBitmap;
|
||||||
public:
|
public:
|
||||||
BitmapBrush(std::vector<unsigned char> newBitmap, ui::Point rectSize_):
|
BitmapBrush(std::vector<unsigned char> newBitmap, ui::Point rectSize);
|
||||||
Brush(ui::Point(0, 0)),
|
void GenerateBitmap() override;
|
||||||
origSize(0, 0)
|
virtual ~BitmapBrush();
|
||||||
{
|
|
||||||
ui::Point newSize = rectSize_;
|
|
||||||
|
|
||||||
//Ensure the rect has odd dimensions so we can pull an integer radius with a 1x1 centre
|
|
||||||
if(!(newSize.X % 2))
|
|
||||||
newSize.X += 1;
|
|
||||||
if(!(newSize.Y % 2))
|
|
||||||
newSize.Y += 1;
|
|
||||||
|
|
||||||
radius = (newSize-ui::Point(1, 1))/2;
|
|
||||||
size = newSize;
|
|
||||||
origSize = size;
|
|
||||||
|
|
||||||
origBitmap = new unsigned char[size.X*size.Y];
|
|
||||||
std::fill(origBitmap, origBitmap+(size.X*size.Y), 0);
|
|
||||||
for(int y = 0; y < rectSize_.Y; y++)
|
|
||||||
{
|
|
||||||
for(int x = 0; x < rectSize_.X; x++)
|
|
||||||
{
|
|
||||||
if(newBitmap[(y*rectSize_.X)+x] >= 128)
|
|
||||||
origBitmap[(y*size.X)+x] = newBitmap[(y*rectSize_.X)+x];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SetRadius(radius);
|
|
||||||
};
|
|
||||||
void GenerateBitmap() override
|
|
||||||
{
|
|
||||||
if(origBitmap)
|
|
||||||
{
|
|
||||||
delete[] bitmap;
|
|
||||||
bitmap = new unsigned char[size.X*size.Y];
|
|
||||||
if(size == origSize)
|
|
||||||
std::copy(origBitmap, origBitmap+(origSize.X*origSize.Y), bitmap);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Bilinear interpolation
|
|
||||||
float factorX = ((float)origSize.X)/((float)size.X);
|
|
||||||
float factorY = ((float)origSize.Y)/((float)size.Y);
|
|
||||||
for(int y = 0; y < size.Y; y++)
|
|
||||||
{
|
|
||||||
for(int x = 0; x < size.X; x++)
|
|
||||||
{
|
|
||||||
float originalY = ((float)y)*factorY;
|
|
||||||
float originalX = ((float)x)*factorX;
|
|
||||||
|
|
||||||
int lowerX = std::floor(originalX);
|
|
||||||
int upperX = std::min((float)(origSize.X-1), std::floor(originalX+1.0f));
|
|
||||||
int lowerY = std::floor(originalY);
|
|
||||||
int upperY = std::min((float)(origSize.Y-1), std::floor(originalY+1.0f));
|
|
||||||
|
|
||||||
unsigned char topRight = origBitmap[(lowerY*origSize.X)+upperX];
|
|
||||||
unsigned char topLeft = origBitmap[(lowerY*origSize.X)+lowerX];
|
|
||||||
unsigned char bottomRight = origBitmap[(upperY*origSize.X)+upperX];
|
|
||||||
unsigned char bottomLeft = origBitmap[(upperY*origSize.X)+lowerX];
|
|
||||||
float top = LinearInterpolate<float>(topLeft, topRight, lowerX, upperX, originalX);
|
|
||||||
float bottom = LinearInterpolate<float>(bottomLeft, bottomRight, lowerX, upperX, originalX);
|
|
||||||
float mid = LinearInterpolate<float>(top, bottom, lowerY, upperY, originalY);
|
|
||||||
bitmap[(y*size.X)+x] = mid > 128 ? 255 : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
virtual ~BitmapBrush()
|
|
||||||
{
|
|
||||||
delete[] origBitmap;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BTIMAPBRUSH_H_ */
|
#endif /* BTIMAPBRUSH_H_ */
|
||||||
|
@ -1,6 +1,81 @@
|
|||||||
#include "Brush.h"
|
#include "Brush.h"
|
||||||
#include "graphics/Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
|
|
||||||
|
Brush::Brush(ui::Point size_):
|
||||||
|
outline(NULL),
|
||||||
|
bitmap(NULL),
|
||||||
|
size(0, 0),
|
||||||
|
radius(0, 0)
|
||||||
|
{
|
||||||
|
SetRadius(size_);
|
||||||
|
};
|
||||||
|
|
||||||
|
Brush::~Brush()
|
||||||
|
{
|
||||||
|
delete[] bitmap;
|
||||||
|
delete[] outline;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Brush::updateOutline()
|
||||||
|
{
|
||||||
|
if(!bitmap)
|
||||||
|
GenerateBitmap();
|
||||||
|
if(!bitmap)
|
||||||
|
return;
|
||||||
|
delete[] outline;
|
||||||
|
outline = new unsigned char[size.X*size.Y];
|
||||||
|
for(int x = 0; x < size.X; x++)
|
||||||
|
{
|
||||||
|
for(int y = 0; y < size.Y; y++)
|
||||||
|
{
|
||||||
|
if(bitmap[y*size.X+x] && (!y || !x || x == size.X-1 || y == size.Y-1 || !bitmap[y*size.X+(x+1)] || !bitmap[y*size.X+(x-1)] || !bitmap[(y-1)*size.X+x] || !bitmap[(y+1)*size.X+x]))
|
||||||
|
{
|
||||||
|
outline[y*size.X+x] = 255;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outline[y*size.X+x] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Brush::SetRadius(ui::Point radius)
|
||||||
|
{
|
||||||
|
this->radius = radius;
|
||||||
|
this->size = radius+radius+ui::Point(1, 1);
|
||||||
|
|
||||||
|
GenerateBitmap();
|
||||||
|
updateOutline();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Brush::GenerateBitmap()
|
||||||
|
{
|
||||||
|
delete[] bitmap;
|
||||||
|
bitmap = new unsigned char[size.X*size.Y];
|
||||||
|
for(int x = 0; x < size.X; x++)
|
||||||
|
{
|
||||||
|
for(int y = 0; y < size.Y; y++)
|
||||||
|
{
|
||||||
|
bitmap[(y*size.X)+x] = 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char *Brush::GetBitmap()
|
||||||
|
{
|
||||||
|
if(!bitmap)
|
||||||
|
GenerateBitmap();
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char *Brush::GetOutline()
|
||||||
|
{
|
||||||
|
if(!outline)
|
||||||
|
updateOutline();
|
||||||
|
if(!outline)
|
||||||
|
return NULL;
|
||||||
|
return outline;
|
||||||
|
}
|
||||||
|
|
||||||
void Brush::RenderRect(Renderer * ren, ui::Point position1, ui::Point position2)
|
void Brush::RenderRect(Renderer * ren, ui::Point position1, ui::Point position2)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef BRUSH_H_
|
#ifndef BRUSH_H_
|
||||||
#define BRUSH_H_
|
#define BRUSH_H_
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include "gui/interface/Point.h"
|
#include "gui/interface/Point.h"
|
||||||
|
|
||||||
class Renderer;
|
class Renderer;
|
||||||
@ -12,36 +11,9 @@ protected:
|
|||||||
unsigned char * bitmap;
|
unsigned char * bitmap;
|
||||||
ui::Point size;
|
ui::Point size;
|
||||||
ui::Point radius;
|
ui::Point radius;
|
||||||
void updateOutline()
|
void updateOutline();
|
||||||
{
|
|
||||||
if(!bitmap)
|
|
||||||
GenerateBitmap();
|
|
||||||
if(!bitmap)
|
|
||||||
return;
|
|
||||||
delete[] outline;
|
|
||||||
outline = new unsigned char[size.X*size.Y];
|
|
||||||
for(int x = 0; x < size.X; x++)
|
|
||||||
{
|
|
||||||
for(int y = 0; y < size.Y; y++)
|
|
||||||
{
|
|
||||||
if(bitmap[y*size.X+x] && (!y || !x || x == size.X-1 || y == size.Y-1 || !bitmap[y*size.X+(x+1)] || !bitmap[y*size.X+(x-1)] || !bitmap[(y-1)*size.X+x] || !bitmap[(y+1)*size.X+x]))
|
|
||||||
{
|
|
||||||
outline[y*size.X+x] = 255;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
outline[y*size.X+x] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public:
|
public:
|
||||||
Brush(ui::Point size_):
|
Brush(ui::Point size);
|
||||||
outline(NULL),
|
|
||||||
bitmap(NULL),
|
|
||||||
size(0, 0),
|
|
||||||
radius(0, 0)
|
|
||||||
{
|
|
||||||
SetRadius(size_);
|
|
||||||
};
|
|
||||||
|
|
||||||
//Radius of the brush 0x0 - infxinf (Radius of 0x0 would be 1x1, radius of 1x1 would be 3x3)
|
//Radius of the brush 0x0 - infxinf (Radius of 0x0 would be 1x1, radius of 1x1 would be 3x3)
|
||||||
ui::Point GetRadius()
|
ui::Point GetRadius()
|
||||||
@ -54,50 +26,17 @@ public:
|
|||||||
{
|
{
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
virtual void SetRadius(ui::Point radius)
|
virtual void SetRadius(ui::Point radius);
|
||||||
{
|
virtual ~Brush();
|
||||||
this->radius = radius;
|
|
||||||
this->size = radius+radius+ui::Point(1, 1);
|
|
||||||
|
|
||||||
GenerateBitmap();
|
|
||||||
updateOutline();
|
|
||||||
}
|
|
||||||
virtual ~Brush() {
|
|
||||||
delete[] bitmap;
|
|
||||||
delete[] outline;
|
|
||||||
}
|
|
||||||
virtual void RenderRect(Renderer * ren, ui::Point position1, ui::Point position2);
|
virtual void RenderRect(Renderer * ren, ui::Point position1, ui::Point position2);
|
||||||
virtual void RenderLine(Renderer * ren, ui::Point position1, ui::Point position2);
|
virtual void RenderLine(Renderer * ren, ui::Point position1, ui::Point position2);
|
||||||
virtual void RenderPoint(Renderer * ren, ui::Point position);
|
virtual void RenderPoint(Renderer * ren, ui::Point position);
|
||||||
virtual void RenderFill(Renderer * ren, ui::Point position);
|
virtual void RenderFill(Renderer * ren, ui::Point position);
|
||||||
virtual void GenerateBitmap()
|
virtual void GenerateBitmap();
|
||||||
{
|
|
||||||
delete[] bitmap;
|
|
||||||
bitmap = new unsigned char[size.X*size.Y];
|
|
||||||
for(int x = 0; x < size.X; x++)
|
|
||||||
{
|
|
||||||
for(int y = 0; y < size.Y; y++)
|
|
||||||
{
|
|
||||||
bitmap[(y*size.X)+x] = 255;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Get a bitmap for drawing particles
|
//Get a bitmap for drawing particles
|
||||||
unsigned char * GetBitmap()
|
unsigned char * GetBitmap();
|
||||||
{
|
|
||||||
if(!bitmap)
|
|
||||||
GenerateBitmap();
|
|
||||||
return bitmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char * GetOutline()
|
unsigned char * GetOutline();
|
||||||
{
|
|
||||||
if(!outline)
|
|
||||||
updateOutline();
|
|
||||||
if(!outline)
|
|
||||||
return NULL;
|
|
||||||
return outline;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
88
src/gui/game/DecorationTool.cpp
Normal file
88
src/gui/game/DecorationTool.cpp
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
#include "DecorationTool.h"
|
||||||
|
|
||||||
|
#include "graphics/Renderer.h"
|
||||||
|
|
||||||
|
#include "simulation/SimulationData.h"
|
||||||
|
#include "simulation/Simulation.h"
|
||||||
|
|
||||||
|
VideoBuffer *DecorationTool::GetIcon(int toolID, int width, int height)
|
||||||
|
{
|
||||||
|
VideoBuffer * newTexture = new VideoBuffer(width, height);
|
||||||
|
for (int y=0; y<height; y++)
|
||||||
|
{
|
||||||
|
for (int x=0; x<width; x++)
|
||||||
|
{
|
||||||
|
//if (toolID == DECO_LIGH)
|
||||||
|
// vid_buf[WINDOWW*(y+j)+(x+i)] = PIXRGB(PIXR(pc)-10*j, PIXG(pc)-10*j, PIXB(pc)-10*j);
|
||||||
|
//else if (toolID == DECO_DARK)
|
||||||
|
// vid_buf[WINDOWW*(y+j)+(x+i)] = PIXRGB(PIXR(pc)+10*j, PIXG(pc)+10*j, PIXB(pc)+10*j);
|
||||||
|
if (toolID == DECO_SMUDGE)
|
||||||
|
newTexture->SetPixel(x, y, 0, 255-5*x, 5*x, 255);
|
||||||
|
else if (toolID == DECO_DRAW || toolID == DECO_CLEAR)
|
||||||
|
newTexture->SetPixel(x, y, Red, Green, Blue, Alpha);
|
||||||
|
else
|
||||||
|
newTexture->SetPixel(x, y, 50, 50, 50, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (toolID == DECO_CLEAR)
|
||||||
|
{
|
||||||
|
int reverseRed = (Red+127)%256;
|
||||||
|
int reverseGreen = (Green+127)%256;
|
||||||
|
int reverseBlue = (Blue+127)%256;
|
||||||
|
for (int y=4; y<12; y++)
|
||||||
|
{
|
||||||
|
newTexture->SetPixel(y+5, y-1, reverseRed, reverseGreen, reverseBlue, 255);
|
||||||
|
newTexture->SetPixel(y+6, y-1, reverseRed, reverseGreen, reverseBlue, 255);
|
||||||
|
newTexture->SetPixel(20-y, y-1, reverseRed, reverseGreen, reverseBlue, 255);
|
||||||
|
newTexture->SetPixel(21-y, y-1, reverseRed, reverseGreen, reverseBlue, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (toolID == DECO_ADD)
|
||||||
|
newTexture->AddCharacter(11, 4, '+', Red, Green, Blue, 255);
|
||||||
|
else if (toolID == DECO_SUBTRACT)
|
||||||
|
newTexture->AddCharacter(11, 4, '-', Red, Green, Blue, 255);
|
||||||
|
else if (toolID == DECO_MULTIPLY)
|
||||||
|
newTexture->AddCharacter(11, 3, 'x', Red, Green, Blue, 255);
|
||||||
|
else if (toolID == DECO_DIVIDE)
|
||||||
|
newTexture->AddCharacter(11, 4, '/', Red, Green, Blue, 255);
|
||||||
|
return newTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
DecorationTool::DecorationTool(Renderer *ren_, int decoMode, String name, String description, int r, int g, int b, ByteString identifier):
|
||||||
|
Tool(decoMode, name, description, r, g, b, identifier),
|
||||||
|
Red(0),
|
||||||
|
Green(0),
|
||||||
|
Blue(0),
|
||||||
|
Alpha(0),
|
||||||
|
ren(ren_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
DecorationTool::~DecorationTool()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void DecorationTool::Draw(Simulation * sim, Brush * brush, ui::Point position)
|
||||||
|
{
|
||||||
|
sim->ApplyDecorationPoint(position.X, position.Y, Red, Green, Blue, Alpha, toolID, brush);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DecorationTool::DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging)
|
||||||
|
{
|
||||||
|
sim->ApplyDecorationLine(position1.X, position1.Y, position2.X, position2.Y, Red, Green, Blue, Alpha, toolID, brush);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DecorationTool::DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2)
|
||||||
|
{
|
||||||
|
sim->ApplyDecorationBox(position1.X, position1.Y, position2.X, position2.Y, Red, Green, Blue, Alpha, toolID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DecorationTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position)
|
||||||
|
{
|
||||||
|
pixel loc = ren->vid[position.X+position.Y*WINDOWW];
|
||||||
|
if (toolID == DECO_CLEAR)
|
||||||
|
sim->ApplyDecorationFill(ren, position.X, position.Y, 0, 0, 0, 0, PIXR(loc), PIXG(loc), PIXB(loc));
|
||||||
|
else
|
||||||
|
sim->ApplyDecorationFill(ren, position.X, position.Y, Red, Green, Blue, Alpha, PIXR(loc), PIXG(loc), PIXB(loc));
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
#ifndef DECORATIONTOOL_H_
|
#ifndef DECORATIONTOOL_H_
|
||||||
#define DECORATIONTOOL_H_
|
#define DECORATIONTOOL_H_
|
||||||
|
|
||||||
@ -15,75 +14,14 @@ public:
|
|||||||
unsigned char Alpha;
|
unsigned char Alpha;
|
||||||
Renderer *ren;
|
Renderer *ren;
|
||||||
|
|
||||||
VideoBuffer * GetIcon(int toolID, int width, int height)
|
VideoBuffer * GetIcon(int toolID, int width, int height);
|
||||||
{
|
|
||||||
VideoBuffer * newTexture = new VideoBuffer(width, height);
|
|
||||||
for (int y=0; y<height; y++)
|
|
||||||
{
|
|
||||||
for (int x=0; x<width; x++)
|
|
||||||
{
|
|
||||||
//if (toolID == DECO_LIGH)
|
|
||||||
// vid_buf[WINDOWW*(y+j)+(x+i)] = PIXRGB(PIXR(pc)-10*j, PIXG(pc)-10*j, PIXB(pc)-10*j);
|
|
||||||
//else if (toolID == DECO_DARK)
|
|
||||||
// vid_buf[WINDOWW*(y+j)+(x+i)] = PIXRGB(PIXR(pc)+10*j, PIXG(pc)+10*j, PIXB(pc)+10*j);
|
|
||||||
if (toolID == DECO_SMUDGE)
|
|
||||||
newTexture->SetPixel(x, y, 0, 255-5*x, 5*x, 255);
|
|
||||||
else if (toolID == DECO_DRAW || toolID == DECO_CLEAR)
|
|
||||||
newTexture->SetPixel(x, y, Red, Green, Blue, Alpha);
|
|
||||||
else
|
|
||||||
newTexture->SetPixel(x, y, 50, 50, 50, 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (toolID == DECO_CLEAR)
|
|
||||||
{
|
|
||||||
int reverseRed = (Red+127)%256;
|
|
||||||
int reverseGreen = (Green+127)%256;
|
|
||||||
int reverseBlue = (Blue+127)%256;
|
|
||||||
for (int y=4; y<12; y++)
|
|
||||||
{
|
|
||||||
newTexture->SetPixel(y+5, y-1, reverseRed, reverseGreen, reverseBlue, 255);
|
|
||||||
newTexture->SetPixel(y+6, y-1, reverseRed, reverseGreen, reverseBlue, 255);
|
|
||||||
newTexture->SetPixel(20-y, y-1, reverseRed, reverseGreen, reverseBlue, 255);
|
|
||||||
newTexture->SetPixel(21-y, y-1, reverseRed, reverseGreen, reverseBlue, 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (toolID == DECO_ADD)
|
|
||||||
newTexture->AddCharacter(11, 4, '+', Red, Green, Blue, 255);
|
|
||||||
else if (toolID == DECO_SUBTRACT)
|
|
||||||
newTexture->AddCharacter(11, 4, '-', Red, Green, Blue, 255);
|
|
||||||
else if (toolID == DECO_MULTIPLY)
|
|
||||||
newTexture->AddCharacter(11, 3, 'x', Red, Green, Blue, 255);
|
|
||||||
else if (toolID == DECO_DIVIDE)
|
|
||||||
newTexture->AddCharacter(11, 4, '/', Red, Green, Blue, 255);
|
|
||||||
return newTexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
DecorationTool(Renderer *ren_, int decoMode, String name, String description, int r, int g, int b, ByteString identifier):
|
DecorationTool(Renderer *ren_, int decoMode, String name, String description, int r, int g, int b, ByteString identifier);
|
||||||
Tool(decoMode, name, description, r, g, b, identifier),
|
virtual ~DecorationTool();
|
||||||
Red(0),
|
void Draw(Simulation * sim, Brush * brush, ui::Point position) override;
|
||||||
Green(0),
|
void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging) override;
|
||||||
Blue(0),
|
void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) override;
|
||||||
Alpha(0),
|
void DrawFill(Simulation * sim, Brush * brush, ui::Point position) override;
|
||||||
ren(ren_)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
virtual ~DecorationTool() {}
|
|
||||||
void Draw(Simulation * sim, Brush * brush, ui::Point position) override{
|
|
||||||
sim->ApplyDecorationPoint(position.X, position.Y, Red, Green, Blue, Alpha, toolID, brush);
|
|
||||||
}
|
|
||||||
void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging) override {
|
|
||||||
sim->ApplyDecorationLine(position1.X, position1.Y, position2.X, position2.Y, Red, Green, Blue, Alpha, toolID, brush);
|
|
||||||
}
|
|
||||||
void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) override {
|
|
||||||
sim->ApplyDecorationBox(position1.X, position1.Y, position2.X, position2.Y, Red, Green, Blue, Alpha, toolID);
|
|
||||||
}
|
|
||||||
void DrawFill(Simulation * sim, Brush * brush, ui::Point position) override {
|
|
||||||
pixel loc = ren->vid[position.X+position.Y*WINDOWW];
|
|
||||||
if (toolID == DECO_CLEAR)
|
|
||||||
sim->ApplyDecorationFill(ren, position.X, position.Y, 0, 0, 0, 0, PIXR(loc), PIXG(loc), PIXB(loc));
|
|
||||||
else
|
|
||||||
sim->ApplyDecorationFill(ren, position.X, position.Y, Red, Green, Blue, Alpha, PIXR(loc), PIXG(loc), PIXB(loc));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "Favorite.h"
|
#include "Favorite.h"
|
||||||
|
|
||||||
#include "json/json.h"
|
#include "json/json.h"
|
||||||
#include "client/Client.h"
|
#include "client/Client.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
Favorite::Favorite():
|
Favorite::Favorite():
|
||||||
|
@ -1,37 +1,64 @@
|
|||||||
#include <iostream>
|
#include "GameController.h"
|
||||||
#include <queue>
|
|
||||||
|
#include "GameView.h"
|
||||||
|
#include "GameModel.h"
|
||||||
|
|
||||||
|
#include "RenderPreset.h"
|
||||||
|
#include "Menu.h"
|
||||||
|
#include "Tool.h"
|
||||||
|
#include "Brush.h"
|
||||||
|
#include "QuickOptions.h"
|
||||||
|
#include "GameModelException.h"
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "GameController.h"
|
#include "Controller.h"
|
||||||
#include "GameModel.h"
|
#include "Notification.h"
|
||||||
#include "client/SaveInfo.h"
|
|
||||||
#include "client/GameSave.h"
|
#include "client/GameSave.h"
|
||||||
|
#include "client/Client.h"
|
||||||
|
|
||||||
#include "gui/search/SearchController.h"
|
#include "gui/search/SearchController.h"
|
||||||
#include "gui/render/RenderController.h"
|
#include "gui/render/RenderController.h"
|
||||||
#include "gui/login/LoginController.h"
|
#include "gui/login/LoginController.h"
|
||||||
#include "gui/interface/Point.h"
|
#include "gui/preview/PreviewController.h"
|
||||||
|
#include "gui/tags/TagsController.h"
|
||||||
|
#include "gui/console/ConsoleController.h"
|
||||||
|
#include "gui/localbrowser/LocalBrowserController.h"
|
||||||
|
#include "gui/options/OptionsController.h"
|
||||||
|
|
||||||
#include "gui/dialogues/ErrorMessage.h"
|
#include "gui/dialogues/ErrorMessage.h"
|
||||||
#include "gui/dialogues/InformationMessage.h"
|
#include "gui/dialogues/InformationMessage.h"
|
||||||
#include "gui/dialogues/ConfirmPrompt.h"
|
#include "gui/dialogues/ConfirmPrompt.h"
|
||||||
#include "GameModelException.h"
|
|
||||||
#include "simulation/Air.h"
|
|
||||||
#include "gui/elementsearch/ElementSearchActivity.h"
|
#include "gui/elementsearch/ElementSearchActivity.h"
|
||||||
#include "gui/profile/ProfileActivity.h"
|
#include "gui/profile/ProfileActivity.h"
|
||||||
#include "gui/colourpicker/ColourPickerActivity.h"
|
#include "gui/colourpicker/ColourPickerActivity.h"
|
||||||
#include "gui/update/UpdateActivity.h"
|
#include "gui/update/UpdateActivity.h"
|
||||||
#include "Notification.h"
|
|
||||||
#include "gui/filebrowser/FileBrowserActivity.h"
|
#include "gui/filebrowser/FileBrowserActivity.h"
|
||||||
#include "gui/save/LocalSaveActivity.h"
|
#include "gui/save/LocalSaveActivity.h"
|
||||||
#include "gui/save/ServerSaveActivity.h"
|
#include "gui/save/ServerSaveActivity.h"
|
||||||
|
|
||||||
|
#include "gui/tags/TagsView.h"
|
||||||
|
#include "gui/search/SearchView.h"
|
||||||
|
#include "gui/render/RenderView.h"
|
||||||
|
#include "gui/preview/PreviewView.h"
|
||||||
|
#include "gui/options/OptionsView.h"
|
||||||
|
#include "gui/login/LoginView.h"
|
||||||
|
#include "gui/localbrowser/LocalBrowserView.h"
|
||||||
|
#include "gui/console/ConsoleView.h"
|
||||||
|
|
||||||
#include "gui/interface/Keys.h"
|
#include "gui/interface/Keys.h"
|
||||||
#include "gui/interface/Mouse.h"
|
#include "gui/interface/Mouse.h"
|
||||||
#include "simulation/Snapshot.h"
|
#include "gui/interface/Engine.h"
|
||||||
|
|
||||||
#include "debug/DebugInfo.h"
|
#include "debug/DebugInfo.h"
|
||||||
#include "debug/DebugParts.h"
|
#include "debug/DebugParts.h"
|
||||||
#include "debug/ElementPopulation.h"
|
#include "debug/ElementPopulation.h"
|
||||||
#include "debug/DebugLines.h"
|
#include "debug/DebugLines.h"
|
||||||
#include "debug/ParticleDebug.h"
|
#include "debug/ParticleDebug.h"
|
||||||
|
|
||||||
#ifdef LUACONSOLE
|
#ifdef LUACONSOLE
|
||||||
#include "lua/LuaScriptInterface.h"
|
#include "lua/LuaScriptInterface.h"
|
||||||
#else
|
#else
|
||||||
@ -39,6 +66,14 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "lua/LuaEvents.h"
|
#include "lua/LuaEvents.h"
|
||||||
|
|
||||||
|
#include "graphics/Renderer.h"
|
||||||
|
|
||||||
|
#include "simulation/Simulation.h"
|
||||||
|
#include "simulation/SimulationData.h"
|
||||||
|
#include "simulation/Air.h"
|
||||||
|
#include "simulation/Snapshot.h"
|
||||||
|
#include "ElementClasses.h"
|
||||||
|
|
||||||
#ifdef GetUserName
|
#ifdef GetUserName
|
||||||
# undef GetUserName // dammit windows
|
# undef GetUserName // dammit windows
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,30 +1,36 @@
|
|||||||
#ifndef GAMECONTROLLER_H
|
#ifndef GAMECONTROLLER_H
|
||||||
#define GAMECONTROLLER_H
|
#define GAMECONTROLLER_H
|
||||||
|
|
||||||
#include <queue>
|
#include <vector>
|
||||||
#include "GameView.h"
|
#include <utility>
|
||||||
#include "GameModel.h"
|
|
||||||
#include "simulation/Simulation.h"
|
|
||||||
#include "gui/interface/Point.h"
|
|
||||||
#include "gui/search/SearchController.h"
|
|
||||||
#include "gui/render/RenderController.h"
|
|
||||||
#include "gui/preview/PreviewController.h"
|
|
||||||
#include "gui/login/LoginController.h"
|
|
||||||
#include "gui/tags/TagsController.h"
|
|
||||||
#include "gui/console/ConsoleController.h"
|
|
||||||
#include "gui/localbrowser/LocalBrowserController.h"
|
|
||||||
#include "gui/options/OptionsController.h"
|
|
||||||
#include "client/ClientListener.h"
|
|
||||||
#include "RenderPreset.h"
|
|
||||||
#include "Menu.h"
|
|
||||||
|
|
||||||
using namespace std;
|
#include "client/ClientListener.h"
|
||||||
|
|
||||||
|
#include "gui/interface/Point.h"
|
||||||
|
#include "gui/interface/Colour.h"
|
||||||
|
|
||||||
|
#include "simulation/Sign.h"
|
||||||
|
#include "simulation/Particle.h"
|
||||||
|
|
||||||
|
#include "Misc.h"
|
||||||
|
|
||||||
class DebugInfo;
|
class DebugInfo;
|
||||||
|
class SaveFile;
|
||||||
class Notification;
|
class Notification;
|
||||||
class GameModel;
|
class GameModel;
|
||||||
class GameView;
|
class GameView;
|
||||||
|
class OptionsController;
|
||||||
|
class LocalBrowserController;
|
||||||
|
class SearchController;
|
||||||
|
class PreviewController;
|
||||||
|
class RenderController;
|
||||||
class CommandInterface;
|
class CommandInterface;
|
||||||
|
class Tool;
|
||||||
|
class Menu;
|
||||||
|
class SaveInfo;
|
||||||
|
class GameSave;
|
||||||
|
class LoginController;
|
||||||
|
class TagsController;
|
||||||
class ConsoleController;
|
class ConsoleController;
|
||||||
class GameController: public ClientListener
|
class GameController: public ClientListener
|
||||||
{
|
{
|
||||||
@ -43,7 +49,7 @@ private:
|
|||||||
LocalBrowserController * localBrowser;
|
LocalBrowserController * localBrowser;
|
||||||
OptionsController * options;
|
OptionsController * options;
|
||||||
CommandInterface * commandInterface;
|
CommandInterface * commandInterface;
|
||||||
vector<DebugInfo*> debugInfo;
|
std::vector<DebugInfo*> debugInfo;
|
||||||
unsigned int debugFlags;
|
unsigned int debugFlags;
|
||||||
public:
|
public:
|
||||||
bool HasDone;
|
bool HasDone;
|
||||||
|
@ -1,28 +1,37 @@
|
|||||||
#include "GameModel.h"
|
#include "GameModel.h"
|
||||||
|
|
||||||
#include "GameView.h"
|
#include "GameView.h"
|
||||||
|
#include "GameController.h"
|
||||||
|
|
||||||
#include "ToolClasses.h"
|
#include "ToolClasses.h"
|
||||||
#include "Brush.h"
|
|
||||||
#include "EllipseBrush.h"
|
#include "EllipseBrush.h"
|
||||||
#include "TriangleBrush.h"
|
#include "TriangleBrush.h"
|
||||||
#include "BitmapBrush.h"
|
#include "BitmapBrush.h"
|
||||||
#include "QuickOptions.h"
|
#include "QuickOptions.h"
|
||||||
#include "GameModelException.h"
|
#include "GameModelException.h"
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
|
#include "Menu.h"
|
||||||
#include "Favorite.h"
|
#include "Favorite.h"
|
||||||
|
#include "Notification.h"
|
||||||
|
|
||||||
#include "client/Client.h"
|
#include "client/Client.h"
|
||||||
#include "client/GameSave.h"
|
#include "client/GameSave.h"
|
||||||
#include "client/SaveFile.h"
|
#include "client/SaveFile.h"
|
||||||
#include "common/tpt-minmax.h"
|
#include "client/SaveInfo.h"
|
||||||
|
|
||||||
#include "graphics/Renderer.h"
|
#include "graphics/Renderer.h"
|
||||||
|
|
||||||
#include "simulation/Air.h"
|
#include "simulation/Air.h"
|
||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
#include "simulation/Snapshot.h"
|
#include "simulation/Snapshot.h"
|
||||||
|
#include "simulation/Gravity.h"
|
||||||
|
#include "simulation/ElementGraphics.h"
|
||||||
|
#include "ElementClasses.h"
|
||||||
|
|
||||||
#include "gui/game/DecorationTool.h"
|
#include "gui/game/DecorationTool.h"
|
||||||
#include "gui/interface/Engine.h"
|
#include "gui/interface/Engine.h"
|
||||||
#include "gui/interface/Point.h"
|
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
GameModel::GameModel():
|
GameModel::GameModel():
|
||||||
clipboard(NULL),
|
clipboard(NULL),
|
||||||
@ -496,7 +505,7 @@ Brush * GameModel::GetBrush()
|
|||||||
return brushList[currentBrush];
|
return brushList[currentBrush];
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<Brush*> GameModel::GetBrushList()
|
std::vector<Brush*> GameModel::GetBrushList()
|
||||||
{
|
{
|
||||||
return brushList;
|
return brushList;
|
||||||
}
|
}
|
||||||
@ -567,12 +576,12 @@ void GameModel::SetActiveMenu(int menuID)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<Tool*> GameModel::GetUnlistedTools()
|
std::vector<Tool*> GameModel::GetUnlistedTools()
|
||||||
{
|
{
|
||||||
return extraElementTools;
|
return extraElementTools;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<Tool*> GameModel::GetToolList()
|
std::vector<Tool*> GameModel::GetToolList()
|
||||||
{
|
{
|
||||||
return toolList;
|
return toolList;
|
||||||
}
|
}
|
||||||
@ -604,12 +613,12 @@ void GameModel::SetActiveTool(int selection, Tool * tool)
|
|||||||
notifyActiveToolsChanged();
|
notifyActiveToolsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<QuickOption*> GameModel::GetQuickOptions()
|
std::vector<QuickOption*> GameModel::GetQuickOptions()
|
||||||
{
|
{
|
||||||
return quickOptions;
|
return quickOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<Menu*> GameModel::GetMenuList()
|
std::vector<Menu*> GameModel::GetMenuList()
|
||||||
{
|
{
|
||||||
return menuList;
|
return menuList;
|
||||||
}
|
}
|
||||||
@ -884,7 +893,7 @@ void GameModel::SetColourSelectorColour(ui::Colour colour_)
|
|||||||
{
|
{
|
||||||
colour = colour_;
|
colour = colour_;
|
||||||
|
|
||||||
vector<Tool*> tools = GetMenuList()[SC_DECO]->GetToolList();
|
std::vector<Tool*> tools = GetMenuList()[SC_DECO]->GetToolList();
|
||||||
for (size_t i = 0; i < tools.size(); i++)
|
for (size_t i = 0; i < tools.size(); i++)
|
||||||
{
|
{
|
||||||
((DecorationTool*)tools[i])->Red = colour.Red;
|
((DecorationTool*)tools[i])->Red = colour.Red;
|
||||||
@ -1057,7 +1066,7 @@ void GameModel::Log(String message, bool printToFile)
|
|||||||
std::cout << message.ToUtf8() << std::endl;
|
std::cout << message.ToUtf8() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
deque<String> GameModel::GetLog()
|
std::deque<String> GameModel::GetLog()
|
||||||
{
|
{
|
||||||
return consoleLog;
|
return consoleLog;
|
||||||
}
|
}
|
||||||
|
@ -3,26 +3,24 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include "client/SaveInfo.h"
|
|
||||||
#include "simulation/Simulation.h"
|
|
||||||
#include "gui/interface/Colour.h"
|
#include "gui/interface/Colour.h"
|
||||||
#include "graphics/Renderer.h"
|
|
||||||
#include "GameView.h"
|
|
||||||
#include "GameController.h"
|
|
||||||
#include "Brush.h"
|
|
||||||
#include "client/User.h"
|
#include "client/User.h"
|
||||||
#include "Notification.h"
|
#include "gui/interface/Point.h"
|
||||||
#include "QuickOption.h"
|
|
||||||
#include "Tool.h"
|
|
||||||
#include "Menu.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
class Menu;
|
||||||
|
class Tool;
|
||||||
|
class QuickOption;
|
||||||
|
class Brush;
|
||||||
class GameView;
|
class GameView;
|
||||||
|
class Notification;
|
||||||
class GameController;
|
class GameController;
|
||||||
|
class SaveInfo;
|
||||||
class SaveFile;
|
class SaveFile;
|
||||||
class Simulation;
|
class Simulation;
|
||||||
class Renderer;
|
class Renderer;
|
||||||
|
class Snapshot;
|
||||||
|
class GameSave;
|
||||||
|
|
||||||
class ToolSelection
|
class ToolSelection
|
||||||
{
|
{
|
||||||
@ -36,27 +34,27 @@ public:
|
|||||||
class GameModel
|
class GameModel
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
vector<Notification*> notifications;
|
std::vector<Notification*> notifications;
|
||||||
//int clipboardSize;
|
//int clipboardSize;
|
||||||
//unsigned char * clipboardData;
|
//unsigned char * clipboardData;
|
||||||
GameSave * clipboard;
|
GameSave * clipboard;
|
||||||
GameSave * placeSave;
|
GameSave * placeSave;
|
||||||
deque<String> consoleLog;
|
std::deque<String> consoleLog;
|
||||||
vector<GameView*> observers;
|
std::vector<GameView*> observers;
|
||||||
vector<Tool*> toolList;
|
std::vector<Tool*> toolList;
|
||||||
|
|
||||||
//All tools that are associated with elements
|
//All tools that are associated with elements
|
||||||
vector<Tool*> elementTools;
|
std::vector<Tool*> elementTools;
|
||||||
//Tools that are present in elementTools, but don't have an associated menu and need to be freed manually
|
//Tools that are present in elementTools, but don't have an associated menu and need to be freed manually
|
||||||
vector<Tool*> extraElementTools;
|
std::vector<Tool*> extraElementTools;
|
||||||
|
|
||||||
Simulation * sim;
|
Simulation * sim;
|
||||||
Renderer * ren;
|
Renderer * ren;
|
||||||
vector<Menu*> menuList;
|
std::vector<Menu*> menuList;
|
||||||
vector<QuickOption*> quickOptions;
|
std::vector<QuickOption*> quickOptions;
|
||||||
int activeMenu;
|
int activeMenu;
|
||||||
int currentBrush;
|
int currentBrush;
|
||||||
vector<Brush *> brushList;
|
std::vector<Brush *> brushList;
|
||||||
SaveInfo * currentSave;
|
SaveInfo * currentSave;
|
||||||
SaveFile * currentFile;
|
SaveFile * currentFile;
|
||||||
Tool * lastTool;
|
Tool * lastTool;
|
||||||
@ -151,11 +149,11 @@ public:
|
|||||||
void SetLastTool(Tool * newTool);
|
void SetLastTool(Tool * newTool);
|
||||||
Tool * GetToolFromIdentifier(ByteString identifier);
|
Tool * GetToolFromIdentifier(ByteString identifier);
|
||||||
Tool * GetElementTool(int elementID);
|
Tool * GetElementTool(int elementID);
|
||||||
vector<Tool*> GetToolList();
|
std::vector<Tool*> GetToolList();
|
||||||
vector<Tool*> GetUnlistedTools();
|
std::vector<Tool*> GetUnlistedTools();
|
||||||
|
|
||||||
Brush * GetBrush();
|
Brush * GetBrush();
|
||||||
vector<Brush*> GetBrushList();
|
std::vector<Brush*> GetBrushList();
|
||||||
int GetBrushID();
|
int GetBrushID();
|
||||||
void SetBrushID(int i);
|
void SetBrushID(int i);
|
||||||
|
|
||||||
@ -177,8 +175,8 @@ public:
|
|||||||
bool GetGravityGrid();
|
bool GetGravityGrid();
|
||||||
void ShowGravityGrid(bool showGrid);
|
void ShowGravityGrid(bool showGrid);
|
||||||
void ClearSimulation();
|
void ClearSimulation();
|
||||||
vector<Menu*> GetMenuList();
|
std::vector<Menu*> GetMenuList();
|
||||||
vector<QuickOption*> GetQuickOptions();
|
std::vector<QuickOption*> GetQuickOptions();
|
||||||
void SetActiveMenu(int menuID);
|
void SetActiveMenu(int menuID);
|
||||||
int GetActiveMenu();
|
int GetActiveMenu();
|
||||||
void FrameStep(int frames);
|
void FrameStep(int frames);
|
||||||
@ -201,7 +199,7 @@ public:
|
|||||||
void SetClipboard(GameSave * save);
|
void SetClipboard(GameSave * save);
|
||||||
void SetPlaceSave(GameSave * save);
|
void SetPlaceSave(GameSave * save);
|
||||||
void Log(String message, bool printToFile);
|
void Log(String message, bool printToFile);
|
||||||
deque<String> GetLog();
|
std::deque<String> GetLog();
|
||||||
GameSave * GetClipboard();
|
GameSave * GetClipboard();
|
||||||
GameSave * GetPlaceSave();
|
GameSave * GetPlaceSave();
|
||||||
|
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
struct GameModelException: public exception {
|
struct GameModelException: public std::exception
|
||||||
|
{
|
||||||
ByteString message;
|
ByteString message;
|
||||||
public:
|
public:
|
||||||
GameModelException(String message_): message(message_.ToUtf8()) {}
|
GameModelException(String message_): message(message_.ToUtf8()) {}
|
||||||
|
@ -1,26 +1,40 @@
|
|||||||
#include <iomanip>
|
|
||||||
#include <algorithm>
|
|
||||||
#include "GameView.h"
|
#include "GameView.h"
|
||||||
|
|
||||||
|
#include "GameController.h"
|
||||||
|
#include "GameModel.h"
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
#include "Misc.h"
|
||||||
#include "Favorite.h"
|
#include "Favorite.h"
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
|
|
||||||
|
#include "Notification.h"
|
||||||
|
#include "Brush.h"
|
||||||
#include "IntroText.h"
|
#include "IntroText.h"
|
||||||
#include "QuickOptions.h"
|
#include "QuickOptions.h"
|
||||||
#include "DecorationTool.h"
|
#include "DecorationTool.h"
|
||||||
|
#include "ToolButton.h"
|
||||||
|
#include "Menu.h"
|
||||||
|
|
||||||
|
#include "client/SaveInfo.h"
|
||||||
#include "client/SaveFile.h"
|
#include "client/SaveFile.h"
|
||||||
|
#include "client/Client.h"
|
||||||
|
|
||||||
#include "graphics/Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
|
#include "graphics/Renderer.h"
|
||||||
|
|
||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
#include "gui/dialogues/ConfirmPrompt.h"
|
#include "gui/dialogues/ConfirmPrompt.h"
|
||||||
#include "gui/dialogues/InformationMessage.h"
|
#include "gui/dialogues/InformationMessage.h"
|
||||||
#include "gui/interface/Button.h"
|
#include "gui/interface/Button.h"
|
||||||
#include "gui/interface/Colour.h"
|
#include "gui/interface/Colour.h"
|
||||||
#include "gui/interface/Keys.h"
|
#include "gui/interface/Keys.h"
|
||||||
#include "gui/interface/Mouse.h"
|
#include "gui/interface/Engine.h"
|
||||||
#include "gui/interface/Slider.h"
|
|
||||||
#include "gui/interface/Window.h"
|
|
||||||
#include "simulation/SaveRenderer.h"
|
#include "simulation/SaveRenderer.h"
|
||||||
#include "simulation/SimulationData.h"
|
#include "simulation/SimulationData.h"
|
||||||
|
#include "simulation/ElementDefs.h"
|
||||||
|
#include "ElementClasses.h"
|
||||||
|
|
||||||
#ifdef GetUserName
|
#ifdef GetUserName
|
||||||
# undef GetUserName // dammit windows
|
# undef GetUserName // dammit windows
|
||||||
@ -584,10 +598,9 @@ void GameView::NotifyQuickOptionsChanged(GameModel * sender)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int currentY = 1;
|
int currentY = 1;
|
||||||
vector<QuickOption*> optionList = sender->GetQuickOptions();
|
std::vector<QuickOption*> optionList = sender->GetQuickOptions();
|
||||||
for(vector<QuickOption*>::iterator iter = optionList.begin(), end = optionList.end(); iter != end; ++iter)
|
for(auto *option : optionList)
|
||||||
{
|
{
|
||||||
QuickOption * option = *iter;
|
|
||||||
ui::Button * tempButton = new ui::Button(ui::Point(WINDOWW-16, currentY), ui::Point(15, 15), option->GetIcon(), option->GetDescription());
|
ui::Button * tempButton = new ui::Button(ui::Point(WINDOWW-16, currentY), ui::Point(15, 15), option->GetIcon(), option->GetDescription());
|
||||||
//tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2);
|
//tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2);
|
||||||
tempButton->SetTogglable(true);
|
tempButton->SetTogglable(true);
|
||||||
@ -615,7 +628,7 @@ void GameView::NotifyMenuListChanged(GameModel * sender)
|
|||||||
delete toolButtons[i];
|
delete toolButtons[i];
|
||||||
}
|
}
|
||||||
toolButtons.clear();
|
toolButtons.clear();
|
||||||
vector<Menu*> menuList = sender->GetMenuList();
|
std::vector<Menu*> menuList = sender->GetMenuList();
|
||||||
for (int i = (int)menuList.size()-1; i >= 0; i--)
|
for (int i = (int)menuList.size()-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (menuList[i]->GetVisible())
|
if (menuList[i]->GetVisible())
|
||||||
@ -750,7 +763,7 @@ void GameView::NotifyToolListChanged(GameModel * sender)
|
|||||||
delete toolButtons[i];
|
delete toolButtons[i];
|
||||||
}
|
}
|
||||||
toolButtons.clear();
|
toolButtons.clear();
|
||||||
vector<Tool*> toolList = sender->GetToolList();
|
std::vector<Tool*> toolList = sender->GetToolList();
|
||||||
int currentX = 0;
|
int currentX = 0;
|
||||||
for (size_t i = 0; i < toolList.size(); i++)
|
for (size_t i = 0; i < toolList.size(); i++)
|
||||||
{
|
{
|
||||||
@ -1106,9 +1119,8 @@ void GameView::updateToolButtonScroll()
|
|||||||
}
|
}
|
||||||
scrollBar->Size.X=scrollSize;
|
scrollBar->Size.X=scrollSize;
|
||||||
int offsetDelta = toolButtons[0]->Position.X - newInitialX;
|
int offsetDelta = toolButtons[0]->Position.X - newInitialX;
|
||||||
for(vector<ToolButton*>::iterator iter = toolButtons.begin(), end = toolButtons.end(); iter!=end; ++iter)
|
for(auto *button : toolButtons)
|
||||||
{
|
{
|
||||||
ToolButton * button = *iter;
|
|
||||||
button->Position.X -= offsetDelta;
|
button->Position.X -= offsetDelta;
|
||||||
if (button->Position.X+button->Size.X <= 0 || (button->Position.X+button->Size.X) > XRES-2)
|
if (button->Position.X+button->Size.X <= 0 || (button->Position.X+button->Size.X) > XRES-2)
|
||||||
button->Visible = false;
|
button->Visible = false;
|
||||||
@ -1119,9 +1131,8 @@ void GameView::updateToolButtonScroll()
|
|||||||
//Ensure that mouseLeave events are make their way to the buttons should they move from underneath the mouse pointer
|
//Ensure that mouseLeave events are make their way to the buttons should they move from underneath the mouse pointer
|
||||||
if(toolButtons[0]->Position.Y < y && toolButtons[0]->Position.Y+toolButtons[0]->Size.Y > y)
|
if(toolButtons[0]->Position.Y < y && toolButtons[0]->Position.Y+toolButtons[0]->Size.Y > y)
|
||||||
{
|
{
|
||||||
for(vector<ToolButton*>::iterator iter = toolButtons.begin(), end = toolButtons.end(); iter!=end; ++iter)
|
for(auto *button : toolButtons)
|
||||||
{
|
{
|
||||||
ToolButton * button = *iter;
|
|
||||||
if(button->Position.X < x && button->Position.X+button->Size.X > x)
|
if(button->Position.X < x && button->Position.X+button->Size.X > x)
|
||||||
button->OnMouseEnter(x, y);
|
button->OnMouseEnter(x, y);
|
||||||
else
|
else
|
||||||
@ -2244,7 +2255,7 @@ void GameView::OnDraw()
|
|||||||
{
|
{
|
||||||
int startX = 20;
|
int startX = 20;
|
||||||
int startY = YRES-20;
|
int startY = YRES-20;
|
||||||
deque<std::pair<String, int> >::iterator iter;
|
std::deque<std::pair<String, int> >::iterator iter;
|
||||||
for(iter = logEntries.begin(); iter != logEntries.end(); iter++)
|
for(iter = logEntries.begin(); iter != logEntries.end(); iter++)
|
||||||
{
|
{
|
||||||
String message = (*iter).first;
|
String message = (*iter).first;
|
||||||
|
@ -2,22 +2,11 @@
|
|||||||
#define GAMEVIEW_H
|
#define GAMEVIEW_H
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <queue>
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#include "GameController.h"
|
|
||||||
#include "GameModel.h"
|
|
||||||
#include "gui/interface/Window.h"
|
#include "gui/interface/Window.h"
|
||||||
#include "gui/interface/Point.h"
|
|
||||||
#include "gui/interface/Button.h"
|
|
||||||
#include "gui/interface/Slider.h"
|
|
||||||
#include "gui/interface/Textbox.h"
|
|
||||||
#include "ToolButton.h"
|
|
||||||
#include "Brush.h"
|
|
||||||
#include "simulation/Sample.h"
|
#include "simulation/Sample.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
enum DrawMode
|
enum DrawMode
|
||||||
{
|
{
|
||||||
DrawPoints, DrawLine, DrawRect, DrawFill
|
DrawPoints, DrawLine, DrawRect, DrawFill
|
||||||
@ -28,7 +17,18 @@ enum SelectMode
|
|||||||
SelectNone, SelectStamp, SelectCopy, SelectCut, PlaceSave
|
SelectNone, SelectStamp, SelectCopy, SelectCut, PlaceSave
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace ui
|
||||||
|
{
|
||||||
|
class Button;
|
||||||
|
class Slider;
|
||||||
|
class Textbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Renderer;
|
||||||
|
class VideoBuffer;
|
||||||
|
class ToolButton;
|
||||||
class GameController;
|
class GameController;
|
||||||
|
class Brush;
|
||||||
class GameModel;
|
class GameModel;
|
||||||
class GameView: public ui::Window
|
class GameView: public ui::Window
|
||||||
{
|
{
|
||||||
@ -76,11 +76,11 @@ private:
|
|||||||
Renderer * ren;
|
Renderer * ren;
|
||||||
Brush * activeBrush;
|
Brush * activeBrush;
|
||||||
//UI Elements
|
//UI Elements
|
||||||
vector<ui::Button*> quickOptionButtons;
|
std::vector<ui::Button*> quickOptionButtons;
|
||||||
vector<ui::Button*> menuButtons;
|
std::vector<ui::Button*> menuButtons;
|
||||||
vector<ToolButton*> toolButtons;
|
std::vector<ToolButton*> toolButtons;
|
||||||
vector<ui::Component*> notificationComponents;
|
std::vector<ui::Component*> notificationComponents;
|
||||||
deque<std::pair<String, int> > logEntries;
|
std::deque<std::pair<String, int> > logEntries;
|
||||||
ui::Button * scrollBar;
|
ui::Button * scrollBar;
|
||||||
ui::Button * searchButton;
|
ui::Button * searchButton;
|
||||||
ui::Button * reloadButton;
|
ui::Button * reloadButton;
|
||||||
@ -97,7 +97,7 @@ private:
|
|||||||
ui::Button * pauseButton;
|
ui::Button * pauseButton;
|
||||||
|
|
||||||
ui::Button * colourPicker;
|
ui::Button * colourPicker;
|
||||||
vector<ToolButton*> colourPresets;
|
std::vector<ToolButton*> colourPresets;
|
||||||
|
|
||||||
DrawMode drawMode;
|
DrawMode drawMode;
|
||||||
ui::Point drawPoint1;
|
ui::Point drawPoint1;
|
||||||
|
31
src/gui/game/Menu.cpp
Normal file
31
src/gui/game/Menu.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#include "Menu.h"
|
||||||
|
|
||||||
|
#include "Tool.h"
|
||||||
|
|
||||||
|
Menu::Menu(String::value_type icon_, String description_, int visible_):
|
||||||
|
icon(icon_),
|
||||||
|
description(description_),
|
||||||
|
tools(std::vector<Tool*>()),
|
||||||
|
visible(visible_ ? true : false)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu::~Menu()
|
||||||
|
{
|
||||||
|
for(unsigned int i = 0; i < tools.size(); i++)
|
||||||
|
{
|
||||||
|
delete tools[i];
|
||||||
|
}
|
||||||
|
tools.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Menu::AddTool(Tool * tool_)
|
||||||
|
{
|
||||||
|
tools.push_back(tool_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Menu::ClearTools()
|
||||||
|
{
|
||||||
|
tools.clear();
|
||||||
|
}
|
@ -2,8 +2,8 @@
|
|||||||
#define MENU_H_
|
#define MENU_H_
|
||||||
|
|
||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#include "Tool.h"
|
|
||||||
|
|
||||||
|
class Tool;
|
||||||
class Menu
|
class Menu
|
||||||
{
|
{
|
||||||
String::value_type icon;
|
String::value_type icon;
|
||||||
@ -11,23 +11,8 @@ class Menu
|
|||||||
std::vector<Tool*> tools;
|
std::vector<Tool*> tools;
|
||||||
bool visible;
|
bool visible;
|
||||||
public:
|
public:
|
||||||
Menu(String::value_type icon_, String description_, int visible_):
|
Menu(String::value_type icon_, String description_, int visible_);
|
||||||
icon(icon_),
|
virtual ~Menu();
|
||||||
description(description_),
|
|
||||||
tools(std::vector<Tool*>()),
|
|
||||||
visible(visible_ ? true : false)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~Menu()
|
|
||||||
{
|
|
||||||
for(unsigned int i = 0; i < tools.size(); i++)
|
|
||||||
{
|
|
||||||
delete tools[i];
|
|
||||||
}
|
|
||||||
tools.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<Tool*> GetToolList()
|
std::vector<Tool*> GetToolList()
|
||||||
{
|
{
|
||||||
@ -49,15 +34,8 @@ public:
|
|||||||
return visible;
|
return visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddTool(Tool * tool_)
|
void AddTool(Tool * tool_);
|
||||||
{
|
void ClearTools();
|
||||||
tools.push_back(tool_);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClearTools()
|
|
||||||
{
|
|
||||||
tools.clear();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <iostream>
|
|
||||||
#include "Tool.h"
|
#include "Tool.h"
|
||||||
|
|
||||||
#include "client/Client.h"
|
#include "client/Client.h"
|
||||||
|
|
||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
#include "gui/game/Brush.h"
|
#include "gui/game/Brush.h"
|
||||||
#include "gui/interface/Window.h"
|
#include "gui/interface/Window.h"
|
||||||
@ -10,8 +11,13 @@
|
|||||||
#include "gui/interface/DropDown.h"
|
#include "gui/interface/DropDown.h"
|
||||||
#include "gui/interface/Keys.h"
|
#include "gui/interface/Keys.h"
|
||||||
#include "gui/dialogues/ErrorMessage.h"
|
#include "gui/dialogues/ErrorMessage.h"
|
||||||
|
|
||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
class PropertyWindow: public ui::Window
|
class PropertyWindow: public ui::Window
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class GameModel;
|
class GameModel;
|
||||||
|
100
src/gui/game/QuickOptions.cpp
Normal file
100
src/gui/game/QuickOptions.cpp
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
#include "QuickOptions.h"
|
||||||
|
|
||||||
|
#include "GameModel.h"
|
||||||
|
#include "GameController.h"
|
||||||
|
|
||||||
|
#include "simulation/Simulation.h"
|
||||||
|
|
||||||
|
SandEffectOption::SandEffectOption(GameModel * m):
|
||||||
|
QuickOption("P", "Sand effect", m, Toggle)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
bool SandEffectOption::GetToggle()
|
||||||
|
{
|
||||||
|
return m->GetSimulation()->pretty_powder;
|
||||||
|
}
|
||||||
|
void SandEffectOption::perform()
|
||||||
|
{
|
||||||
|
m->GetSimulation()->pretty_powder = !m->GetSimulation()->pretty_powder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DrawGravOption::DrawGravOption(GameModel * m):
|
||||||
|
QuickOption("G", "Draw gravity field \bg(ctrl+g)", m, Toggle)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
bool DrawGravOption::GetToggle()
|
||||||
|
{
|
||||||
|
return m->GetGravityGrid();
|
||||||
|
}
|
||||||
|
void DrawGravOption::perform()
|
||||||
|
{
|
||||||
|
m->ShowGravityGrid(!m->GetGravityGrid());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DecorationsOption::DecorationsOption(GameModel * m):
|
||||||
|
QuickOption("D", "Draw decorations \bg(ctrl+b)", m, Toggle)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
bool DecorationsOption::GetToggle()
|
||||||
|
{
|
||||||
|
return m->GetDecoration();
|
||||||
|
}
|
||||||
|
void DecorationsOption::perform()
|
||||||
|
{
|
||||||
|
m->SetDecoration(!m->GetDecoration());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
NGravityOption::NGravityOption(GameModel * m):
|
||||||
|
QuickOption("N", "Newtonian Gravity \bg(n)", m, Toggle)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
bool NGravityOption::GetToggle()
|
||||||
|
{
|
||||||
|
return m->GetNewtonianGrvity();
|
||||||
|
}
|
||||||
|
void NGravityOption::perform()
|
||||||
|
{
|
||||||
|
m->SetNewtonianGravity(!m->GetNewtonianGrvity());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AHeatOption::AHeatOption(GameModel * m):
|
||||||
|
QuickOption("A", "Ambient heat \bg(u)", m, Toggle)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
bool AHeatOption::GetToggle()
|
||||||
|
{
|
||||||
|
return m->GetAHeatEnable();
|
||||||
|
}
|
||||||
|
void AHeatOption::perform()
|
||||||
|
{
|
||||||
|
m->SetAHeatEnable(!m->GetAHeatEnable());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ConsoleShowOption::ConsoleShowOption(GameModel * m, GameController * c_):
|
||||||
|
QuickOption("C", "Show Console \bg(~)", m, Toggle)
|
||||||
|
{
|
||||||
|
c = c_;
|
||||||
|
}
|
||||||
|
bool ConsoleShowOption::GetToggle()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
void ConsoleShowOption::perform()
|
||||||
|
{
|
||||||
|
c->ShowConsole();
|
||||||
|
}
|
@ -1,111 +1,52 @@
|
|||||||
#include "QuickOption.h"
|
#include "QuickOption.h"
|
||||||
#include "GameModel.h"
|
|
||||||
|
class GameController;
|
||||||
|
|
||||||
class SandEffectOption: public QuickOption
|
class SandEffectOption: public QuickOption
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SandEffectOption(GameModel * m):
|
SandEffectOption(GameModel * m);
|
||||||
QuickOption("P", "Sand effect", m, Toggle)
|
bool GetToggle() override;
|
||||||
{
|
void perform() override;
|
||||||
|
|
||||||
}
|
|
||||||
bool GetToggle() override
|
|
||||||
{
|
|
||||||
return m->GetSimulation()->pretty_powder;
|
|
||||||
}
|
|
||||||
void perform() override
|
|
||||||
{
|
|
||||||
m->GetSimulation()->pretty_powder = !m->GetSimulation()->pretty_powder;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DrawGravOption: public QuickOption
|
class DrawGravOption: public QuickOption
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DrawGravOption(GameModel * m):
|
DrawGravOption(GameModel * m);
|
||||||
QuickOption("G", "Draw gravity field \bg(ctrl+g)", m, Toggle)
|
bool GetToggle() override;
|
||||||
{
|
void perform() override;
|
||||||
|
|
||||||
}
|
|
||||||
bool GetToggle() override
|
|
||||||
{
|
|
||||||
return m->GetGravityGrid();
|
|
||||||
}
|
|
||||||
void perform() override
|
|
||||||
{
|
|
||||||
m->ShowGravityGrid(!m->GetGravityGrid());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DecorationsOption: public QuickOption
|
class DecorationsOption: public QuickOption
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DecorationsOption(GameModel * m):
|
DecorationsOption(GameModel * m);
|
||||||
QuickOption("D", "Draw decorations \bg(ctrl+b)", m, Toggle)
|
bool GetToggle() override;
|
||||||
{
|
void perform() override;
|
||||||
|
|
||||||
}
|
|
||||||
bool GetToggle() override
|
|
||||||
{
|
|
||||||
return m->GetDecoration();
|
|
||||||
}
|
|
||||||
void perform() override
|
|
||||||
{
|
|
||||||
m->SetDecoration(!m->GetDecoration());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NGravityOption: public QuickOption
|
class NGravityOption: public QuickOption
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NGravityOption(GameModel * m):
|
NGravityOption(GameModel * m);
|
||||||
QuickOption("N", "Newtonian Gravity \bg(n)", m, Toggle)
|
bool GetToggle() override;
|
||||||
{
|
void perform() override;
|
||||||
|
|
||||||
}
|
|
||||||
bool GetToggle() override
|
|
||||||
{
|
|
||||||
return m->GetNewtonianGrvity();
|
|
||||||
}
|
|
||||||
void perform() override
|
|
||||||
{
|
|
||||||
m->SetNewtonianGravity(!m->GetNewtonianGrvity());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AHeatOption: public QuickOption
|
class AHeatOption: public QuickOption
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AHeatOption(GameModel * m):
|
AHeatOption(GameModel * m);
|
||||||
QuickOption("A", "Ambient heat \bg(u)", m, Toggle)
|
bool GetToggle() override;
|
||||||
{
|
void perform() override;
|
||||||
|
|
||||||
}
|
|
||||||
bool GetToggle() override
|
|
||||||
{
|
|
||||||
return m->GetAHeatEnable();
|
|
||||||
}
|
|
||||||
void perform() override
|
|
||||||
{
|
|
||||||
m->SetAHeatEnable(!m->GetAHeatEnable());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConsoleShowOption: public QuickOption
|
class ConsoleShowOption: public QuickOption
|
||||||
{
|
{
|
||||||
GameController * c;
|
GameController * c;
|
||||||
public:
|
public:
|
||||||
ConsoleShowOption(GameModel * m, GameController * c_):
|
ConsoleShowOption(GameModel * m, GameController * c_);
|
||||||
QuickOption("C", "Show Console \bg(~)", m, Toggle)
|
bool GetToggle() override;
|
||||||
{
|
void perform() override;
|
||||||
c = c_;
|
|
||||||
}
|
|
||||||
bool GetToggle() override
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
void perform() override
|
|
||||||
{
|
|
||||||
c->ShowConsole();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
#include <iostream>
|
|
||||||
#include "graphics/Graphics.h"
|
|
||||||
#include "Tool.h"
|
#include "Tool.h"
|
||||||
#include "GameModel.h"
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
#include "graphics/Renderer.h"
|
||||||
|
|
||||||
|
#include "gui/game/GameModel.h"
|
||||||
#include "gui/interface/Colour.h"
|
#include "gui/interface/Colour.h"
|
||||||
|
|
||||||
|
#include "simulation/Simulation.h"
|
||||||
|
#include "ElementClasses.h"
|
||||||
|
|
||||||
|
#include "Menu.h"
|
||||||
|
|
||||||
VideoBuffer * SampleTool::GetIcon(int toolID, int width, int height)
|
VideoBuffer * SampleTool::GetIcon(int toolID, int width, int height)
|
||||||
{
|
{
|
||||||
VideoBuffer * newTexture = new VideoBuffer(width, height);
|
VideoBuffer * newTexture = new VideoBuffer(width, height);
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include <iostream>
|
|
||||||
#include "gui/Style.h"
|
|
||||||
#include "simulation/Simulation.h"
|
|
||||||
#include "Tool.h"
|
#include "Tool.h"
|
||||||
|
|
||||||
|
#include "simulation/Simulation.h"
|
||||||
|
|
||||||
|
#include "gui/Style.h"
|
||||||
#include "gui/interface/Window.h"
|
#include "gui/interface/Window.h"
|
||||||
#include "gui/interface/Button.h"
|
#include "gui/interface/Button.h"
|
||||||
#include "gui/interface/Label.h"
|
#include "gui/interface/Label.h"
|
||||||
@ -9,6 +10,8 @@
|
|||||||
#include "gui/interface/DropDown.h"
|
#include "gui/interface/DropDown.h"
|
||||||
#include "gui/game/GameModel.h"
|
#include "gui/game/GameModel.h"
|
||||||
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
class SignWindow: public ui::Window
|
class SignWindow: public ui::Window
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
#include "common/String.h"
|
|
||||||
#include "Tool.h"
|
#include "Tool.h"
|
||||||
|
|
||||||
#include "gui/game/Brush.h"
|
#include "gui/game/Brush.h"
|
||||||
|
|
||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
|
#include "simulation/SimulationData.h"
|
||||||
|
#include "ElementClasses.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#ifndef TOOL_H_
|
#ifndef TOOL_H_
|
||||||
#define TOOL_H_
|
#define TOOL_H_
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#include "gui/interface/Point.h"
|
#include "gui/interface/Point.h"
|
||||||
#include "simulation/StructProperty.h"
|
#include "simulation/StructProperty.h"
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
#include "ToolButton.h"
|
#include "ToolButton.h"
|
||||||
|
|
||||||
#include "graphics/Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
#include "gui/interface/Keys.h"
|
#include "gui/interface/Keys.h"
|
||||||
#include "gui/interface/Mouse.h"
|
#include "gui/interface/Mouse.h"
|
||||||
|
|
||||||
#include "Favorite.h"
|
#include "Favorite.h"
|
||||||
|
|
||||||
ToolButton::ToolButton(ui::Point position, ui::Point size, String text, ByteString toolIdentifier, String toolTip):
|
ToolButton::ToolButton(ui::Point position, ui::Point size, String text, ByteString toolIdentifier, String toolTip):
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
|
#include "Button.h"
|
||||||
#include "AvatarButton.h"
|
#include "AvatarButton.h"
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
#include "client/Client.h"
|
#include "client/Client.h"
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
#include <iostream>
|
|
||||||
#include "gui/interface/Button.h"
|
#include "gui/interface/Button.h"
|
||||||
|
|
||||||
#include "gui/interface/Window.h"
|
#include "gui/interface/Window.h"
|
||||||
|
|
||||||
#include "graphics/Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#include "Misc.h"
|
#include "Misc.h"
|
||||||
|
#include "Colour.h"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
#define BUTTON_H_
|
#define BUTTON_H_
|
||||||
|
|
||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#include "Misc.h"
|
|
||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
#include "Colour.h"
|
|
||||||
|
|
||||||
namespace ui
|
namespace ui
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "Checkbox.h"
|
#include "Checkbox.h"
|
||||||
|
|
||||||
#include "graphics/Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
#include "gui/interface/Window.h"
|
#include "gui/interface/Window.h"
|
||||||
|
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <iostream>
|
|
||||||
#include "graphics/Graphics.h"
|
|
||||||
#include "gui/interface/Component.h"
|
#include "gui/interface/Component.h"
|
||||||
#include "gui/interface/Engine.h"
|
|
||||||
|
#include "graphics/Graphics.h"
|
||||||
#include "gui/interface/Point.h"
|
#include "gui/interface/Point.h"
|
||||||
#include "gui/interface/Window.h"
|
#include "gui/interface/Window.h"
|
||||||
#include "gui/interface/Panel.h"
|
#include "gui/interface/Panel.h"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/String.h"
|
#include "common/String.h"
|
||||||
#include "common/tpt-compat.h"
|
|
||||||
#include "Appearance.h"
|
#include "Appearance.h"
|
||||||
#include "Point.h"
|
#include "Point.h"
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#include "ContextMenu.h"
|
#include "ContextMenu.h"
|
||||||
#include "common/tpt-minmax.h"
|
|
||||||
#include "graphics/Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
|
|
||||||
|
#include "common/tpt-minmax.h"
|
||||||
|
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
class ContextMenu::ItemSelectedAction: public ButtonAction
|
class ContextMenu::ItemSelectedAction: public ButtonAction
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
namespace ui
|
namespace ui
|
||||||
{
|
{
|
||||||
|
class Button;
|
||||||
|
|
||||||
class ContextMenuItem
|
class ContextMenuItem
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
#include "CopyTextButton.h"
|
#include "CopyTextButton.h"
|
||||||
|
|
||||||
#include "Colour.h"
|
#include "Colour.h"
|
||||||
#include "PowderToy.h"
|
|
||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
|
#include "Label.h"
|
||||||
|
|
||||||
|
#include "PowderToy.h"
|
||||||
|
|
||||||
namespace ui
|
namespace ui
|
||||||
{
|
{
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#define COPYTEXTBUTTON_H
|
#define COPYTEXTBUTTON_H
|
||||||
|
|
||||||
#include "Button.h"
|
#include "Button.h"
|
||||||
#include "Label.h"
|
|
||||||
|
|
||||||
namespace ui
|
namespace ui
|
||||||
{
|
{
|
||||||
|
class Label;
|
||||||
class CopyTextButton : public Button
|
class CopyTextButton : public Button
|
||||||
{
|
{
|
||||||
ui::Label *copyTextLabel;
|
ui::Label *copyTextLabel;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <iostream>
|
#include "DropDown.h"
|
||||||
|
|
||||||
#include "graphics/Graphics.h"
|
#include "graphics/Graphics.h"
|
||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
#include "Button.h"
|
#include "Button.h"
|
||||||
#include "DropDown.h"
|
|
||||||
#include "gui/interface/Window.h"
|
#include "gui/interface/Window.h"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
#include "Colour.h"
|
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user