Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some fix and feature #75

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 18 additions & 164 deletions libfairygui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,175 +6,29 @@ endif()

project(fairygui)

# file list

set(FAIRYGUI_SRC Classes/GSlider.cpp
Classes/GLoader.cpp
Classes/GTextInput.cpp
Classes/tween/TweenManager.cpp
Classes/tween/TweenValue.cpp
Classes/tween/GTweener.cpp
Classes/tween/EaseManager.cpp
Classes/tween/TweenPropType.cpp
Classes/tween/GTween.cpp
Classes/GGroup.cpp
Classes/Margin.cpp
Classes/Transition.cpp
Classes/DragDropManager.cpp
Classes/ScrollPane.cpp
Classes/GRoot.cpp
Classes/UIPackage.cpp
Classes/treeview/TreeNode.cpp
Classes/treeview/TreeView.cpp
Classes/Window.cpp
Classes/PackageItem.cpp
Classes/GObjectPool.cpp
Classes/utils/ByteBuffer.cpp
Classes/utils/WeakPtr.cpp
Classes/utils/UBBParser.cpp
Classes/utils/ToolSet.cpp
Classes/GLabel.cpp
Classes/UIObjectFactory.cpp
Classes/controller_action/ChangePageAction.cpp
Classes/controller_action/ControllerAction.cpp
Classes/controller_action/PlayTransitionAction.cpp
Classes/GObject.cpp
Classes/GComboBox.cpp
Classes/GComponent.cpp
Classes/GRichTextField.cpp
Classes/UIConfig.cpp
Classes/PopupMenu.cpp
Classes/GGraph.cpp
Classes/GTextField.cpp
Classes/GImage.cpp
Classes/display/FUILabel.cpp
Classes/display/BitmapFont.cpp
Classes/display/FUIContainer.cpp
Classes/display/FUIRichText.cpp
Classes/display/FUIInput.cpp
Classes/display/TextFormat.cpp
Classes/display/FUISprite.cpp
Classes/Controller.cpp
Classes/Relations.cpp
Classes/TranslationHelper.cpp
Classes/GProgressBar.cpp
Classes/gears/GearText.cpp
Classes/gears/GearAnimation.cpp
Classes/gears/GearBase.cpp
Classes/gears/GearXY.cpp
Classes/gears/GearColor.cpp
Classes/gears/GearDisplay.cpp
Classes/gears/GearSize.cpp
Classes/gears/GearLook.cpp
Classes/gears/GearIcon.cpp
Classes/GScrollBar.cpp
Classes/event/EventContext.cpp
Classes/event/UIEventDispatcher.cpp
Classes/event/InputEvent.cpp
Classes/event/InputProcessor.cpp
Classes/event/HitTest.cpp
Classes/GMovieClip.cpp
Classes/GList.cpp
Classes/GButton.cpp
Classes/RelationItem.cpp
)



set(FAIRYGUI_HEADER Classes/GTextField.h
Classes/GGroup.h
Classes/GList.h
Classes/tween/EaseManager.h
Classes/tween/TweenManager.h
Classes/tween/GTween.h
Classes/tween/GTweener.h
Classes/tween/EaseType.h
Classes/tween/TweenPropType.h
Classes/tween/TweenValue.h
Classes/UIPackage.h
Classes/Margin.h
Classes/RelationItem.h
Classes/GScrollBar.h
Classes/PopupMenu.h
Classes/treeview/TreeNode.h
Classes/treeview/TreeView.h
Classes/TranslationHelper.h
Classes/UIConfig.h
Classes/Transition.h
Classes/GRoot.h
Classes/GTextInput.h
Classes/GRichTextField.h
Classes/Relations.h
Classes/Window.h
Classes/UIObjectFactory.h
Classes/GMovieClip.h
Classes/utils/ByteBuffer.h
Classes/utils/ToolSet.h
Classes/utils/UBBParser.h
Classes/utils/WeakPtr.h
Classes/GComponent.h
Classes/FieldTypes.h
Classes/GImage.h
Classes/controller_action/ChangePageAction.h
Classes/controller_action/ControllerAction.h
Classes/controller_action/PlayTransitionAction.h
Classes/Controller.h
Classes/FairyGUI.h
Classes/GLabel.h
Classes/GComboBox.h
Classes/PackageItem.h
Classes/GObjectPool.h
Classes/FairyGUIMacros.h
Classes/GProgressBar.h
Classes/display/TextFormat.h
Classes/display/BitmapFont.h
Classes/display/FUIRichText.h
Classes/display/FUIContainer.h
Classes/display/FUISprite.h
Classes/display/FUILabel.h
Classes/display/FUIInput.h
Classes/GLoader.h
Classes/GSlider.h
Classes/gears/GearColor.h
Classes/gears/GearIcon.h
Classes/gears/GearDisplay.h
Classes/gears/GearText.h
Classes/gears/GearXY.h
Classes/gears/GearSize.h
Classes/gears/GearBase.h
Classes/gears/GearAnimation.h
Classes/gears/GearLook.h
Classes/DragDropManager.h
Classes/GButton.h
Classes/event/HitTest.h
Classes/event/UIEventType.h
Classes/event/EventContext.h
Classes/event/InputProcessor.h
Classes/event/InputEvent.h
Classes/event/UIEventDispatcher.h
Classes/GGraph.h
Classes/GObject.h
Classes/ScrollPane.h
)

