Commit [r1036] Maximize Restore History

- EDITOR: animation editing complete

protoman 2014-05-17

1 2 > >> (Page 1 of 2)
added /v2/editor/mainwindow_tab/animation.cpp
added /v2/editor/animationpreview.h
changed /v2/editor/mediator.cpp
changed /v2/editor/mainwindow_tab/map_tab.cpp
changed /v2/Makefile
changed /v2/build/data/stages_v3.dat
changed /v2/editor/mainwindow.ui
changed /v2/editor/mediator.h
changed /v2/build/data/images/tilesets/default.png
changed /v2/editor/npcpreviewarea.cpp
changed /v2/editor/mainwindow.cpp
changed /v2/editor/mainwindow.h
changed /v2/docs/RoadMap.txt
changed /v2/file/v_3_0_0.h
changed /v2/editor/Rockbot_Editor.pro
changed /v2/editor/common.cpp
changed /v2/build/data/game_v3.dat
changed /v2/defines.h
changed /v2/editor/common.h
copied /v2/editor/mainwindow_tab/colorcycle_map_preview.h -> /v2/editor/mainwindow_tab/animation.h
copied /v2/editor/mainwindow_tab/colorcycle.h -> /v2/editor/animationpreview.cpp
copied /v2/editor/mainwindow_tab/colorcycle.ui -> /v2/editor/mainwindow_tab/animation.ui
/v2/editor/mainwindow_tab/animation.cpp Diff Switch to side-by-side view
Loading...
/v2/editor/animationpreview.h Diff Switch to side-by-side view
Loading...
/v2/editor/mediator.cpp Diff Switch to side-by-side view
Loading...
/v2/editor/mainwindow_tab/map_tab.cpp Diff Switch to side-by-side view
Loading...
/v2/Makefile Diff Switch to side-by-side view
Loading...
/v2/build/data/stages_v3.dat Diff Switch to side-by-side view
Loading...
/v2/editor/mainwindow.ui Diff Switch to side-by-side view
Loading...
/v2/editor/mediator.h Diff Switch to side-by-side view
Loading...
/v2/build/data/images/tilesets/default.png Diff Switch to side-by-side view
Loading...
/v2/editor/npcpreviewarea.cpp Diff Switch to side-by-side view
Loading...
/v2/editor/mainwindow.cpp Diff Switch to side-by-side view
Loading...
/v2/editor/mainwindow.h Diff Switch to side-by-side view
Loading...
/v2/docs/RoadMap.txt Diff Switch to side-by-side view
Loading...
/v2/file/v_3_0_0.h Diff Switch to side-by-side view
Loading...
/v2/editor/Rockbot_Editor.pro Diff Switch to side-by-side view
Loading...
/v2/editor/common.cpp Diff Switch to side-by-side view
Loading...
/v2/build/data/game_v3.dat Diff Switch to side-by-side view
Loading...
/v2/defines.h Diff Switch to side-by-side view
Loading...
/v2/editor/common.h Diff Switch to side-by-side view
Loading...
/v2/editor/mainwindow_tab/colorcycle_map_preview.h to /v2/editor/mainwindow_tab/animation.h
--- a/v2/editor/mainwindow_tab/colorcycle_map_preview.h
+++ b/v2/editor/mainwindow_tab/animation.h
@@ -1,52 +1,43 @@
-#ifndef COLORCYCLE_MAP_PREVIEW_H
-#define COLORCYCLE_MAP_PREVIEW_H
+#ifndef ANIMATION_H
+#define ANIMATION_H
 
 #include <QWidget>
-#include "mediator.h"
 
-#ifndef EDITORTILEPALLETE
-	#include "editortilepallete.h"
-#endif
+namespace Ui {
+class animation;
+}
 
