rect fix and some ui new classes

This commit is contained in:
Eduardo Bart 2011-04-12 02:51:09 -03:00
parent 92ac4093a4
commit 0f7f7827f5
17 changed files with 143 additions and 7 deletions

View File

@ -52,7 +52,7 @@ IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_DEFINITIONS(-D_DEBUG) ADD_DEFINITIONS(-D_DEBUG)
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug") ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(SOURCES SET(SOURCES src/framework/ui/uilinedecorationskin.cpp src/framework/ui/uicheckboxskin.cpp src/framework/ui/uilinedecoration.cpp src/framework/ui/uicheckbox.cpp
# game sources # game sources
src/main.cpp src/main.cpp
src/menustate.cpp src/menustate.cpp

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
OTClient is made available under the MIT License
Copyright (c) 2010 OTClient, https://github.com/edubart/otclient
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -46,6 +46,10 @@ panels:
bottom right corner: [48,231,5,5] bottom right corner: [48,231,5,5]
center: [11,214,32,32] center: [11,214,32,32]
flatPanel:
bordered image:
labels: labels:
default: default:
font: tibia-10px-antialised font: tibia-10px-antialised

60
data/ui/infoWindow.yml Normal file
View File

@ -0,0 +1,60 @@
window#infoWindow:
title: Info
size: [244, 221]
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
panel#infoPanel:
skin: flatPanel
size: [208, 129]
anchors.left: parent.left
anchors.top: parent.top
margin.top: 32
margin.left: 24
label#infoLabel:
size: [218, 83]
align: center
text: |
OTClient
Version 0.2.0
Copyright (C) 2011
Developed by edubart
separator#bottomSeparator:
orientation: horizontal
width: 190
anchors.left: parent.left
anchors.top: parent.top
margin.top: 83
margin.left: 9
label#websiteLabel:
text: Official Website
anchors.left: parent.left
anchors.top: parent.top
margin.top: 105
margin.left: 8
button#websiteButton:
text: github.com/otclient
anchors.left: parent.left
anchors.top: parent.top
margin.top: 99
margin.left: 131
separator#bottomSeparator:
orientation: horizontal
width: 218
anchors.left: parent.left
anchors.top: parent.top
margin.top: 181
margin.left: 13
button#okButton:
text: Ok
size: [43, 20]
anchors.left: parent.left
anchors.top: parent.top
margin.top: 191
margin.left: 188

View File

@ -1,6 +1,6 @@
panel#mainMenu: panel#mainMenu:
skin: roundedGridPanel skin: roundedGridPanel
size: [118, 172] size: [117, 171]
anchors.left: parent.left anchors.left: parent.left
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
margin.left: 60 margin.left: 60

View File

@ -35,7 +35,7 @@ bool Configs::load(const std::string& fileName)
return false; return false;
std::string fileContents = g_resources.loadTextFile(fileName); std::string fileContents = g_resources.loadTextFile(fileName);
if(fileContents.size()) if(!fileContents.size())
return false; return false;
std::istringstream fin(fileContents); std::istringstream fin(fileContents);

View File

@ -133,7 +133,7 @@ void Engine::onClose()
void Engine::onResize(const Size& size) void Engine::onResize(const Size& size)
{ {
g_graphics.resize(size); g_graphics.resize(size);
UIContainer::getRootContainer()->setSize(Size(size.width()-1, size.height()-1)); UIContainer::getRootContainer()->setSize(size);
if(m_currentState) if(m_currentState)
m_currentState->onResize(size); m_currentState->onResize(size);

View File

@ -0,0 +1,7 @@
#include "uicheckbox.h"
UICheckBox::UICheckBox(UI::EElementType type): UIElement(type)
{
}

View File

@ -0,0 +1,14 @@
#ifndef UICHECKBOX_H
#define UICHECKBOX_H
#include <ui/uielement.h>
class UICheckBox : public UIElement
{
public:
UICheckBox(UI::EElementType type = UI::Element);
};
#endif // UICHECKBOX_H

View File

@ -0,0 +1,2 @@
#include "uicheckboxskin.h"

View File

@ -0,0 +1,8 @@
#ifndef UICHECKBOXSKIN_H
#define UICHECKBOXSKIN_H
class UICheckBoxSkin
{
};
#endif // UICHECKBOXSKIN_H

View File

@ -0,0 +1,2 @@
#include "uilinedecoration.h"

View File

@ -0,0 +1,8 @@
#ifndef UILINEDECORATION_H
#define UILINEDECORATION_H
class UILineDecoration
{
};
#endif // UILINEDECORATION_H

View File

@ -0,0 +1,2 @@
#include "uilinedecorationskin.h"

View File

@ -0,0 +1,8 @@
#ifndef UILINEDECORATIONSKIN_H
#define UILINEDECORATIONSKIN_H
class UILineDecorationSkin
{
};
#endif // UILINEDECORATIONSKIN_H

View File

@ -77,8 +77,8 @@ public:
inline void setBottomLeft(const TPoint<T> &p) { x1 = p.x; y2 = p.y; } inline void setBottomLeft(const TPoint<T> &p) { x1 = p.x; y2 = p.y; }
inline void setWidth(T width) { x2 = x1 + width - 1; } inline void setWidth(T width) { x2 = x1 + width - 1; }
inline void setHeight(T height) { y2 = y1 + height- 1; } inline void setHeight(T height) { y2 = y1 + height- 1; }
inline void setSize(T width, T height) { x2 = x1 + width; y2 = y1 + height; } inline void setSize(T width, T height) { x2 = x1 + width - 1; y2 = y1 + height - 1; }
inline void setSize(const TSize<T>& size) { x2 = x1 + size.width(); y2 = y1 + size.height(); } inline void setSize(const TSize<T>& size) { x2 = x1 + size.width() - 1; y2 = y1 + size.height() - 1; }
inline void setRect(T x, T y, T width, T height) { x1 = x; y1 = y; x2 = (x + width - 1); y2 = (y + height - 1); } inline void setRect(T x, T y, T width, T height) { x1 = x; y1 = y; x2 = (x + width - 1); y2 = (y + height - 1); }
inline void setCoords(int left, int top, int right, int bottom) { x1 = left; y1 = top; x2 = right; y2 = bottom; } inline void setCoords(int left, int top, int right, int bottom) { x1 = left; y1 = top; x2 = right; y2 = bottom; }

View File

@ -38,7 +38,7 @@ template <class T>
class TSize class TSize
{ {
public: public:
inline TSize() : wd(-1), ht(-1) {}; inline TSize() : wd(0), ht(0) {};
inline TSize(T width, T height) : wd(width), ht(height) { }; inline TSize(T width, T height) : wd(width), ht(height) { };
inline TSize(const TSize<T>& other) : wd(other.wd), ht(other.ht) { }; inline TSize(const TSize<T>& other) : wd(other.wd), ht(other.ht) { };