list(APPEND FAIRYGUI_SRC ${FAIRYGUI_HEADER})

include_directories(
${COCOS2DX_ROOT_PATH}/cocos/audio/include/
)

if(MSVC)
add_compile_options(/w)
else()
add_compile_options(-w)
endif()

add_library(fairygui ${FAIRYGUI_SRC})
# file list

file(GLOB FAIRYGUI_SRC
Classes/*.c*
Classes/controller_action/*.c*
Classes/display/*.c*
Classes/event/*.c*
Classes/gears/*.c*
Classes/tween/*.c*
Classes/utils/*.c*
)

target_link_libraries(
fairygui
PRIVATE
cocos2d
)
add_library(${PROJECT_NAME} ${FAIRYGUI_SRC})

target_link_libraries(${PROJECT_NAME} PRIVATE cocos2d)

target_include_directories(fairygui
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Classes>
)
4 changes: 2 additions & 2 deletions libfairygui/Classes/GButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void GButton::constructExtension(ByteBuffer* buffer)
addEventListener(UIEventType::TouchBegin, CC_CALLBACK_1(GButton::onTouchBegin, this));
addEventListener(UIEventType::TouchEnd, CC_CALLBACK_1(GButton::onTouchEnd, this));
addEventListener(UIEventType::Click, CC_CALLBACK_1(GButton::onClick, this));
addEventListener(UIEventType::Exit, CC_CALLBACK_1(GButton::onExit, this));
addEventListener(UIEventType::Exit, CC_CALLBACK_1(GButton::onExit2, this));
}

void GButton::setup_afterAdd(ByteBuffer* buffer, int beginPos)
Expand Down Expand Up @@ -444,7 +444,7 @@ void GButton::onClick(EventContext* context)
}
}

void GButton::onExit(EventContext* context)
void GButton::onExit2(EventContext* context)
{
if (_over)
onRollOut(context);
Expand Down
2 changes: 1 addition & 1 deletion libfairygui/Classes/GButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class GButton : public GComponent
void onTouchBegin(EventContext* context);
void onTouchEnd(EventContext* context);
void onClick(EventContext* context);
void onExit(EventContext* context);
void onExit2(EventContext* context);

ButtonMode _mode;
GObject* _titleObject;
Expand Down
4 changes: 1 addition & 3 deletions libfairygui/Classes/GTextInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ void GTextInput::setTextFieldText()

void GTextInput::editBoxReturn(cocos2d::ui::EditBox * editBox)
{
//found that this will trigger even when focus is lost
//if (isSingleLine())
// dispatchEvent(UIEventType::Submit);
dispatchEvent(UIEventType::Submit);
}

void GTextInput::editBoxTextChanged(cocos2d::ui::EditBox* editBox, const std::string& text)
Expand Down
4 changes: 2 additions & 2 deletions libfairygui/Classes/display/FUIInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ void FUIInput::setPassword(bool value)

void FUIInput::setKeyboardType(int value)
{
//if (!_password)
//setInputMode((ui::EditBox::InputMode)value);
if (!_password)
setInputMode((ui::EditBox::InputMode)value);
}

void FUIInput::openKeyboard()
Expand Down
14 changes: 2 additions & 12 deletions libfairygui/Classes/event/UIEventDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ EventTag & EventTag::operator=(const EventTag & other)
return *this;
}

EventTag & EventTag::operator=(EventTag && other)
EventTag & EventTag::operator=(EventTag && other) noexcept
{
if (this != &other)
{
Expand All @@ -63,21 +63,11 @@ EventTag & EventTag::operator=(int v)
return *this;
}

bool EventTag::operator!=(const EventTag & v)
{
return _value != v._value;
}

bool EventTag::operator!=(const EventTag & v) const
{
return _value != v._value;
}

bool EventTag::operator==(const EventTag & v)
{
return _value == v._value;
}

bool EventTag::operator==(const EventTag & v) const
{
return _value == v._value;
Expand Down Expand Up @@ -282,4 +272,4 @@ void UIEventDispatcher::doBubble(int eventType, EventContext* context)
p->doBubble(eventType, context);
}

NS_FGUI_END
NS_FGUI_END
12 changes: 5 additions & 7 deletions libfairygui/Classes/event/UIEventDispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,18 @@ class EventTag
static const EventTag None;

EventTag();
explicit EventTag(void* ptr);
explicit EventTag(int value);
explicit EventTag(const EventTag& other);
explicit EventTag(EventTag&& other);
EventTag(void* ptr);
EventTag(int value);
EventTag(const EventTag& other);
EventTag(EventTag&& other);
~EventTag();

EventTag& operator= (const EventTag& other);
EventTag& operator= (EventTag&& other);
EventTag& operator= (EventTag&& other) noexcept;
EventTag& operator= (void* ptr);
EventTag& operator= (int v);

bool operator!= (const EventTag& v);
bool operator!= (const EventTag& v) const;
bool operator== (const EventTag& v);
bool operator== (const EventTag& v) const;

bool isNone() const { return _value == 0; }
Expand Down