-#ifndef FILE_GAME
-	#include "../file/format.h"
-#endif
-
-class colorcycle_map_preview : public QWidget
+class animation : public QWidget
 {
-	Q_OBJECT
+    Q_OBJECT
+    
 public:
-	explicit colorcycle_map_preview(QWidget *parent = 0);
-
+    explicit animation(QWidget *parent = 0);
+    ~animation();
+    void reload();
 
 private:
-	int get_colorn_from_rgb(QImage &image, int r, int g, int b);
-    bool color1_next(unsigned int now_time);
-    bool color2_next(unsigned int now_time);
-    bool color3_next(unsigned int now_time);
-    void apply_colorcycle(QImage&image);
+    void load_data();
 
+public slots:
+    void frame_changed();
+
+private slots:
+    void on_filename_currentIndexChanged(const QString &arg1);
+
+    void on_animation_select_currentIndexChanged(int index);
+
+    void on_width_valueChanged(int arg1);
+
+    void on_heigth_valueChanged(int arg1);
+
+    void on_frameDelay_valueChanged(int arg1);
+
+    void on_name_textChanged(const QString &arg1);
 
 private:
-    QWidget *myParent;
-    int _current_color1;
-    int _current_color2;
-    int _current_color3;
-    QTimer *_timer;
-    short _zoom;
-    unsigned int _timer1;
-    unsigned int _timer2;
-    unsigned int _timer3;
-
-
-protected:
-	void paintEvent(QPaintEvent *);
-
-signals:
-	
-public slots:
-    void timer_check();
-
+    Ui::animation *ui;
+    bool _data_loading;
 };
 
-#endif // COLORCYCLE_MAP_PREVIEW_H
+#endif // ANIMATION_H
/v2/editor/mainwindow_tab/colorcycle.h to /v2/editor/animationpreview.cpp
--- a/v2/editor/mainwindow_tab/colorcycle.h
+++ b/v2/editor/animationpreview.cpp
@@ -1,91 +1,60 @@
-#ifndef COLORCYCLE_H
-#define COLORCYCLE_H
+#include <QTimer>
+#include <QPainter>
 
-#include <QWidget>
-#include <QSpinBox>
+#include "animationpreview.h"
 
