OSDN Git Service

ウィンドウ収納機能を追加
authorh2so5 <h2so5@git.sourceforge.jp>
Mon, 24 Sep 2012 13:00:03 +0000 (22:00 +0900)
committerh2so5 <h2so5@git.sourceforge.jp>
Mon, 24 Sep 2012 13:00:03 +0000 (22:00 +0900)
20 files changed:
client/Card.cpp
client/Card.hpp
client/WindowManager.cpp
client/WindowManager.hpp
client/bin/cards/bgmlist/icon.png [new file with mode: 0644]
client/bin/cards/modellist/icon.png [new file with mode: 0644]
client/bin/cards/textchat/icon.png [new file with mode: 0644]
client/bin/resources/images/gui/gui_close_button.png [new file with mode: 0644]
client/bin/resources/images/gui/gui_icon_base_close.png [deleted file]
client/bin/resources/images/gui/gui_icon_input.png [new file with mode: 0644]
client/bin/resources/images/gui/gui_icon_map.png [new file with mode: 0644]
client/scene/Dashboard.cpp [new file with mode: 0644]
client/scene/Dashboard.hpp [new file with mode: 0644]
client/scene/MainLoop.cpp
client/scene/Option.cpp
client/ui/InputBox.cpp
client/ui/InputBox.hpp
client/ui/UISuper.cpp
client/ui/UISuper.hpp
client/version.hpp

index 1b2459b..bc104e4 100644 (file)
@@ -106,6 +106,9 @@ Card::Card(
                                assert(!ui_board_obj_.IsEmpty() && ui_board_obj_->IsObject());\r
             });\r
 \r
+       auto ptr = *static_cast<UIBasePtr*>(ui_board_obj_->GetPointerFromInternalField(0));\r
+       ptr->set_icon_image_handle(\r
+               ResourceManager::LoadCachedGraph(unicode::ToTString(source_folder_ + "/" + icon_)));\r
 }\r
 \r
 Card::~Card()\r
@@ -1254,30 +1257,30 @@ void Card::Update()
 {\r
        MMO_PROFILE_FUNCTION;\r
 \r
-    static int cnt = 0;\r
-    if (!ui_board_obj_.IsEmpty() && ui_board_obj_->IsObject()) {\r
-               auto ptr = *static_cast<UIBasePtr*>(ui_board_obj_->GetPointerFromInternalField(0));\r
-               if (ptr->children_size() > 0) {\r
-                       ptr->Update();\r
-                       if (cnt % 2 == 0) {\r
-                               ptr->AsyncUpdate();\r
-                       }\r
-               }\r
-    }\r
-    cnt++;\r
+  //  static int cnt = 0;\r
+  //  if (!ui_board_obj_.IsEmpty() && ui_board_obj_->IsObject()) {\r
+               //auto ptr = *static_cast<UIBasePtr*>(ui_board_obj_->GetPointerFromInternalField(0));\r
+               //if (ptr->children_size() > 0) {\r
+               //      ptr->Update();\r
+               //      if (cnt % 2 == 0) {\r
+               //              ptr->AsyncUpdate();\r
+               //      }\r
+               //}\r
+  //  }\r
+  //  cnt++;\r
 }\r
 \r
 void Card::Draw()\r
 {\r
        MMO_PROFILE_FUNCTION;\r
 \r
-    if (!ui_board_obj_.IsEmpty() && ui_board_obj_->IsObject()) {\r
-        auto ptr = *static_cast<UIBasePtr*>(ui_board_obj_->GetPointerFromInternalField(0));\r
+   // if (!ui_board_obj_.IsEmpty() && ui_board_obj_->IsObject()) {\r
+   //     auto ptr = *static_cast<UIBasePtr*>(ui_board_obj_->GetPointerFromInternalField(0));\r
 \r
-        if (ptr->children_size() > 0) {\r
-                       ptr->Draw();\r
-        }\r
-    }\r
+   //     if (ptr->children_size() > 0) {\r
+                       //ptr->Draw();\r
+   //     }\r
+   // }\r
 }\r
 \r
 UIBasePtr Card::GetWindow() const\r
@@ -1308,14 +1311,14 @@ void Card::ProcessInput(InputManager* input)
  //   CheckFunctionKey(KEY_INPUT_F11, "F11", *input);\r
  //   CheckFunctionKey(KEY_INPUT_F12, "F12", *input);\r
 \r
-       script_.With([&](const Handle<Context>& context){\r
-               if (!ui_board_obj_.IsEmpty() && ui_board_obj_->IsObject()) {\r
-                       auto ptr = *static_cast<UIBasePtr*>(ui_board_obj_->GetPointerFromInternalField(0));\r
-                       if (ptr->children_size() > 0) {\r
-                               ptr->ProcessInput(input);\r
-                       }\r
-               }\r
-       });\r
+       //script_.With([&](const Handle<Context>& context){\r
+       //      if (!ui_board_obj_.IsEmpty() && ui_board_obj_->IsObject()) {\r
+       //              auto ptr = *static_cast<UIBasePtr*>(ui_board_obj_->GetPointerFromInternalField(0));\r
+       //              if (ptr->children_size() > 0) {\r
+       //                      ptr->ProcessInput(input);\r
+       //              }\r
+       //      }\r
+       //});\r
 }\r
 \r
 void Card::CheckFunctionKey(int keynum, const std::string& name, const InputManager& input)\r
