2009-05-08 13:28:41 +00:00
|
|
|
/*
|
|
|
|
* OpenClonk, http://www.openclonk.org
|
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* Copyright (c) 1998-2000, Matthes Bender
|
|
|
|
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
|
2016-04-03 18:18:29 +00:00
|
|
|
* Copyright (c) 2009-2016, The OpenClonk Team and contributors
|
2009-05-08 13:28:41 +00:00
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* Distributed under the terms of the ISC license; see accompanying file
|
|
|
|
* "COPYING" for details.
|
2009-05-08 13:28:41 +00:00
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* "Clonk" is a registered trademark of Matthes Bender, used with permission.
|
|
|
|
* See accompanying file "TRADEMARK" for details.
|
2009-05-08 13:28:41 +00:00
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* To redistribute this file separately, substitute the full license texts
|
|
|
|
* for the above references.
|
2009-05-08 13:28:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Drawing tools dialog for landscape editing in console mode */
|
|
|
|
|
|
|
|
#ifndef INC_C4ToolsDlg
|
|
|
|
#define INC_C4ToolsDlg
|
|
|
|
|
|
|
|
|
2016-04-03 18:07:56 +00:00
|
|
|
#include "config/C4Constants.h"
|
2016-04-02 15:50:49 +00:00
|
|
|
#include "landscape/C4Landscape.h"
|
2009-08-12 20:03:50 +00:00
|
|
|
|
2010-12-11 18:50:38 +00:00
|
|
|
const int32_t
|
|
|
|
C4TLS_Brush = 0,
|
|
|
|
C4TLS_Line = 1,
|
|
|
|
C4TLS_Rect = 2,
|
|
|
|
C4TLS_Fill = 3,
|
|
|
|
C4TLS_Picker = 4;
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2010-12-11 18:50:38 +00:00
|
|
|
const int32_t
|
|
|
|
C4TLS_GradeMax = 50,
|
|
|
|
C4TLS_GradeMin = 1,
|
|
|
|
C4TLS_GradeDefault = 5;
|
2009-05-08 13:28:41 +00:00
|
|
|
|
|
|
|
#define C4TLS_MatSky "Sky"
|
|
|
|
|
2016-04-02 15:50:49 +00:00
|
|
|
enum class LandscapeMode;
|
2009-05-08 13:28:41 +00:00
|
|
|
class C4ToolsDlg
|
2010-03-28 17:58:21 +00:00
|
|
|
{
|
2010-12-11 18:50:38 +00:00
|
|
|
friend class C4ConsoleGUI;
|
|
|
|
private:
|
|
|
|
class State;
|
|
|
|
State *state;
|
2010-03-28 17:58:21 +00:00
|
|
|
public:
|
|
|
|
C4ToolsDlg();
|
|
|
|
~C4ToolsDlg();
|
|
|
|
public:
|
|
|
|
bool Active;
|
|
|
|
int32_t Tool, SelectedTool;
|
|
|
|
int32_t Grade;
|
|
|
|
bool ModeIFT;
|
|
|
|
char Material[C4M_MaxName+1];
|
|
|
|
char Texture[C4M_MaxName+1];
|
2015-07-15 02:37:12 +00:00
|
|
|
bool ModeBack; // If true, IFT is ignored and background material/texture is always used
|
|
|
|
char BackMaterial[C4M_MaxName+1];
|
|
|
|
char BackTexture[C4M_MaxName+1];
|
2010-03-28 17:58:21 +00:00
|
|
|
public:
|
|
|
|
void Default();
|
|
|
|
void Clear();
|
|
|
|
bool PopTextures();
|
|
|
|
bool PopMaterial();
|
|
|
|
bool ChangeGrade(int32_t iChange);
|
2010-12-11 18:50:38 +00:00
|
|
|
void NeedPreviewUpdate();
|
2010-03-28 17:58:21 +00:00
|
|
|
bool Open();
|
|
|
|
bool SetGrade(int32_t iGrade);
|
|
|
|
bool SetTool(int32_t iTool, bool fTemp);
|
|
|
|
bool ToggleTool() { return !!SetTool((Tool+1)%4, false); }
|
2016-06-17 22:44:59 +00:00
|
|
|
bool SetLandscapeMode(LandscapeMode iMode, bool flat_chunk_shapes, bool fThroughControl=false);
|
2010-03-28 17:58:21 +00:00
|
|
|
bool SetIFT(bool fIFT);
|
|
|
|
bool ToggleIFT() { return !!SetIFT(!ModeIFT); }
|
2016-03-18 03:18:29 +00:00
|
|
|
bool SelectTexture(const char *szTexture, bool by_console_gui=false);
|
|
|
|
bool SelectMaterial(const char *szMaterial, bool by_console_gui = false);
|
|
|
|
bool SelectBackTexture(const char *szTexture, bool by_console_gui = false);
|
|
|
|
bool SelectBackMaterial(const char *szMaterial, bool by_console_gui = false);
|
2010-03-28 17:58:21 +00:00
|
|
|
void SetAlternateTool();
|
|
|
|
void ResetAlternateTool();
|
2016-08-28 00:10:58 +00:00
|
|
|
bool IsGradedTool() const { return Tool == C4TLS_Brush || Tool == C4TLS_Line || Tool == C4TLS_Fill; } // return whether Grade measure affects selected tool
|
2010-03-28 17:58:21 +00:00
|
|
|
protected:
|
|
|
|
void AssertValidTexture();
|
2015-07-15 02:37:12 +00:00
|
|
|
void AssertValidBackTexture();
|
2010-03-28 17:58:21 +00:00
|
|
|
void LoadBitmaps();
|
|
|
|
void EnableControls();
|
|
|
|
void UpdateIFTControls();
|
|
|
|
void InitGradeCtrl();
|
|
|
|
void InitMaterialCtrls();
|
|
|
|
void UpdateToolCtrls();
|
|
|
|
void UpdateTextures();
|
|
|
|
void SetColorPattern(const char *szMaterial, const char *szTexture);
|
|
|
|
public:
|
|
|
|
void UpdateLandscapeModeCtrls();
|
2010-12-12 12:53:51 +00:00
|
|
|
void SetTexture(const char *szTexture);
|
|
|
|
void SetMaterial(const char *szMaterial);
|
2015-07-15 02:37:12 +00:00
|
|
|
void SetBackTexture(const char *szTexture);
|
|
|
|
void SetBackMaterial(const char *szMaterial);
|
2010-03-28 17:58:21 +00:00
|
|
|
};
|
2009-05-08 13:28:41 +00:00
|
|
|
|
|
|
|
#endif //INC_C4ToolsDlg
|