-namespace Ui {
-class colorcycle_edit;
+#include "mediator.h"
+extern Mediator *dataExchanger;
+
+extern CURRENT_FILE_FORMAT::file_game game_data;
+extern std::string FILEPATH;
+
+
+animationPreview::animationPreview(QWidget *parent) :
+    QWidget(parent)
+{
+    _sprite_n = 0;
+    _timer = new QTimer(this);
+    connect(_timer, SIGNAL(timeout()), this, SLOT(updateBG()));
+    _timer->start(game_data.animation[dataExchanger->selected_animation].frame_duration[_sprite_n]);
 }
 
-class colorcycle_edit : public QWidget
+void animationPreview::updateBG()
 {
-	Q_OBJECT
-	
-public:
-	explicit colorcycle_edit(QWidget *parent = 0);
-	~colorcycle_edit();
-    void reload();
+    _sprite_n++;
+    if (_sprite_n > ANIM_FRAMES_COUNT-1) {
+        _sprite_n = 0;
+    }
+    std::string filename = FILEPATH + "/data/images/animations/" + game_data.animation[dataExchanger->selected_animation].filename;
+    QPixmap fg_image(filename.c_str());
 
-private:
-	void pick_color(short n);
-	void reload_colors();
+    if (game_data.animation[dataExchanger->selected_animation].w * _sprite_n > fg_image.width()) {
+        _sprite_n = 0;
+    }
+    _timer->stop();
+    _timer->start(game_data.animation[dataExchanger->selected_animation].frame_duration[_sprite_n]);
+    repaint();
+}
 
-	
-private slots:
+void animationPreview::paintEvent(QPaintEvent *)
+{
+    QPainter painter(this);
 
-	void on_stage_selector_currentIndexChanged(int index);
+    std::string filename = FILEPATH + "/data/images/animations/" + game_data.animation[dataExchanger->selected_animation].filename;
+    QPixmap fg_image(filename.c_str());
 
-	void on_color_pick_button1_clicked();
+    int total_w = game_data.animation[dataExchanger->selected_animation].w;
+    int total_h = game_data.animation[dataExchanger->selected_animation].h;
+    int center_x = this->width()/2 - total_w;
+    int center_y = this->height()/2 - total_h;
 
-	void on_color_pick_button2_clicked();
 
-	void on_color_pick_button3_clicked();
-
-	void on_color_pick_button4_clicked();
-
-	void on_color_pick_button5_clicked();
-
-	void on_color_pick_button6_clicked();
-
-	void on_color_pick_button7_clicked();
-
-	void on_color_pick_button8_clicked();
-
-	void on_color_pick_button9_clicked();
-
-	void on_color_pick_button10_clicked();
-
-	void on_comboBox_2_currentIndexChanged(int index);
-
-	void on_comboBox_currentIndexChanged(int index);
-
-	void on_duration1_valueChanged(int arg1);
-
-	void on_duration2_valueChanged(int arg1);
-
-	void on_duration3_valueChanged(int arg1);
-
-	void on_duration4_valueChanged(int arg1);
-
-	void on_duration5_valueChanged(int arg1);
-
-	void on_duration6_valueChanged(int arg1);
-
-	void on_duration7_valueChanged(int arg1);
-
-	void on_duration8_valueChanged(int arg1);
-
-	void on_duration9_valueChanged(int arg1);
-
-	void on_duration10_valueChanged(int arg1);
-
-	void on_show_colorcycle1_checkbox_toggled(bool checked);
-
-	void on_show_colorcycle2_checkbox_toggled(bool checked);
-
-	void on_show_colorcycle3_checkbox_toggled(bool checked);
-
-public slots:
-	void pick_color_slot();
-
-private:
-	Ui::colorcycle_edit *ui;
-	int _selected_n;
-	int _selected_color_key;
-	QList<QWidget*> _button_list;
-	QList<QSpinBox*> _timer_list;
-	bool _data_loading;
-};
-
-#endif // COLORCYCLE_H
+    //std::cout << "sprite_preview_area::paintEvent - filename: " << filename << ", img.w: " << fg_image.width() << ", _sprite_n: " << _sprite_n << std::endl;
+    if (fg_image.width() != 0) {
+        fg_image = fg_image.scaled(fg_image.width()*2, fg_image.height()*2);
+        QRectF target(QPoint(center_x, center_y), QSize(total_w*2, total_h*2));
+        //std::cout << "center_x: " << center_x << ", center_y: " << center_y << std::endl;
+        QRectF source(QPoint(_sprite_n*total_w*2, 0), QSize(total_w*2, total_h*2));
+        painter.drawPixmap(target, fg_image, source);
+    }
+}
/v2/editor/mainwindow_tab/colorcycle.ui to /v2/editor/mainwindow_tab/animation.ui
--- a/v2/editor/mainwindow_tab/colorcycle.ui
+++ b/v2/editor/mainwindow_tab/animation.ui
@@ -1,399 +1,104 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
- <class>colorcycle_edit</class>
- <widget class="QWidget" name="colorcycle_edit">
+ <class>animation</class>
+ <widget class="QWidget" name="animation">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>831</width>
-    <height>478</height>
+    <width>400</width>
+    <height>380</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout_3">
-   <item row="2" column="0">
-    <layout class="QVBoxLayout" name="verticalLayout">
-     <property name="topMargin">
-      <number>0</number>
-     </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
      <property name="bottomMargin">
       <number>0</number>
      </property>
      <item>
-      <layout class="QGridLayout" name="gridLayout_4">
-       <property name="leftMargin">
-        <number>0</number>
-       </property>
-       <property name="topMargin">
-        <number>0</number>
-       </property>
-       <item row="1" column="0">
-        <widget class="QPushButton" name="color_pick_button1">
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>32</height>
-          </size>
-         </property>
+      <layout class="QGridLayout" name="gridLayout">
+       <item row="2" column="0">
+        <widget class="QLabel" name="label_4">
          <property name="text">
-          <string>Pick #1</string>
+          <string>File:</string>
          </property>
         </widget>
        </item>
-       <item row="1" column="10">
-        <spacer name="horizontalSpacer">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>40</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
+       <item row="2" column="1">
+        <widget class="QComboBox" name="filename"/>
        </item>
-       <item row="1" column="2">
-        <widget class="QPushButton" name="color_pick_button2">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>32</height>
-          </size>
-         </property>
+       <item row="0" column="0">
+        <widget class="QLabel" name="label_2">
          <property name="text">