@@ -1593,6 +1596,11 @@ int Card::focus_index() const
     return -1;\r
 }\r
 \r
+ScriptEnvironment& Card::script()\r
+{\r
+       return script_;\r
+}\r
+\r
 void Card::set_max_local_storage_size(int size)\r
 {\r
     max_local_storage_size = size;\r
index 44a9604..c0c5a0d 100644 (file)
Binary files a/client/Card.hpp and b/client/Card.hpp differ
index fb45c72..ec8ff51 100644 (file)
 WindowManager::WindowManager(const ManagerAccessorPtr& manager_accessor) :
 manager_accessor_(manager_accessor)
 {
-
+       close_button_image_handle_ = 
+               ResourceManager::LoadCachedGraph(_T("resources/images/gui/gui_close_button.png"));
+       icon_base_image_handle_ = 
+               ResourceManager::LoadCachedGraph(_T("resources/images/gui/gui_icon_base.png"));
 }
 
 void WindowManager::Init()
@@ -22,16 +25,51 @@ void WindowManager::Init()
 
 void WindowManager::ProcessInput(InputManager* input)
 {
+       closed_windows_.clear();
+
        BOOST_FOREACH(const auto& window, windows_) {
                if (auto ptr = window.lock()) {
-                       ptr->ProcessInput(input);
+                       int x = ptr->absolute_x() - 12;
+                       int y = ptr->absolute_y() - 12;
+
+                       bool hover = (x <= input->GetMouseX() && input->GetMouseX() <= x + 30
+                               && y <= input->GetMouseY() && input->GetMouseY() <= y + 30);
+
+                       if (hover && input->GetMouseLeftCount() == 1) {
+                               ptr->set_visible(false);
+                               input->CancelMouseLeft();
+                       }
+
+                       if (ptr->visible()) {
+                               ptr->ProcessInput(input);
+                       } else {
+                               closed_windows_.push_back(ptr);
+                       }
                }
        }
 
        auto card_manager = manager_accessor_->card_manager().lock();
        BOOST_FOREACH(const auto& card, card_manager->cards()) {
                if (auto ptr = card->GetWindow()) {
-                       // ptr->ProcessInput(input);
+                       int x = ptr->absolute_x() - 12;
+                       int y = ptr->absolute_y() - 12;
+
+                       bool hover = (x <= input->GetMouseX() && input->GetMouseX() <= x + 30
+                               && y <= input->GetMouseY() && input->GetMouseY() <= y + 30);
+
+                       if (hover && input->GetMouseLeftCount() == 1) {
+                               ptr->set_visible(false);
+                               input->CancelMouseLeft();
+                       }
+
+                       if (ptr->visible()) {
+                               card->script().With([&](const Handle<Context>& context)
+                               {
+                                       ptr->ProcessInput(input);
+                               });
+                       } else {
+                               closed_windows_.push_back(ptr);
+                       }
                }
        }
 }
@@ -47,7 +85,7 @@ void WindowManager::Update()
        auto card_manager = manager_accessor_->card_manager().lock();
        BOOST_FOREACH(const auto& card, card_manager->cards()) {
                if (auto ptr = card->GetWindow()) {
-                       // ptr->Update();
+                       ptr->Update();
                }
        }
 }
@@ -56,18 +94,88 @@ void WindowManager::Draw()
 {
        BOOST_FOREACH(const auto& window, windows_) {
                if (auto ptr = window.lock()) {
-                       ptr->Draw();
+                       if (ptr->visible()) {
+                               ptr->Draw();
+                       }
                }
        }
 
        auto card_manager = manager_accessor_->card_manager().lock();
        BOOST_FOREACH(const auto& card, card_manager->cards()) {
                if (auto ptr = card->GetWindow()) {
-                       // ptr->Draw();
+                       if (ptr->visible()) {
+                               ptr->Draw();
+                       }
                }
        }
 }
 
