Browse Source

fix checkbox state was not shown

Kolja Strohm 1 year ago
parent
commit
f7540df1b5

+ 1 - 1
FactoryCraft/ChunkFluidModel.cpp

@@ -266,7 +266,7 @@ bool ChunkFluidModel::updateLightning()
                     {
                         if (oldVertexCount <= groundVertexCount)
                         {
-                                std::cout << "ERROR: to many vertecies in chunk fluid model" << std::endl;
+                            std::cout << "ERROR: to many vertecies in chunk fluid model" << std::endl;
                             return 0;
 						}
                         lightBuffer[groundVertexCount++] = calculateLight(

+ 2 - 0
FactoryCraft/Initialisierung.cpp

@@ -43,6 +43,8 @@ KontrollKnopf* createKontrollKnopf(const Framework::UIInitParam& params)
     ret->setHintergrundFarbe(0xFF000000);
     ret->setKAFFarbe(0xFF3d3d3d);
     ret->setKAFStrength(10);
+    ret->loadData(
+        "data/images/system.ltdb");
     return ret;
 }
 

+ 35 - 2
FactoryCraft/QuestGraph.cpp

@@ -119,6 +119,7 @@ Framework::Zeichnung* QuestGraphElement::parseElement(
     }
     graph->addVirtualConnectionNodes();
     graph->sortItems();
+    graph->fixItemPositions();
     return graph;
 }
 
@@ -137,7 +138,7 @@ void QuestGraphElement::layout(Framework::XML::Element& element,
 {
     UIMLElement::layout(element, z, pWidth, pHeight, generalLayouter);
     QuestGraph* graph = dynamic_cast<QuestGraph*>(&z);
-    graph->fixItemPositions();
+    graph->centerVertically();
 }
 
 QuestGraphItemElement::QuestGraphItemElement() {}
@@ -620,7 +621,7 @@ void QuestGraphItem::render(Framework::Bild& rObj)
     ZeichnungHintergrund::render(rObj);
     if (finished && !rewarded)
     {
-        if (rObj.setDrawOptions(pos.x, pos.y, gr.x - 1, gr.y - 1))
+        if (rObj.setDrawOptions(pos.x, pos.y, gr.x, gr.y))
         {
             for (int i = 0; i < 7; i++)
             {
@@ -1242,6 +1243,38 @@ void QuestGraph::fixItemPositions()
     }
 }
 
+void QuestGraph::centerVertically() {
+    int height = 0;
+    for (QuestGraphItemLayer* layer : layers)
+    {
+        if (layer->getLeyerHeight() > height)
+        {
+            height = layer->getLeyerHeight();
+        }
+    }
+    if (height > getInnenHeight())
+    {
+        addStyle(ZeichnungHintergrund::Style::VScroll);
+        setVertikalKlickScroll(10);
+        vertikalScrollBar->update(height, getInnenHeight());
+    }
+    if (layers.getEintragAnzahl() * 150 - 80 > getInnenBreite())
+    {
+        addStyle(ZeichnungHintergrund::Style::HScroll);
+        setHorizontalKlickScroll(10);
+        horizontalScrollBar->update(
+            layers.getEintragAnzahl() * 150 - 80, getInnenBreite());
+    }
+    QuestGraphItemLayer* last = 0;
+    for (int i = layers.getEintragAnzahl() - 1; i >= 0; i--)
+    {
+        QuestGraphItemLayer* layer = layers.z(i);
+        layer->centerVertically(getHeight() / 2);
+        if (last) layer->resolveHorizontalConflicts(last);
+        last = layer;
+    }
+}
+
 void QuestGraph::addItem(QuestGraphItem* item)
 {
     int layerInex = item->getLayerIndex();

+ 1 - 0
FactoryCraft/QuestGraph.h

@@ -214,6 +214,7 @@ public:
     void addVirtualConnectionNodes();
     void sortItems();
     void fixItemPositions();
+    void centerVertically();
     void addItem(QuestGraphItem* item);
 
     friend QuestGraphElement;