-          <string>Pick #2</string>
+          <string>Animation:</string>
          </property>
         </widget>
        </item>
-       <item row="1" column="4">
-        <widget class="QPushButton" name="color_pick_button3">
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>32</height>
-          </size>
-         </property>
+       <item row="3" column="0">
+        <widget class="QLabel" name="label">
          <property name="text">
-          <string>Pick #3</string>
+          <string>Width:</string>
          </property>
         </widget>
        </item>
-       <item row="1" column="6">
-        <widget class="QPushButton" name="color_pick_button4">
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>32</height>
-          </size>
-         </property>
+       <item row="3" column="1">
+        <widget class="QSpinBox" name="width"/>
+       </item>
+       <item row="5" column="0">
+        <widget class="QLabel" name="label_5">
          <property name="text">
-          <string>Pick #4</string>
+          <string>Frame Delay:</string>
          </property>
         </widget>
        </item>
-       <item row="1" column="8">
-        <widget class="QPushButton" name="color_pick_button5">
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>32</height>
-          </size>
-         </property>
+       <item row="0" column="1">
+        <widget class="QComboBox" name="animation_select"/>
+       </item>
+       <item row="4" column="0">
+        <widget class="QLabel" name="label_3">
          <property name="text">
-          <string>Pick #5</string>
+          <string>Heigth:</string>
          </property>
         </widget>
        </item>
-       <item row="2" column="0">
-        <widget class="QPushButton" name="color_pick_button6">
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>Pick #6</string>
+       <item row="5" column="1">
+        <widget class="QSpinBox" name="frameDelay">
+         <property name="maximum">
+          <number>99999</number>
          </property>
         </widget>
        </item>
-       <item row="2" column="2">
-        <widget class="QPushButton" name="color_pick_button7">
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>32</height>
-          </size>
-         </property>
+       <item row="4" column="1">
+        <widget class="QSpinBox" name="heigth"/>
+       </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="label_6">
          <property name="text">
-          <string>Pick #7</string>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="4">
-        <widget class="QPushButton" name="color_pick_button8">
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>Pick #8</string>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="6">
-        <widget class="QPushButton" name="color_pick_button9">
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>Pick #9</string>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="8">
-        <widget class="QPushButton" name="color_pick_button10">
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>Pick #10</string>
+          <string>Name:</string>
          </property>
         </widget>
        </item>
        <item row="1" column="1">
-        <widget class="QSpinBox" name="duration1">
-         <property name="maximum">
-          <number>9999</number>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="3">
-        <widget class="QSpinBox" name="duration2">
-         <property name="maximum">
-          <number>9999</number>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="5">
-        <widget class="QSpinBox" name="duration3">
-         <property name="maximum">
-          <number>9999</number>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="7">
-        <widget class="QSpinBox" name="duration4">
-         <property name="maximum">
-          <number>9999</number>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="9">
-        <widget class="QSpinBox" name="duration5">
-         <property name="maximum">
-          <number>9999</number>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="1">
-        <widget class="QSpinBox" name="duration6">
-         <property name="maximum">
-          <number>9999</number>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="3">
-        <widget class="QSpinBox" name="duration7">
-         <property name="maximum">
-          <number>9999</number>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="5">
-        <widget class="QSpinBox" name="duration8">
-         <property name="maximum">
-          <number>9999</number>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="7">
-        <widget class="QSpinBox" name="duration9">
-         <property name="maximum">
-          <number>9999</number>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="9">
-        <widget class="QSpinBox" name="duration10">
-         <property name="maximum">
-          <number>9999</number>
-         </property>
-        </widget>
+        <widget class="QLineEdit" name="name"/>
        </item>
       </layout>
      </item>
      <item>