+void WindowManager::DrawButtons()
+{
+       BOOST_FOREACH(const auto& window, windows_) {
+               if (auto ptr = window.lock()) {
+                       if (ptr->visible()) {
+                               int x = ptr->absolute_x() - 12;
+                               int y = ptr->absolute_y() - 12;
+
+                               DrawGraph(x, y, *close_button_image_handle_, TRUE);
+                       }
+               }
+       }
+
+       auto card_manager = manager_accessor_->card_manager().lock();
+       BOOST_FOREACH(const auto& card, card_manager->cards()) {
+               if (auto ptr = card->GetWindow()) {
+                       if (ptr->visible()) {
+                               int x = ptr->absolute_x() - 12;
+                               int y = ptr->absolute_y() - 12;
+
+                               DrawGraph(x, y, *close_button_image_handle_, TRUE);
+                       }
+               }
+       }
+}
+
+
+void WindowManager::DrawIcons(const Rect& rect)
+{
+       int x = 32;
+       BOOST_FOREACH(const auto& window, closed_windows_) {
+               if (auto ptr = window.lock()) {
+                       ImageHandlePtr image_handle;
+                       if (auto custom_icon = ptr->icon_image_handle()) {
+                               image_handle = custom_icon;
+                       } else {
+                               image_handle = icon_base_image_handle_;
+                       }
+                       DrawGraph(rect.x + x, rect.y + 100 + 4, *image_handle, TRUE);
+                       x += 64;
+               }
+       }
+}
+
+void WindowManager::ProcessInputIcons(const Rect& rect, InputManager* input)
+{
+       int x = 32;
+       BOOST_FOREACH(const auto& window, closed_windows_) {
+               if (auto ptr = window.lock()) {
+
+                       int icon_x = rect.x + x;
+                       int icon_y = rect.y + 100 + 4;
+
+                       bool hover = (icon_x <= input->GetMouseX() && input->GetMouseX() <= icon_x + 48
+                               && icon_y <= input->GetMouseY() && input->GetMouseY() <= icon_y + 48);
+
+                       if (hover && input->GetMouseLeftCount() == 1) {
+                               ptr->set_visible(true);
+                               input->CancelMouseLeft();
+                       }
+                       x += 64;
+               }
+       }
+}
+
+
 void WindowManager::AddWindow(const UISuperPtr& window)
 {
        windows_.push_back(window);
index 9393d6e..3c33969 100644 (file)
@@ -5,6 +5,7 @@
 #pragma once
 
 #include "ManagerAccessor.hpp"
+#include "ResourceManager.hpp"
 #include "ui/UISuper.hpp"
 #include <vector>
 
@@ -17,13 +18,20 @@ class WindowManager {
         void ProcessInput(InputManager* input);
         void Update();
         void Draw();
+               
+        void DrawButtons();
+        void DrawIcons(const Rect& rect);
+               void ProcessInputIcons(const Rect& rect, InputManager* input);
 
                void AddWindow(const UISuperPtr& window);
 
     private:
         ManagerAccessorPtr manager_accessor_;
 
+               ImageHandlePtr close_button_image_handle_;
+               ImageHandlePtr icon_base_image_handle_;
                std::vector<UISuperWeakPtr> windows_;
+               std::vector<UISuperWeakPtr> closed_windows_;
 };
 
 typedef std::shared_ptr<WindowManager> WindowManagerPtr;
diff --git a/client/bin/cards/bgmlist/icon.png b/client/bin/cards/bgmlist/icon.png
new file mode 100644 (file)
index 0000000..0def3d3
Binary files /dev/null and b/client/bin/cards/bgmlist/icon.png differ
diff --git a/client/bin/cards/modellist/icon.png b/client/bin/cards/modellist/icon.png
new file mode 100644 (file)
index 0000000..9f1d904
Binary files /dev/null and b/client/bin/cards/modellist/icon.png differ
diff --git a/client/bin/cards/textchat/icon.png b/client/bin/cards/textchat/icon.png
new file mode 100644 (file)
index 0000000..c576886
Binary files /dev/null and b/client/bin/cards/textchat/icon.png differ
diff --git a/client/bin/resources/images/gui/gui_close_button.png b/client/bin/resources/images/gui/gui_close_button.png
new file mode 100644 (file)
index 0000000..ef65d7f
Binary files /dev/null and b/client/bin/resources/images/gui/gui_close_button.png differ
diff --git a/client/bin/resources/images/gui/gui_icon_base_close.png b/client/bin/resources/images/gui/gui_icon_base_close.png
deleted file mode 100644 (file)
index 54279da..0000000
Binary files a/client/bin/resources/images/gui/gui_icon_base_close.png and /dev/null differ
diff --git a/client/bin/resources/images/gui/gui_icon_input.png b/client/bin/resources/images/gui/gui_icon_input.png
new file mode 100644 (file)
index 0000000..cc8333a
Binary files /dev/null and b/client/bin/resources/images/gui/gui_icon_input.png differ
diff --git a/client/bin/resources/images/gui/gui_icon_map.png b/client/bin/resources/images/gui/gui_icon_map.png
new file mode 100644 (file)
index 0000000..176b4ca
Binary files /dev/null and b/client/bin/resources/images/gui/gui_icon_map.png differ
diff --git a/client/scene/Dashboard.cpp b/client/scene/Dashboard.cpp
new file mode 100644 (file)
index 0000000..00fc945
--- /dev/null
@@ -0,0 +1,173 @@
+//
+// Dashboard.cpp
+//
+
+#include "Dashboard.hpp"
+#include "../ManagerAccessor.hpp"
+#include "../AccountManager.hpp"
+#include "../CommandManager.hpp"
+#include "../PlayerManager.hpp"
+#include "../CardManager.hpp"
+#include "../AccountManager.hpp"
+#include "../WindowManager.hpp"
+
+namespace scene {
+
+const int Dashboard::TAB_BLOCK_HEIGHT = 32;
+const int Dashboard::TAB_BLOCK_WIDTH = 128;
+
+Dashboard::Dashboard(const ManagerAccessorPtr& manager_accessor,
+                       const BasePtr& background_scene) :
+      manager_accessor_(manager_accessor),
+      config_manager_(manager_accessor->config_manager().lock()),
+      card_manager_(manager_accessor->card_manager().lock()),
+      account_manager_(manager_accessor->account_manager().lock()),
+      window_manager_(manager_accessor->window_manager().lock()),
+         background_scene_(background_scene),
+      start_count_(0),
+         end_count_(0)
+{
+       manager_accessor_->set_window_manager(WindowManagerWeakPtr());
+
+    manager_accessor_->set_config_manager(config_manager_);
+    manager_accessor_->set_card_manager(card_manager_);
+    manager_accessor_->set_account_manager(account_manager_);
+
+    base_image_handle_ = ResourceManager::LoadCachedDivGraph<4>(
+            _T("resources/images/gui/gui_option_base.png"), 2, 2, 96, 96);
+
+    tab_base_image_handle_ = ResourceManager::LoadCachedDivGraph<3>(
+            _T("resources/images/gui/gui_option_tab_base.png"), 1, 3, 128, 32);
+
+}
+
+Dashboard::~Dashboard()
+{
+}
+
+void Dashboard::Begin()
+{
+}
+
+void Dashboard::Update()
+{
+       if (end_count_ > 0) {
+               end_count_++;
+       } else {
+               start_count_++;
+       }
+
+       if (background_scene_) {
+               background_scene_->Update();
+       }
+
+    int screen_width, screen_height;
+    GetScreenState(&screen_width, &screen_height, nullptr);
+
+       if (end_count_ > 0) {
+               bg_alpha_ = 150 * ((10 - end_count_) / 10.0);
+       } else {
+               bg_alpha_ = 150 * (start_count_ / 10.0);
+       }
+       bg_alpha_ = std::min(150, bg_alpha_);
+       
+    base_rect_.width = 800;
+    base_rect_.height = 160;
+    base_rect_.x = (screen_width - base_rect_.width) / 2;
+
+       if (end_count_ > 0) {
+               base_rect_.y = -100 - base_rect_.height * (end_count_ / 10.0);
+       } else {
+               base_rect_.y = -100 - base_rect_.height * ((10 - start_count_) / 10.0);
+       }
+       base_rect_.y = std::min(-100, base_rect_.y);
+
+       window_manager_->Update();
+}
+
+void Dashboard::ProcessInput(InputManager* input)
+{
+       window_manager_->ProcessInputIcons(base_rect_, input);
+       window_manager_->ProcessInput(input);
+
+       bool hover = (base_rect_.x <= input->GetMouseX() && input->GetMouseX() <= base_rect_.x + base_rect_.width
+        && base_rect_.y <= input->GetMouseY() && input->GetMouseY() <= base_rect_.y + base_rect_.height);
+
+       if (input->GetKeyCount(KEY_INPUT_F2) == 1 ||
+               input->GetKeyCount(KEY_INPUT_ESCAPE) == 1 ||
+               (!hover && (input->GetMouseLeftCount() == 1 || input->GetMouseRightCount() == 1))) {
+               end_count_++;
+       }
+}
+
+void Dashboard::Draw()
+{
+       if (background_scene_) {
+               background_scene_->Draw();
+       }
+
+    int screen_width, screen_height;
+    GetScreenState(&screen_width, &screen_height, nullptr);
+       
+       SetDrawBlendMode(DX_BLENDMODE_ALPHA, bg_alpha_);
+
+       DrawBox(0, 0, screen_width, screen_height, GetColor(0, 0, 0), TRUE);
+       SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
+
+       window_manager_->Draw();
+
+       SetDrawBlendMode(DX_BLENDMODE_ALPHA, bg_alpha_ * 255 / 150);
+       window_manager_->DrawButtons();
+       SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
+
+       int BASE_BLOCK_SIZE = 96;
+
+       int x = base_rect_.x - 32;
+       int y = base_rect_.y;
+       int width = base_rect_.width + 64;
+       int height = base_rect_.height + 32;
+
+    DrawGraph(x, y, *base_image_handle_[0], TRUE);
+    DrawGraph(x + width - BASE_BLOCK_SIZE, y, *base_image_handle_[1], TRUE);
+    DrawGraph(x, y + height - BASE_BLOCK_SIZE, *base_image_handle_[2], TRUE);
+    DrawGraph(x + width - BASE_BLOCK_SIZE, y + height - BASE_BLOCK_SIZE, *base_image_handle_[3], TRUE);
+
+    DrawRectExtendGraphF(x + BASE_BLOCK_SIZE, y,
+                         x + width - BASE_BLOCK_SIZE, y + BASE_BLOCK_SIZE,
+                         0, 0, 1, BASE_BLOCK_SIZE, *base_image_handle_[1], TRUE);
+
+    DrawRectExtendGraphF(x + BASE_BLOCK_SIZE, y + height - BASE_BLOCK_SIZE,
+                         x + width - BASE_BLOCK_SIZE, y + height,
+                         0, 0, 1, BASE_BLOCK_SIZE, *base_image_handle_[3], TRUE);
+
+    DrawRectExtendGraphF(x, y + BASE_BLOCK_SIZE,
+                         x + BASE_BLOCK_SIZE, y + height - BASE_BLOCK_SIZE,
+                         0, 0, BASE_BLOCK_SIZE, 1, *base_image_handle_[2], TRUE);
+
+    DrawRectExtendGraphF(x + width - BASE_BLOCK_SIZE, y + BASE_BLOCK_SIZE,
+                         x + width, y + height - BASE_BLOCK_SIZE,
+                         0, 0, BASE_BLOCK_SIZE, 1, *base_image_handle_[3], TRUE);
+
+    DrawRectExtendGraphF(x + BASE_BLOCK_SIZE, y + BASE_BLOCK_SIZE,
+                         x + width - BASE_BLOCK_SIZE, y + height - BASE_BLOCK_SIZE,
+                         0, 0, 1, 1, *base_image_handle_[3], TRUE);
+
+       window_manager_->DrawIcons(base_rect_);
+
+}
+
+void Dashboard::End()
+{
+
+}
+
+BasePtr Dashboard::NextScene()
+{
+    if (end_count_ > 10) {
+               manager_accessor_->set_window_manager(window_manager_);
+        return background_scene_;
+    } else {
+        return BasePtr();
+    }
+}
+}
\ No newline at end of file
diff --git a/client/scene/Dashboard.hpp b/client/scene/Dashboard.hpp
new file mode 100644 (file)
index 0000000..fb1323a
--- /dev/null
@@ -0,0 +1,52 @@
+//
+// Dashboard.hpp
+//
+
+#pragma once
+
+#include <boost/property_tree/json_parser.hpp>
+#include "Base.hpp"
+#include "../ManagerHeader.hpp"
+#include "../ManagerAccessor.hpp"
+#include "../ResourceManager.hpp"
+#include "../ui/UISuper.hpp"
+
+using namespace boost::property_tree;
+
+namespace scene {
+
+class Dashboard : public Base {
+    public:
+        Dashboard(const ManagerAccessorPtr& manager_accessor,
+                       const BasePtr& background_scene);
+        ~Dashboard();
+        void Begin();
+        void Update();
+               void ProcessInput(InputManager*);
+        void Draw();
+        void End();
+        BasePtr NextScene();
+
+    private:
+        ManagerAccessorPtr manager_accessor_;
+        ConfigManagerPtr config_manager_;
+        CardManagerPtr card_manager_;
+        AccountManagerPtr account_manager_;
+        WindowManagerPtr window_manager_;
+
+               BasePtr background_scene_;
+
+        int start_count_;
+        int end_count_;
+
+               int bg_alpha_;
+               Rect base_rect_;
+               std::array<ImageHandlePtr,4> base_image_handle_;
+               std::array<ImageHandlePtr,3> tab_base_image_handle_;
+
+       private:
+               static const int TAB_BLOCK_HEIGHT;
+               static const int TAB_BLOCK_WIDTH;
+};
+
+}
\ No newline at end of file
index 970de58..7d1e2eb 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "MainLoop.hpp"
 #include "Option.hpp"
+#include "Dashboard.hpp"
 #include <vector>
 #include <algorithm>
 #include "../ResourceManager.hpp"
@@ -32,9 +33,15 @@ MainLoop::MainLoop(const ManagerAccessorPtr& manager_accessor) :
     manager_accessor_->set_window_manager(window_manager_);
 
     inputbox_->ReloadTabs();
+       inputbox_->Activate();
+       inputbox_->set_icon_image_handle(
+               ResourceManager::LoadCachedGraph(_T("resources/images/gui/gui_icon_input.png")));
+
        window_manager_->AddWindow(inputbox_);
 
        minimap_->UIPlacement(config_manager_->screen_width() - MINIMAP_MINSIZE - 12, 12);
+       minimap_->set_icon_image_handle(
+               ResourceManager::LoadCachedGraph(_T("resources/images/gui/gui_icon_map.png")));
        window_manager_->AddWindow(minimap_);
 
     player_manager_->Init();
@@ -55,7 +62,9 @@ void MainLoop::Begin()
 
 void MainLoop::Update()
 {
-       window_manager_->Update();
+       if (auto window_manager = manager_accessor_->window_manager().lock()) {
+               window_manager->Update();
+       }
     command_manager_->Update();
     player_manager_->Update();
     card_manager_->Update();
@@ -65,7 +74,9 @@ void MainLoop::Update()
 
 void MainLoop::ProcessInput(InputManager* input)
 {
-       window_manager_->ProcessInput(input);
+       if (auto window_manager = manager_accessor_->window_manager().lock()) {
+               window_manager->ProcessInput(input);
+       }
     player_manager_->ProcessInput(input);
     card_manager_->ProcessInput(input);
     world_manager_->ProcessInput(input);
@@ -97,7 +108,9 @@ void MainLoop::Draw()
     world_manager_->Draw();
     player_manager_->Draw();
     card_manager_->Draw();
-       window_manager_->Draw();
+       if (auto window_manager = manager_accessor_->window_manager().lock()) {
+               window_manager->Draw();
+       }
 }
 
 void MainLoop::End()
@@ -114,6 +127,9 @@ BasePtr MainLoop::NextScene()
        } else if (input.GetKeyCount(KEY_INPUT_F1) == 1) {
                inputbox_->Inactivate();
                return BasePtr(new scene::Option(manager_accessor_, shared_from_this()));
+       } else if (input.GetKeyCount(KEY_INPUT_F2) == 1) {
+               inputbox_->Inactivate();
+               return BasePtr(new scene::Dashboard(manager_accessor_, shared_from_this()));
        } else{
                return nullptr;
        }
index e186067..c00455e 100644 (file)
@@ -92,7 +92,7 @@ void Option::ProcessInput(InputManager* input)
 
        if (input->GetKeyCount(KEY_INPUT_F1) == 1 ||
                input->GetKeyCount(KEY_INPUT_ESCAPE) == 1 ||
-               (!hover && input->GetMouseLeftCount() == 1)) {
+               (!hover && (input->GetMouseLeftCount() == 1 || input->GetMouseRightCount() == 1))) {
                end_count_++;
        }
 
index 5fb429a..38f5d4c 100644 (file)
@@ -33,10 +33,6 @@ const int InputBox::IME_MAX_PAGE_SIZE = 6;
 const int InputBox::IME_MIN_WIDTH = 120;
 
 InputBox::InputBox(const ManagerAccessorPtr& manager_accessor) :
-                x_(100),
-                y_(100),
-                width_(800),
-                height_(100),
                 multiline_(true),
                 font_height_(ResourceManager::default_font_size()),
                 drag_offset_x_(-1),
@@ -50,6 +46,8 @@ InputBox::InputBox(const ManagerAccessorPtr& manager_accessor) :
                             std::vector<std::string>(), false, false))
 
 {
+       absolute_rect_ = Rect(100, 100, 800, 100);
+
     font_handle_ = ResourceManager::default_font_handle();
     bg_image_handle_ = ResourceManager::LoadCachedDivGraph<4>(
             _T("resources/images/gui/gui_inputbox_bg.png"), 2, 2, 24, 24);
@@ -64,10 +62,10 @@ InputBox::InputBox(const ManagerAccessorPtr& manager_accessor) :
 
     int screen_width, screen_height;
     GetScreenState(&screen_width, &screen_height, nullptr);
-    width_ = std::min(DEFAULT_MAX_WIDTH + 0, (int)(screen_width * 0.4));
-    height_ = input_.height() + BOX_TOP_MARGIN + BOX_BOTTOM_MARGIN;
-    x_ = (screen_width - width_) / 2;
-    y_ = screen_height - height_ - BOX_BOTTOM_MARGIN;
+    absolute_rect_.width = std::min(DEFAULT_MAX_WIDTH + 0, (int)(screen_width * 0.4));
+    absolute_rect_.height = input_.height() + BOX_TOP_MARGIN + BOX_BOTTOM_MARGIN;
+    absolute_rect_.x = (screen_width - absolute_rect_.width) / 2;
+    absolute_rect_.y = screen_height - absolute_rect_.height - BOX_BOTTOM_MARGIN;
 
     selecting_tab_index_ = 0;
 
@@ -115,7 +113,7 @@ void InputBox::DrawTabs()
 
     {
         int tab_index = 0;
-        SetDrawArea(x_, script_tab_.y, script_tab_.x, script_tab_.y + script_tab_.height);
+        SetDrawArea(absolute_rect_.x, script_tab_.y, script_tab_.x, script_tab_.y + script_tab_.height);
         BOOST_FOREACH(auto& tab, tabs_) {
 
             std::array<ImageHandlePtr, 4>* image_handle;
@@ -155,11 +153,11 @@ void InputBox::DrawTabs()
                     TRUE);
 
             SetDrawBlendMode(DX_BLENDMODE_ALPHA, 100);
-            DrawStringToHandle(tab_x + 9, y_ + TAB_TOP_MARGIN + 1, unicode::ToTString(tab.name).c_str(),
+            DrawStringToHandle(tab_x + 9, absolute_rect_.y + TAB_TOP_MARGIN + 1, unicode::ToTString(tab.name).c_str(),
                     GetColor(255, 255, 255), font_handle_);
             SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
 
-            DrawStringToHandle(tab_x + 9, y_ + TAB_TOP_MARGIN, unicode::ToTString(tab.name).c_str(),
+            DrawStringToHandle(tab_x + 9, absolute_rect_.y + TAB_TOP_MARGIN, unicode::ToTString(tab.name).c_str(),
                     GetColor(0, 0, 0), font_handle_);
 
             tab_index++;
@@ -207,7 +205,7 @@ void InputBox::DrawTabs()
 
         SetDrawBright(255, 255, 255);
 
-        DrawGraph(x_ + width_ - TAB_SIDE_MARGIN - 16, y_ + TAB_TOP_MARGIN,
+        DrawGraph(absolute_rect_.x + absolute_rect_.width - TAB_SIDE_MARGIN - 16, absolute_rect_.y + TAB_TOP_MARGIN,
                 *script_icon_image_handle_, TRUE);
     }
 }
@@ -220,29 +218,29 @@ void InputBox::DrawBase()
         SetDrawBlendMode(DX_BLENDMODE_ADD, 150);
     }
 
-    DrawGraph(x_, y_, *bg_image_handle_[0], TRUE);
-    DrawGraph(x_ + width_ - 24, y_, *bg_image_handle_[1], TRUE);
-    DrawGraph(x_, y_ + height_ - 24, *bg_image_handle_[2], TRUE);
-    DrawGraph(x_ + width_ - 24, y_ + height_ - 24, *bg_image_handle_[3], TRUE);
+    DrawGraph(absolute_rect_.x, absolute_rect_.y, *bg_image_handle_[0], TRUE);
+    DrawGraph(absolute_rect_.x + absolute_rect_.width - 24, absolute_rect_.y, *bg_image_handle_[1], TRUE);
+    DrawGraph(absolute_rect_.x, absolute_rect_.y + absolute_rect_.height - 24, *bg_image_handle_[2], TRUE);
+    DrawGraph(absolute_rect_.x + absolute_rect_.width - 24, absolute_rect_.y + absolute_rect_.height - 24, *bg_image_handle_[3], TRUE);
 
-    DrawRectExtendGraphF(x_ + 24, y_,
-                         x_ + width_ - 24, y_ + 24,
+    DrawRectExtendGraphF(absolute_rect_.x + 24, absolute_rect_.y,
+                         absolute_rect_.x + absolute_rect_.width - 24, absolute_rect_.y + 24,
                          0, 0, 1, 24, *bg_image_handle_[1], TRUE);
 
-    DrawRectExtendGraphF(x_ + 24, y_ + height_ - 24,
-                         x_ + width_ - 24, y_ + height_,
+    DrawRectExtendGraphF(absolute_rect_.x + 24, absolute_rect_.y + absolute_rect_.height - 24,
+                         absolute_rect_.x + absolute_rect_.width - 24, absolute_rect_.y + absolute_rect_.height,
                          0, 0, 1, 24, *bg_image_handle_[3], TRUE);
 
-    DrawRectExtendGraphF(x_, y_ + 24,
-                         x_ + 24, y_ + height_ - 24,
+    DrawRectExtendGraphF(absolute_rect_.x, absolute_rect_.y + 24,
+                         absolute_rect_.x + 24, absolute_rect_.y + absolute_rect_.height - 24,
                          0, 0, 24, 1, *bg_image_handle_[2], TRUE);
 
-    DrawRectExtendGraphF(x_ + width_ - 24, y_ + 24,
-                         x_ + width_, y_ + height_ - 24,
+    DrawRectExtendGraphF(absolute_rect_.x + absolute_rect_.width - 24, absolute_rect_.y + 24,
+                         absolute_rect_.x + absolute_rect_.width, absolute_rect_.y + absolute_rect_.height - 24,
                          0, 0, 24, 1, *bg_image_handle_[3], TRUE);
 
-    DrawRectExtendGraphF(x_ +  24, y_ + 24,
-                         x_ + width_ - 24, y_ + height_ - 24,
+    DrawRectExtendGraphF(absolute_rect_.x +  24, absolute_rect_.y + 24,
+                         absolute_rect_.x + absolute_rect_.width - 24, absolute_rect_.y + absolute_rect_.height - 24,
                          0, 0, 1, 1, *bg_image_handle_[3], TRUE);
 
     SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
@@ -360,16 +358,16 @@ void InputBox::ProcessInput(InputManager* input)
 
     int screen_height;
     GetScreenState(nullptr, &screen_height, nullptr);
-    if (y_ + height_ > screen_height - BOX_TOP_MARGIN) {
-        y_ -= new_height - height_;
+    if (absolute_rect_.y + absolute_rect_.height > screen_height - BOX_TOP_MARGIN) {
+        absolute_rect_.y -= new_height - absolute_rect_.height;
         // input_.set_y(y_ + BOX_TOP_MARGIN);
     }
 
-    height_ = new_height;
+    absolute_rect_.height = new_height;
         
-    input_.set_y(y_ + BOX_TOP_MARGIN);
-    input_.set_x(x_ + INPUT_MARGIN_X);
-    input_.set_width(width_ - INPUT_MARGIN_X * 2);
+    input_.set_y(absolute_rect_.y + BOX_TOP_MARGIN);
+    input_.set_x(absolute_rect_.x + INPUT_MARGIN_X);
+    input_.set_width(absolute_rect_.width - INPUT_MARGIN_X * 2);
 
         //line_buffer.clear();
         //line_width = 0;
@@ -404,8 +402,8 @@ void InputBox::ReloadTabs()
                 tab.card = card;
                 tab.name = unicode::ToTString(card->name());
 
-                tab.x = x_ + TAB_SIDE_MARGIN + tab_offset_x - 9;
-                tab.y = y_ - 3;
+                tab.x = absolute_rect_.x + TAB_SIDE_MARGIN + tab_offset_x - 9;
+                tab.y = absolute_rect_.y - 3;
                 tab.height = font_height_ + TAB_TOP_MARGIN * 2 + 3 * 2;
 
                 auto name = unicode::ToTString(tab.name);
@@ -463,8 +461,8 @@ void InputBox::UpdateTabs()
     // タブ選択
     int tab_offset_x = 0;
     BOOST_FOREACH(auto& tab, tabs_) {
-        tab.x = x_ + TAB_SIDE_MARGIN + tab_offset_x - 9;
-        tab.y = y_ - 3;
+        tab.x = absolute_rect_.x + TAB_SIDE_MARGIN + tab_offset_x - 9;
+        tab.y = absolute_rect_.y - 3;
         tab.height = font_height_ + TAB_TOP_MARGIN * 2 + 3 * 2;
 
         auto name = unicode::ToTString(tab.name);
@@ -474,8 +472,8 @@ void InputBox::UpdateTabs()
         tab_offset_x += tab.width - 3;
     }
 
-    script_tab_.x = x_ + width_ - TAB_SIDE_MARGIN - 16 - 9;
-    script_tab_.y = y_ - 3;
+    script_tab_.x = absolute_rect_.x + absolute_rect_.width - TAB_SIDE_MARGIN - 16 - 9;
+    script_tab_.y = absolute_rect_.y - 3;
     script_tab_.width = 16 + 18;
     script_tab_.height = font_height_ + TAB_TOP_MARGIN * 2 + 3 * 2;
 }
@@ -486,30 +484,30 @@ void InputBox::UpdateBase(InputManager* input)
     int screen_width, screen_height;
     GetScreenState(&screen_width, &screen_height, nullptr);
 
-    bool hover = (x_ <= input->GetMouseX() && input->GetMouseX() <= x_ + width_
-            && y_ <= input->GetMouseY() && input->GetMouseY() <= y_ + height_);
+    bool hover = (absolute_rect_.x <= input->GetMouseX() && input->GetMouseX() <= absolute_rect_.x + absolute_rect_.width
+            && absolute_rect_.y <= input->GetMouseY() && input->GetMouseY() <= absolute_rect_.y + absolute_rect_.height);
 
     //bool input_hover = (input_x_ <= input->GetMouseX()
     //        && input->GetMouseX() <= input_x_ + input_width_
     //        && input_y_ <= input->GetMouseY()
     //        && input->GetMouseY() <= input_y_ + input_height_);
 
-    bool corner_hover = (x_ + width_ - 18 <= input->GetMouseX()
-            && input->GetMouseX() <= x_ + width_
-            && y_ + height_ - 18 <= input->GetMouseY()
-            && input->GetMouseY() <= y_ + height_);
+    bool corner_hover = (absolute_rect_.x + absolute_rect_.width - 18 <= input->GetMouseX()
+            && input->GetMouseX() <= absolute_rect_.x + absolute_rect_.width
+            && absolute_rect_.y + absolute_rect_.height - 18 <= input->GetMouseY()
+            && input->GetMouseY() <= absolute_rect_.y + absolute_rect_.height);
 
     // ドラッグ処理
     if (input->GetMouseLeft()) {
         if (input->GetPrevMouseLeft() == 0 && drag_offset_x_ < 0 && hover
                  && !corner_hover) {
-            drag_offset_x_ = input->GetMouseX() - x_;
-            drag_offset_y_ = input->GetMouseY() - y_;
+            drag_offset_x_ = input->GetMouseX() - absolute_rect_.x;
+            drag_offset_y_ = input->GetMouseY() - absolute_rect_.y;
         }
         if (input->GetPrevMouseLeft() == 0 && drag_resize_offset_x_ < 0
                 && corner_hover) {
-            drag_resize_offset_x_ = x_ + width_ - input->GetMouseX();
-            drag_resize_offset_y_ = y_ + height_ - input->GetMouseY();
+            drag_resize_offset_x_ = absolute_rect_.x + absolute_rect_.width - input->GetMouseX();
+            drag_resize_offset_y_ = absolute_rect_.y + absolute_rect_.height - input->GetMouseY();
         }
         if (hover && !IsActive()) {
             Activate();
@@ -525,16 +523,16 @@ void InputBox::UpdateBase(InputManager* input)
     }
 
     if (drag_offset_x_ >= 0) {
-        x_ = input->GetMouseX() - drag_offset_x_;
-        y_ = input->GetMouseY() - drag_offset_y_;
-        x_ = std::max(0, x_); x_ = std::min(screen_width - width_, x_);
-        y_ = std::max(0, y_); y_ = std::min(screen_height - height_, y_);
+        absolute_rect_.x = input->GetMouseX() - drag_offset_x_;
+        absolute_rect_.y = input->GetMouseY() - drag_offset_y_;
+        absolute_rect_.x = std::max(0, absolute_rect_.x); absolute_rect_.x = std::min(screen_width - absolute_rect_.width, absolute_rect_.x);
+        absolute_rect_.y = std::max(0, absolute_rect_.y); absolute_rect_.y = std::min(screen_height - absolute_rect_.height, absolute_rect_.y);
         input->CancelMouseLeft();
     } else if (drag_resize_offset_x_ >= 0) {
-        int new_width = input->GetMouseX() - x_ + drag_resize_offset_x_;
+        int new_width = input->GetMouseX() - absolute_rect_.x + drag_resize_offset_x_;
         new_width = std::max(new_width, (BOX_MIN_WIDTH + 0));
-        new_width = std::min(new_width, screen_width - x_);
-        width_ = new_width;
+        new_width = std::min(new_width, screen_width - absolute_rect_.x);
+        absolute_rect_.width = new_width;
         input->CancelMouseLeft();
     }
 }
index df6b087..9c1f4e7 100644 (file)
@@ -54,7 +54,6 @@ class InputBox : public UISuper {
         void SetScriptMode();
 
     private:
-        int x_, y_, width_, height_;
         int multiline_;
 
     private:
index 134dfba..eda0632 100644 (file)
@@ -216,4 +216,14 @@ void UISuper::set_offset_height(int offset_height)
 int UISuper::focus_index() const
 {
     return focus_index_;
+}
+
+ImageHandlePtr UISuper::icon_image_handle() const
+{
+       return icon_image_handle_;
+}
+
+void UISuper::set_icon_image_handle(const ImageHandlePtr& handle)
+{
+       icon_image_handle_ = handle;
 }
\ No newline at end of file
index 038b01d..f90f9aa 100644 (file)
@@ -8,6 +8,7 @@
 #include <string>
 #include <iostream>
 #include <vector>
+#include "../ResourceManager.hpp"
 
 class InputManager;
 
@@ -80,6 +81,9 @@ class UISuper : public std::enable_shared_from_this<UISuper> {
 
                int focus_index() const;
 
+               ImageHandlePtr icon_image_handle() const;
+               void set_icon_image_handle(const ImageHandlePtr& handle);
+
         enum {
             DOCKING_NONE = 0,
             DOCKING_TOP = 1,
@@ -112,7 +116,7 @@ class UISuper : public std::enable_shared_from_this<UISuper> {
         bool visible_;
         std::string base_image_;
 
-
+               ImageHandlePtr icon_image_handle_;
 };
 
 typedef std::shared_ptr<UISuper> UISuperPtr;
index d76f644..0f8ac0d 100644 (file)
@@ -9,7 +9,7 @@
 
 #define MMO_VERSION_MAJOR 0
 #define MMO_VERSION_MINOR 3
-#define MMO_VERSION_REVISION 10
+#define MMO_VERSION_REVISION 11
 
 #define MMO_PROTOCOL_VERSION 2