Просмотр исходного кода

Fixed icons culling incorrectly in entity editor, added buttons to hide icons in entity editor, update polycode version to new versioning system, made about page display correct version, made polybuild display correct version, added project information to about page, added UIMultilineLabel class to UI module

Ivan Safrin 12 лет назад
Родитель
Сommit
3a359fa545

+ 1 - 1
Core/Contents/Include/PolyGlobals.h

@@ -27,7 +27,7 @@ THE SOFTWARE.
 // Compile support for lua bindings.
 //#define _COMPILE_LUA
 
-#define POLYCODE_VERSION_STRING "0.8.3"
+#define POLYCODE_VERSION_STRING "0.8.4a_dev"
 
 #define COMPILE_GL_RENDERER
 

Разница между файлами не показана из-за своего большого размера
+ 3 - 3
IDE/Assets/ide_icons.ai


+ 2 - 0
IDE/Contents/Include/PolycodeEntityEditor.h

@@ -240,6 +240,8 @@ class EntityEditorMainView : public UIElement {
     
             UIIconSelector *shadeModeSelector;
             UIIconSelector *lightingModeSelector;
+
+            UIIconSelector *iconVisibilitySelector;
     
             UIImageButton *moveUpButton;
             UIImageButton *moveTopButton;

BIN
IDE/Contents/Resources/Images/entityEditor/hide_icons.png


BIN
IDE/Contents/Resources/Images/entityEditor/show_icons.png


BIN
IDE/Contents/Resources/ImagesRetina/entityEditor/hide_icons.png


BIN
IDE/Contents/Resources/ImagesRetina/entityEditor/show_icons.png


+ 20 - 1
IDE/Contents/Source/PolycodeEntityEditor.cpp

@@ -313,6 +313,7 @@ EntityEditorMainView::EntityEditorMainView(PolycodeEditor *editor) {
     this->editor = editor;
 
 	mainScene = new Scene(Scene::SCENE_3D, true);
+
 	renderTexture = new SceneRenderTexture(mainScene, mainScene->getDefaultCamera(), 512, 512);
 	mainScene->clearColor.setColor(0.2, 0.2, 0.2, 1.0);	
 	mainScene->useClearColor = true;
@@ -460,6 +461,14 @@ EntityEditorMainView::EntityEditorMainView(PolycodeEditor *editor) {
     snapSelector->setPosition(156, 2);
     snapSelector->addEventListener(this, UIEvent::SELECT_EVENT);
     
+    iconVisibilitySelector = new UIIconSelector();
+    iconVisibilitySelector->addIcon("entityEditor/show_icons.png");
+    iconVisibilitySelector->addIcon("entityEditor/hide_icons.png");
+    bottomBar->addChild(iconVisibilitySelector);
+    iconVisibilitySelector->setPosition(230, 2);
+    iconVisibilitySelector->addEventListener(this, UIEvent::SELECT_EVENT);
+    
+    
     editorMode = EDITOR_MODE_3D;
     
     input = CoreServices::getInstance()->getCore()->getInput();
@@ -622,6 +631,7 @@ void EntityEditorMainView::Update() {
         }
         icons[i]->setScale(scale, scale, scale);
         icons[i]->rebuildTransformMatrix();
+        icons[i]->recalculateAABBAllChildren();
     }
 }
 
@@ -1161,7 +1171,16 @@ void EntityEditorMainView::handleEvent(Event *event) {
             break;
         }
     } else if(event->getDispatcher() == grid) {
-                transformGizmo->setSnapSize(grid->getGridSize());        
+                transformGizmo->setSnapSize(grid->getGridSize());
+    } else if(event->getDispatcher() == iconVisibilitySelector) {
+        switch(iconVisibilitySelector->getSelectedIndex()) {
+            case 0:
+                iconBase->visible = true;
+            break;
+            case 1:
+                iconBase->visible = false;
+            break;
+        }
     } else {
         if(event->getEventCode() == InputEvent::EVENT_MOUSEDOWN && hasFocus && event->getDispatcher() != renderTextureShape) {
             InputEvent *inputEvent = (InputEvent*) event;

+ 17 - 6
IDE/Contents/Source/PolycodeFrame.cpp

@@ -1400,15 +1400,26 @@ PolycodeFrame::PolycodeFrame(PolycodeEditorManager *editorManager) : UIElement()
 	aboutOKButton->setPosition(700, 420);
 	aboutOKButton->addEventListener(this, UIEvent::CLICK_EVENT);
 	
-	
-	assetImporterWindow = new AssetImporterWindow();
-	
-	
-	UILabel *versionLabel = new UILabel("version 0.8.2", 12, "mono");
+    String info1Text = "Polycode is developed by:\n\nProject lead:\nIvan Safrin\n\nTop project contributors in order of commits:\nCameron Hart, Andi McClure, samiamwork, Christian Bielert,\nChristopher Reed, TheCosmotect, Danny Warren, Paul Smith,\nDevin Stone, Jon Kristinsson, Henry Maddocks,\nJohan Klokkhammer Helsing, Chris Ledet, Per Bodin, Quinlan P.,\nLee-R, Guillaume Papin, Remi Gillig, ZenX2,\nMatt Tuttle, Alejandro Cámara, Jake Scott, tastymorsel";
+    
+    UIMultilineLabel *info1 = new UIMultilineLabel(info1Text, 12, 5);
+    aboutWindow->addChild(info1);
+    info1->setPosition(40, 200);
+    
+    String info2Text = "Polycode uses the following open-source libraries:\n\nAssimp (BSD license)\nBox2D (zlib license)\nBullet Physics (zlib license)\nFreetype (Freetype license)\nlibpng (libpng license)\nLua (MIT license),\nOggVorbis (BSD license)\nPhysFS (zlib license)\ntinyXML (zlib license)\nSDL (on Linux only) (zlib license)\n\nPolycode itself is distributed\nunder the MIT license.\n\n\n\nThank you for using Polycode!";
+    
+    UIMultilineLabel *info2 = new UIMultilineLabel(info2Text, 12, 5);
+    aboutWindow->addChild(info2);
+    info2->setPosition(450, 40);
+
+	UILabel *versionLabel = new UILabel("version "POLYCODE_VERSION_STRING, 12, "mono");
 	aboutWindow->addChild(versionLabel);
-	versionLabel->setPosition(20, 430);
+	versionLabel->setPosition(40, 430);
 	versionLabel->color.a = 1.0;
 	
+	assetImporterWindow = new AssetImporterWindow();
+	
+		
 	isDragging  = false;
 	dragLabel = new UILabel("NONE", 11, "sans");
 	dragLabel->setPosition(0,-15);

+ 19 - 0
Modules/Contents/UI/Include/PolyUIElement.h

@@ -118,6 +118,25 @@ namespace Polycode {
 		protected:
 			SceneLabel *label;
 	};
+    
+	class _PolyExport UIMultilineLabel : public UIElement {
+    public:
+        UIMultilineLabel(const String& text, int size, int spacing, const String& fontName = "sans", int amode = 0);
+        void setText(const String& text);
+        String getText();
+        
+        ~UIMultilineLabel();
+    protected:
+        
+        int labelSize;
+        String labelFontName;
+        int labelAAMode;
+        int spacing;
+        
+        void clearLabels();
+        std::vector<UILabel*> labels;
+	};
+    
 
 	
 	class _PolyExport UIImage : public UIRect {

+ 55 - 0
Modules/Contents/UI/Source/PolyUIElement.cpp

@@ -30,6 +30,61 @@ using namespace Polycode;
 
 UIElement *UIElement::globalFocusedChild = NULL;
 
+UIMultilineLabel::UIMultilineLabel(const String& text, int size, int spacing, const String& fontName, int amode) : UIElement() {
+    labelSize = size;
+    labelFontName = fontName;
+    labelAAMode = amode;
+    this->spacing = spacing;
+    setText(text);
+}
+
+void UIMultilineLabel::setText(const String& text) {
+    clearLabels();
+    
+    std::vector<String> lines = text.split("\n");
+    
+    Number lineSize = spacing;
+    Number yPos = 0.0;
+    for(int i=0; i < lines.size(); i++) {
+        if(lines[i] == "") {
+            yPos += lineSize + spacing;
+        } else {
+            UILabel *label = new UILabel(lines[i], labelSize, labelFontName, labelAAMode);
+            lineSize = label->getHeight();
+            addChild(label);
+            label->setPositionY(yPos);
+            yPos += label->getHeight() + spacing;
+            addChild(label);
+        }
+    }
+}
+
+String UIMultilineLabel::getText() {
+    String text;
+    for(int i=0; i < labels.size(); i++) {
+        if(i != 0) {
+            text += "\n";
+        }
+        text += labels[i]->getText();
+    }
+    return text;
+}
+
+void UIMultilineLabel::clearLabels() {
+    for(int i=0; i < labels.size(); i++) {
+        removeChild(labels[i]);
+        delete labels[i];
+    }
+    labels.clear();
+}
+
+UIMultilineLabel::~UIMultilineLabel() {
+    if(!ownsChildren) {
+        clearLabels();
+    }
+}
+
+
 UILabel::UILabel(const String& text, int size, const String& fontName, int amode) : UIElement() {
 
 	Config *conf = CoreServices::getInstance()->getConfig();	

+ 1 - 1
Tools/Contents/polybuild/Source/polybuild.cpp

@@ -208,7 +208,7 @@ int main(int argc, char **argv) {
 	}
 #endif
 
-	printf("Polycode build tool v0.8.2\n");
+	printf("Polycode build tool v"POLYCODE_VERSION_STRING"\n");
 
 	for(int i=0; i < argc; i++) {
 		String argString = String(argv[i]);

Некоторые файлы не были показаны из-за большого количества измененных файлов