-      <widget class="QScrollArea" name="scrollArea">
-       <property name="verticalScrollBarPolicy">
-        <enum>Qt::ScrollBarAlwaysOn</enum>
-       </property>
-       <property name="horizontalScrollBarPolicy">
-        <enum>Qt::ScrollBarAlwaysOn</enum>
-       </property>
-       <property name="widgetResizable">
-        <bool>false</bool>
-       </property>
-       <widget class="QWidget" name="scrollAreaWidgetContents">
-        <property name="geometry">
-         <rect>
-          <x>0</x>
-          <y>0</y>
-          <width>798</width>
-          <height>341</height>
-         </rect>
-        </property>
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <widget class="colorcycle_map_preview" name="map_preview" native="true">
-         <property name="geometry">
-          <rect>
-           <x>0</x>
-           <y>-10</y>
-           <width>821</width>
-           <height>180</height>
-          </rect>
-         </property>
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-        </widget>
-       </widget>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item row="0" column="0">
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <widget class="QLabel" name="label">
-       <property name="text">
-        <string>Stage:</string>
+      <widget class="animationPreview" name="animation_preview" native="true">
+       <property name="minimumSize">
+        <size>
+         <width>200</width>
+         <height>200</height>
+        </size>
        </property>
       </widget>
      </item>
      <item>
-      <widget class="QComboBox" name="stage_selector"/>
-     </item>
-     <item>
-      <widget class="QLabel" name="label_3">
-       <property name="text">
-        <string>Map:</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QComboBox" name="comboBox_2">
-       <item>
-        <property name="text">
-         <string>0</string>
-        </property>
-       </item>
-       <item>
-        <property name="text">
-         <string>1</string>
-        </property>
-       </item>
-       <item>
-        <property name="text">
-         <string>2</string>
-        </property>
-       </item>
-      </widget>
-     </item>
-     <item>
-      <widget class="QLabel" name="label_2">
-       <property name="text">
-        <string>Color Key:</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QComboBox" name="comboBox">
-       <item>
-        <property name="text">
-         <string>GREEN</string>
-        </property>
-       </item>
-       <item>
-        <property name="text">
-         <string>PURPLE</string>
-        </property>
-       </item>
-       <item>
-        <property name="text">
-         <string>CYAN</string>
-        </property>
-       </item>
-      </widget>
-     </item>
-     <item>
-      <widget class="QCheckBox" name="show_colorcycle1_checkbox">
-       <property name="text">
-        <string>Show #1</string>
-       </property>
-       <property name="checked">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QCheckBox" name="show_colorcycle2_checkbox">
-       <property name="text">
-        <string>Show #2</string>
-       </property>
-       <property name="checked">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QCheckBox" name="show_colorcycle3_checkbox">
-       <property name="text">
-        <string>Show #3</string>
-       </property>
-       <property name="checked">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_2">
+      <spacer name="horizontalSpacer">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
@@ -407,13 +112,70 @@
      </item>
     </layout>
    </item>
+   <item>
+    <widget class="QScrollArea" name="scrollArea_5">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="verticalScrollBarPolicy">
+      <enum>Qt::ScrollBarAlwaysOn</enum>
+     </property>
+     <property name="horizontalScrollBarPolicy">
+      <enum>Qt::ScrollBarAlwaysOn</enum>
+     </property>
+     <property name="widgetResizable">
+      <bool>false</bool>
+     </property>
+     <widget class="QWidget" name="scrollAreaWidgetContents_5">
+      <property name="geometry">
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>334</width>
+        <height>305</height>
+       </rect>
+      </property>
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+        <horstretch>100</horstretch>
+        <verstretch>100</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="autoFillBackground">
+       <bool>true</bool>
+      </property>
+      <widget class="npcPreviewArea" name="preview_area" native="true">
+       <property name="geometry">
+        <rect>
+         <x>0</x>
+         <y>0</y>
+         <width>181</width>
+         <height>171</height>
+        </rect>
+       </property>
+       <property name="styleSheet">
+        <string notr="true"/>
+       </property>
+      </widget>
+     </widget>
+    </widget>
+   </item>
   </layout>
  </widget>
  <customwidgets>
   <customwidget>
-   <class>colorcycle_map_preview</class>
+   <class>npcPreviewArea</class>
    <extends>QWidget</extends>
-   <header>colorcycle_map_preview.h</header>
+   <header>npcpreviewarea.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>animationPreview</class>
+   <extends>QWidget</extends>
+   <header>animationpreview.h</header>
    <container>1</container>
   </customwidget>
  </customwidgets>
1 2 > >> (Page 1 of 2)