mirror of
https://github.com/ApfelTeeSaft/PlanetFleet.git
synced 2026-08-26 19:33:38 +00:00
Weights generation status text
This commit is contained in:
@@ -53,6 +53,7 @@ mappings = {
|
||||
{bind = 41, trigger = 89, action = true, bindType = 0, inOptions = false},
|
||||
{bind = 42, trigger = 88, action = true, bindType = 0, inOptions = false},
|
||||
{bind = 43, trigger = 87, action = true, bindType = 0, inOptions = false},
|
||||
{bind = 44, trigger = 72, action = true, bindType = 0, inOptions = false},
|
||||
}
|
||||
graphics = {
|
||||
resolution = {x = 1920, y = 1080}
|
||||
|
||||
@@ -46,7 +46,8 @@ namespace battleship{
|
||||
MOVE_X_AXIS,
|
||||
MOVE_Y_AXIS,
|
||||
MOVE_Z_AXIS,
|
||||
CREATE_WATERBODY
|
||||
CREATE_WATERBODY,
|
||||
GENERATE_WEIGHTS
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ namespace battleship{
|
||||
const int maxNumGroups = 10;
|
||||
|
||||
const static int numAppStates = 4;
|
||||
const static int numStaticBinds[numAppStates]{6, 0, 5, 17};
|
||||
const static int numStaticBinds[numAppStates]{6, 0, 5, 18};
|
||||
const static int numConfBinds[numAppStates]{0, 1, 22, 0};
|
||||
const static int maxStaticBinds = 17;
|
||||
const static int maxConfBinds = 22;
|
||||
|
||||
+23
-4
@@ -363,7 +363,15 @@ namespace battleship{
|
||||
doc->SaveFile(name.c_str());
|
||||
}
|
||||
|
||||
void MapEditorAppState::MapEditor::deleteWeights(){
|
||||
weightsGenerated = false;
|
||||
}
|
||||
|
||||
void MapEditorAppState::MapEditor::generateWeights(){
|
||||
if(weightsGenerated)
|
||||
deleteWeights();
|
||||
|
||||
weightsGenerated = true;
|
||||
}
|
||||
|
||||
void MapEditorAppState::MapEditor::exportMap(){
|
||||
@@ -383,6 +391,7 @@ namespace battleship{
|
||||
|
||||
void MapEditorAppState::update(){
|
||||
radiusText->setText(L"Radius: " + to_wstring(mapEditor->getCircleRadius()));
|
||||
weightsText->setText(L"Weights generated: " + to_wstring(mapEditor->isWeightsGenerated()));
|
||||
|
||||
CameraController *camCtr = CameraController::getSingleton();
|
||||
|
||||
@@ -404,12 +413,19 @@ namespace battleship{
|
||||
mat->addBoolUniform("texturingEnabled", false);
|
||||
mat->addVec4Uniform("diffuseColor", Vector4::VEC_IJKL);
|
||||
|
||||
radiusText = new Text(GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", L"");
|
||||
string fontPath = GameManager::getSingleton()->getPath() + "Fonts/batang.ttf";
|
||||
radiusText = new Text(fontPath, L"");
|
||||
radiusText->setMaterial(mat);
|
||||
weightsText = new Text(fontPath, L"");
|
||||
weightsText->setMaterial(mat);
|
||||
|
||||
Node *node = new Node(Vector3(0, 100, 0));
|
||||
node->addText(radiusText);
|
||||
root->getGuiNode()->attachChild(node);
|
||||
Node *radiusNode = new Node(Vector3(0, 100, 0));
|
||||
radiusNode->addText(radiusText);
|
||||
root->getGuiNode()->attachChild(radiusNode);
|
||||
|
||||
Node *weightsNode = new Node(Vector3(0, 200, 0));
|
||||
weightsNode->addText(weightsText);
|
||||
root->getGuiNode()->attachChild(weightsNode);
|
||||
}
|
||||
|
||||
void MapEditorAppState::onDettached(){}
|
||||
@@ -483,6 +499,9 @@ namespace battleship{
|
||||
mapEditor->setMovementAxis(axis);
|
||||
}
|
||||
|
||||
break;
|
||||
case Bind::GENERATE_WEIGHTS:
|
||||
mapEditor->generateWeights();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -42,6 +42,7 @@ namespace battleship{
|
||||
void createWaterbody();
|
||||
void moveTerrainObject(float);
|
||||
void exportMap();
|
||||
void generateWeights();
|
||||
inline TerrainObject* getSelectedTerrainObject(){return selectedTerrainObject;}
|
||||
inline float getGuiThreshold(){return guiThreshold;}
|
||||
inline float getCircleRadius(){return circleRadius;}
|
||||
@@ -52,20 +53,21 @@ namespace battleship{
|
||||
inline void setMovingTerrainObject(bool m){movingTerrainObject = m;}
|
||||
inline MovementAxis getMovementAxis(){return movementAxis;}
|
||||
inline void setMovementAxis(MovementAxis m){movementAxis = m;}
|
||||
inline bool isWeightsGenerated(){return weightsGenerated;}
|
||||
private:
|
||||
void generatePlane(vb01::Vector2);
|
||||
void prepareGui();
|
||||
void prepareTextures(std::string, bool, std::vector<vb01::Texture*>&);
|
||||
void toggleSelection(TerrainObject*, bool);
|
||||
void parseLandmass();
|
||||
void generateWeights();
|
||||
void deleteWeights();
|
||||
inline vb01::Texture* getSkyTexture(int i){return skyTextures[i];}
|
||||
inline vb01::Texture* getLandmassTexture(int i){return landmassTextures[i];}
|
||||
|
||||
Map *map;
|
||||
TerrainObject *selectedTerrainObject = nullptr;
|
||||
MovementAxis movementAxis = X_AXIS;
|
||||
bool pushing = false, movingTerrainObject = false, newMap;
|
||||
bool pushing = false, movingTerrainObject = false, weightsGenerated = false, newMap;
|
||||
const float MIN_RADIUS = 1, MAX_RADIUS = 100, INCREASE_RATE = 1;
|
||||
const int NUM_SUBDIVS = 100;
|
||||
float circleRadius = MIN_RADIUS, guiThreshold = 200;
|
||||
@@ -87,7 +89,7 @@ namespace battleship{
|
||||
std::string mapName;
|
||||
vb01::Vector2 mapSize;
|
||||
bool newMap;
|
||||
vb01::Text *radiusText = nullptr;
|
||||
vb01::Text *radiusText = nullptr, *weightsText = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user