diff --git a/modules/core_ui/icons/about.png b/modules/core_ui/icons/about.png new file mode 100644 index 00000000..5e30545c Binary files /dev/null and b/modules/core_ui/icons/about.png differ diff --git a/modules/core_ui/icons/exit.png b/modules/core_ui/icons/exit.png new file mode 100644 index 00000000..7af7112d Binary files /dev/null and b/modules/core_ui/icons/exit.png differ diff --git a/modules/core_ui/icons/login.png b/modules/core_ui/icons/login.png new file mode 100644 index 00000000..1adfa2a5 Binary files /dev/null and b/modules/core_ui/icons/login.png differ diff --git a/modules/core_ui/icons/logout.png b/modules/core_ui/icons/logout.png new file mode 100644 index 00000000..12aa0dc0 Binary files /dev/null and b/modules/core_ui/icons/logout.png differ diff --git a/modules/core_ui/icons/settings.png b/modules/core_ui/icons/settings.png new file mode 100644 index 00000000..3a8aaf7a Binary files /dev/null and b/modules/core_ui/icons/settings.png differ diff --git a/modules/core_ui/images/empty_rounded_rect.png b/modules/core_ui/images/empty_rounded_rect.png new file mode 100644 index 00000000..62bd7055 Binary files /dev/null and b/modules/core_ui/images/empty_rounded_rect.png differ diff --git a/modules/core_ui/images/top_button.png b/modules/core_ui/images/top_button.png new file mode 100644 index 00000000..0f735dfe Binary files /dev/null and b/modules/core_ui/images/top_button.png differ diff --git a/modules/core_ui/images/top_panel.png b/modules/core_ui/images/top_panel.png new file mode 100644 index 00000000..284378f4 Binary files /dev/null and b/modules/core_ui/images/top_panel.png differ diff --git a/modules/core_ui/images/topbar.png b/modules/core_ui/images/topbar.png new file mode 100644 index 00000000..a4ccc8f2 Binary files /dev/null and b/modules/core_ui/images/topbar.png differ diff --git a/modules/core_ui/styles/buttons.otui b/modules/core_ui/styles/buttons.otui index 656e5619..8305969a 100644 --- a/modules/core_ui/styles/buttons.otui +++ b/modules/core_ui/styles/buttons.otui @@ -22,3 +22,30 @@ Button < UIButton state.disabled: color: #999999 background-color: #ffffff88 + +TopButton < UIButton + background-color: white + size: 26 25 + text-translate: 0 0 + border-image: + source: /core_ui/images/top_button.png + size: 26 25 + border: 3 + + state.hover: + border-image: + source: /core_ui/images/top_button.png + size: 26 25 + offset: 26 0 + border: 3 + + state.pressed: + text-translate: 1 1 + border-image: + source: /core_ui/images/top_button.png + size: 26 25 + offset: 52 0 + border: 3 + + state.disabled: + background-color: #ffffff66 \ No newline at end of file diff --git a/modules/core_ui/styles/panels.otui b/modules/core_ui/styles/panels.otui index 717bf1fd..c88ea20a 100644 --- a/modules/core_ui/styles/panels.otui +++ b/modules/core_ui/styles/panels.otui @@ -1,10 +1,16 @@ Panel < UIWidget + phantom: true FlatPanel < Panel border-image: source: /core_ui/images/panel_flat.png border: 4 +TopPanel < Panel + height: 34 + border-image: + source: /core_ui/images/top_panel.png + border-bottom: 3 RoundedPanel < Panel background-color: #ffffffdd diff --git a/modules/core_ui/styles/separators.otui b/modules/core_ui/styles/separators.otui index 2be808e9..144c78c6 100644 --- a/modules/core_ui/styles/separators.otui +++ b/modules/core_ui/styles/separators.otui @@ -3,3 +3,4 @@ HorizontalSeparator < UIWidget source: /core_ui/images/horizontal_separator.png border.top: 2 height: 2 + phantom: true diff --git a/modules/mainmenu/characterlist.lua b/modules/mainmenu/characterlist.lua index 096729b7..6eaf367e 100644 --- a/modules/mainmenu/characterlist.lua +++ b/modules/mainmenu/characterlist.lua @@ -56,7 +56,7 @@ function CharacterList.create(characters, premDays) charactersWindow:destroy() end - charactersWindow = UI.loadAndDisplayLocked('/mainmenu/ui/charlist.otui') + charactersWindow = UI.loadAndDisplay('/mainmenu/ui/charlist.otui') characterList = charactersWindow:getChildById('characterList') local accountStatusLabel = charactersWindow:getChildById('accountStatusLabel') charactersWindow.onKeyPress = onCharactersWindowKeyPress diff --git a/modules/mainmenu/entergame.lua b/modules/mainmenu/entergame.lua index 1a1788ee..9791266c 100644 --- a/modules/mainmenu/entergame.lua +++ b/modules/mainmenu/entergame.lua @@ -38,7 +38,7 @@ end -- public functions function EnterGame.create() - enterGameWindow = UI.loadAndDisplayLocked('/mainmenu/ui/entergamewindow.otui') + enterGameWindow = UI.loadAndDisplay('/mainmenu/ui/entergamewindow.otui') end function EnterGame.destroy() diff --git a/modules/mainmenu/mainmenu.otmod b/modules/mainmenu/mainmenu.otmod index 7c5d0b82..72e87011 100644 --- a/modules/mainmenu/mainmenu.otmod +++ b/modules/mainmenu/mainmenu.otmod @@ -1,12 +1,13 @@ Module name: mainmenu - description: Create the game mainmenu, where everything starts + description: Create the game main menu author: OTClient team website: https://github.com/edubart/otclient version: 0.2 autoLoad: true dependencies: - core + - topmenu onLoad: | require 'mainmenu' @@ -15,6 +16,7 @@ Module if not initialized then MainMenu.create() + EnterGame.create() initialized = true end return true diff --git a/modules/mainmenu/ui/charlist.otui b/modules/mainmenu/ui/charlist.otui index 72d1288d..7825b7c5 100644 --- a/modules/mainmenu/ui/charlist.otui +++ b/modules/mainmenu/ui/charlist.otui @@ -69,4 +69,5 @@ MainWindow function(self) self:getParent():unlock() self:getParent():hide() + EnterGame.create() end \ No newline at end of file diff --git a/modules/mainmenu/ui/loginpanel.otui b/modules/mainmenu/ui/loginpanel.otui new file mode 100644 index 00000000..57511512 --- /dev/null +++ b/modules/mainmenu/ui/loginpanel.otui @@ -0,0 +1,47 @@ +RoundedRectPanel + id: loginPanel + background-color: #000000e5 + size: 192 164 + anchors.centerIn: parent + margin.top: 64 + opacity: 0 + + LargerLabel + text: Account name + anchors.left: parent.left + anchors.top: parent.top + margin.left: 16 + margin.top: 12 + + LineEdit + id: accountNameLineEdit + text: otclient0 + anchors.left: parent.left + anchors.right: parent.right + anchors.top: prev.bottom + margin.left: 14 + margin.right: 14 + + LargerLabel + text: Password + anchors.left: parent.left + anchors.top: prev.bottom + margin.left: 16 + margin.top: 8 + + PasswordLineEdit + id: accountPasswordLineEdit + text: 123456 + anchors.left: parent.left + anchors.right: parent.right + anchors.top: prev.bottom + margin.left: 14 + margin.right: 14 + + Button + id: loginButton + text: Login + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + margin.bottom: 20 + onClick: EnterGame.doLogin() diff --git a/modules/mainmenu/ui/mainmenu.otui b/modules/mainmenu/ui/mainmenu.otui index a19d3596..bbd64f8b 100644 --- a/modules/mainmenu/ui/mainmenu.otui +++ b/modules/mainmenu/ui/mainmenu.otui @@ -10,31 +10,8 @@ Panel source: /mainmenu/ui/background.png smooth: true fixed ratio: true - anchors.fill: parent + anchors.top: topMenu.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom focusable: false - - RoundedPanel - id: mainMenu - size: 144 162 - anchors.left: parent.left - anchors.bottom: parent.bottom - margin.left: 60 - margin.bottom: 70 - layout: verticalBox - - MenuButton - text: Enter Game - margin.top: 18 - onClick: EnterGame.create() - - MenuButton - text: Options - onClick: UI.loadAndDisplayLocked("/mainmenu/ui/optionswindow.otui") - - MenuButton - text: Info - onClick: UI.loadAndDisplayLocked("/mainmenu/ui/infowindow.otui") - - MenuButton - text: Exit - onClick: exit() diff --git a/modules/mainmenu/ui/otclient_logo.png b/modules/mainmenu/ui/otclient_logo.png new file mode 100644 index 00000000..4bfef579 Binary files /dev/null and b/modules/mainmenu/ui/otclient_logo.png differ diff --git a/modules/topmenu/topmenu.lua b/modules/topmenu/topmenu.lua new file mode 100644 index 00000000..dcf5dacc --- /dev/null +++ b/modules/topmenu/topmenu.lua @@ -0,0 +1,14 @@ +TopMenu = {} + +-- private variables +local topMenu + +-- public functions +function TopMenu.create() + topMenu = UI.loadAndDisplay("/topmenu/topmenu.otui") +end + +function TopMenu.destroy() + topMenu:destroy() + topMenu = nil +end \ No newline at end of file diff --git a/modules/topmenu/topmenu.otmod b/modules/topmenu/topmenu.otmod new file mode 100644 index 00000000..6e733f38 --- /dev/null +++ b/modules/topmenu/topmenu.otmod @@ -0,0 +1,18 @@ +Module + name: topmenu + description: Create the top menu + author: OTClient team + website: https://github.com/edubart/otclient + version: 0.2 + autoLoad: true + dependencies: + - core + + onLoad: | + require 'topmenu' + TopMenu.create() + return true + + onUnload: | + TopMenu.destroy() + diff --git a/modules/topmenu/topmenu.otui b/modules/topmenu/topmenu.otui new file mode 100644 index 00000000..768ab16f --- /dev/null +++ b/modules/topmenu/topmenu.otui @@ -0,0 +1,52 @@ +TopPanel + id: topMenu + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + focusable: false + + TopButton + anchors.top: parent.top + anchors.left: parent.left + margin.top: 3 + margin.left: 6 + + UIWidget + size: 16 16 + image: /core_ui/icons/settings.png + anchors.centerIn: parent + phantom: true + + TopButton + anchors.top: prev.top + anchors.left: prev.right + margin.left: 6 + + UIWidget + size: 16 16 + image: /core_ui/icons/login.png + anchors.centerIn: parent + phantom: true + + TopButton + anchors.top: parent.top + anchors.right: parent.right + margin.top: 3 + margin.right: 6 + + UIWidget + size: 16 16 + image: /core_ui/icons/exit.png + anchors.centerIn: parent + phantom: true + + TopButton + anchors.top: prev.top + anchors.right: prev.left + margin.right: 6 + + UIWidget + size: 16 16 + image: /core_ui/icons/logout.png + anchors.centerIn: parent + phantom: true \ No newline at end of file diff --git a/src/framework/ui/uilabel.cpp b/src/framework/ui/uilabel.cpp index 86cef263..74af3f8f 100644 --- a/src/framework/ui/uilabel.cpp +++ b/src/framework/ui/uilabel.cpp @@ -28,6 +28,7 @@ void UILabel::setup() { UIWidget::setup(); setFocusable(false); + setPhantom(true); setAlign(Fw::AlignLeft); } diff --git a/src/framework/ui/uiwidget.cpp b/src/framework/ui/uiwidget.cpp index 741e0465..e4129c8a 100644 --- a/src/framework/ui/uiwidget.cpp +++ b/src/framework/ui/uiwidget.cpp @@ -59,6 +59,7 @@ void UIWidget::setup() setVisible(true); setEnabled(true); setFocusable(true); + setPhantom(false); setPressed(false); setSizeFixed(false); setFont(g_fonts.getDefaultFont()); @@ -732,10 +733,18 @@ void UIWidget::onStyleApply(const OTMLNodePtr& styleNode) else if(node->tag() == "opacity") { setOpacity(node->value()); } + // enabled + else if(node->tag() == "enabled") { + setEnabled(node->value()); + } // focusable else if(node->tag() == "focusable") { setFocusable(node->value()); } + // focusable + else if(node->tag() == "phantom") { + setPhantom(node->value()); + } // size else if(node->tag() == "size") { resize(node->value()); @@ -910,8 +919,11 @@ bool UIWidget::onMousePress(const Point& mousePos, Fw::MouseButton button) bool mustEnd = child->onMousePress(mousePos, button); - if(!child->getChildByPos(mousePos) && !child->isPressed()) - child->setPressed(true); + if(button == Fw::MouseLeftButton && !child->isPressed()) { + UIWidgetPtr clickedChild = child->getChildByPos(mousePos); + if(!clickedChild || clickedChild->isPhantom()) + child->setPressed(true); + } if(mustEnd) return true; diff --git a/src/framework/ui/uiwidget.h b/src/framework/ui/uiwidget.h index 5a2522a3..d89ea3f9 100644 --- a/src/framework/ui/uiwidget.h +++ b/src/framework/ui/uiwidget.h @@ -46,6 +46,7 @@ public: void setPressed(bool pressed) { m_pressed = pressed; updateState(Fw::PressedState); } void setId(const std::string& id) { m_id = id; } void setFocusable(bool focusable) { m_focusable = focusable; } + void setPhantom(bool phantom) { m_phantom = phantom; } void setStyle(const std::string& styleName); void setStyleFromNode(const OTMLNodePtr& styleNode); void setLayout(const UILayoutPtr& layout) { m_layout = layout; } @@ -87,6 +88,7 @@ public: bool isExplicitlyEnabled() const { return m_enabled; } bool isExplicitlyVisible() const { return m_visible; } bool isFocusable() const { return m_focusable; } + bool isPhantom() const { return m_phantom; } bool isSizeFixed() const { return m_fixedSize; } bool hasChildren() const { return m_children.size() > 0; } bool hasChild(const UIWidgetPtr& child); @@ -181,6 +183,7 @@ protected: bool m_focusable; bool m_fixedSize; bool m_pressed; + bool m_phantom; Rect m_rect; UILayoutPtr m_layout; UIWidgetWeakPtr m_parent; diff --git a/src/framework/ui/uiwindow.cpp b/src/framework/ui/uiwindow.cpp index 8614d155..c5d6685d 100644 --- a/src/framework/ui/uiwindow.cpp +++ b/src/framework/ui/uiwindow.cpp @@ -112,10 +112,10 @@ void UIWindow::onFocusChange(bool focused, Fw::FocusReason reason) bool UIWindow::onMousePress(const Point& mousePos, Fw::MouseButton button) { - if(!getChildByPos(mousePos)) { + UIWidgetPtr clickedChild = getChildByPos(mousePos); + if(!clickedChild || clickedChild->isPhantom()) { m_moving = true; m_movingReference = mousePos - getRect().topLeft(); - return true; } return UIWidget::onMousePress(mousePos, button); } diff --git a/src/otclient/otclient.cpp b/src/otclient/otclient.cpp index f10b6c4e..3c74f55a 100644 --- a/src/otclient/otclient.cpp +++ b/src/otclient/otclient.cpp @@ -148,7 +148,7 @@ void OTClient::run() render(); // render fps - defaultFont->renderText(fpsText, Point(g_graphics.getScreenSize().width() - fpsTextSize.width() - 10, 10)); + defaultFont->renderText(fpsText, Point(g_graphics.getScreenSize().width() - fpsTextSize.width() - 10, 34)); // render end g_graphics.endRender(); diff --git a/tools/charset_map.svg b/tools/charset_map.svg deleted file mode 100644 index e82454bb..00000000 --- a/tools/charset_map.svg +++ /dev/null @@ -1,2984 +0,0 @@ - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - ! - " - - # - $ - % - & - ' - ( - ) - * - + - , - - - . - / - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - : - ; - < - = - > - ? - @ - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - [ - \ - ] - ^ - _ - ` - a - b - c - d - e - f - g - h - i - j - k - l - m - n - o - p - q - r - s - t - u - v - w - x - y - z - { - | - } - ~ - ¡ - - - £ - ¤ - ¥ - ¦ - § - © - - - ª - « - ¬ - ® - ¯ - ° - ± - ² - ³ - ´ - µ - - · - ¸ - ¹ - º - » - - ¼ - ½ - ¾ - ¿ - À - ¨ - ¢ - Á - à -  - Ä - Æ - Ç - È - É - Ë - Ê - Ì - Í - Î - Ï - Ñ - Ó - Ò - Ô - Õ - Ö - × - Ø - Ú - Ù - Û - Ü - Ý - Þ - ß - Ð - á - ã - â - ä - å - æ - ç - è - ê - é - ë - ì - í - î - ï - à - ñ - ó - ò - ô - õ - ö - ÷ - ø - ú - ù - û - ü - ý - þ - ÿ - ð - Å - - - ƒ - - - - - ˆ - - Š - - Œ - Ž - - - - - - - - ˜ - - š - - œ - ž - Ÿ - - - - - - - - - diff --git a/tools/gimp-bitmap-generator/generate_bitmap_font.py b/tools/gimp-bitmap-generator/generate_bitmap_font.py index 40e233eb..b0d23e8f 100755 --- a/tools/gimp-bitmap-generator/generate_bitmap_font.py +++ b/tools/gimp-bitmap-generator/generate_bitmap_font.py @@ -25,7 +25,7 @@ def generate_bitmap_font(timg, tdrawable, font, font_size, first_char, glyph_wid disp = gimp.Display(image) for i in range(char_begin, char_end): - if i == 129 or (i >= 141 and i <= 144) or i == 157: + if i == 127 or i == 129 or (i >= 141 and i <= 144) or i == 157: string = u"\u25A1" else: string = chr(i).decode('cp1252')