Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into performance
Browse files Browse the repository at this point in the history
# Conflicts:
#	Include/Rocket/Core/TransformPrimitive.h
#	Include/Rocket/Core/Types.h
#	Source/Core/Context.cpp
#	Source/Core/Element.cpp
#	Source/Core/ElementAnimation.cpp
#	readme.md
  • Loading branch information
mikke89 committed May 15, 2019
2 parents 1642ddb + 34b55b1 commit 90c2d50
Show file tree
Hide file tree
Showing 59 changed files with 686 additions and 328 deletions.
28 changes: 28 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 1.0.{build}
image: Visual Studio 2017
environment:
matrix:
- FREETYPE_VER: 2.10.0
VS_GENERATOR: Visual Studio 15 2017 Win64
BUILD_SHARED_LIBS: ON
BUILD_SAMPLES: ON
- FREETYPE_VER: 2.10.0
VS_GENERATOR: Visual Studio 15 2017 Win64
BUILD_SHARED_LIBS: OFF
BUILD_SAMPLES: OFF
install:
- cmd: >-
cd Dependencies
appveyor DownloadFile https://github.com/ubawurinna/freetype-windows-binaries/releases/download/v2.10.0/freetype-%FREETYPE_VER%.zip
unzip -o freetype-%FREETYPE_VER%.zip
mv win64 lib
cd ../Build
cmake -G "%VS_GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% -DBUILD_SAMPLES=%BUILD_SAMPLES% -DSKIP_DIRECTX_SAMPLES=ON .
build:
parallel: true
verbosity: minimal
66 changes: 66 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
sudo: false
dist: trusty

matrix:
include:
- os: osx
osx_image: xcode10.2
env: ARCH=OSX
language: c++
compiler: clang
- os: linux
language: c++
compiler: clang
env: MATRIX_EVAL="CC=clang-6.0 CXX=clang++-6.0"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
packages:
- clang-6.0
- libstdc++-7-dev
- cmake
- build-essential
- libboost-dev
- libboost-python-dev
- libsdl2-dev
- libsdl2-image-dev
- libfreetype6-dev
- libglew-dev
- liblua5.2-dev
- libsfml-dev
- os: linux
language: c++
compiler: gcc
env: MATRIX_EVAL="CC=gcc-7 CXX=g++-7"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
- cmake
- build-essential
- libboost-dev
- libboost-python-dev
- libsdl2-dev
- libsdl2-image-dev
- libfreetype6-dev
- libglew-dev
- liblua5.2-dev
- libsfml-dev

before_install:
- if [[ -n "${MATRIX_EVAL}" ]]; then eval "${MATRIX_EVAL}" ; fi

install:
- cd "$TRAVIS_BUILD_DIR/Build"
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then cmake -DBUILD_LUA_BINDINGS=ON -DBUILD_SAMPLES=ON .; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cmake -G Xcode .; fi
- cd "$TRAVIS_BUILD_DIR"

script:
- cd Build
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then make -j4; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then xcodebuild -project librocket.xcodeproj/ -jobs 4 -configuration Release -target ALL_BUILD; fi
50 changes: 30 additions & 20 deletions Build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ if(APPLE)
set (IOS_ARCH armv6 armv7 armv7s arm64)
set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE string "Build architecture for iOS")
else (${IOS_PLATFORM} STREQUAL "OS")
set (IOS_ARCH i386 x86_64)
set (IOS_ARCH x86_64)
set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE string "Build architecture for iOS Simulator")
endif (${IOS_PLATFORM} STREQUAL "OS")

else(IOS)
# set the architectures for OS X
set (OSXI_ARCH i386 x86_64)
set (OSXI_ARCH x86_64)
set (CMAKE_OSX_ARCHITECTURES ${OSXI_ARCH} CACHE string "Build architecture for OS X universal binaries")
endif(IOS)
endif (NOT CMAKE_OSX_ARCHITECTURES AND BUILD_UNIVERSAL_BINARIES)
Expand Down Expand Up @@ -269,7 +269,7 @@ foreach(library ${LIBRARIES})
target_compile_options(${NAME} PUBLIC "/MP")
endif(MSVC)

set_property(TARGET ${NAME} PROPERTY CXX_STANDARD 17)
set_property(TARGET ${NAME} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${NAME} PROPERTY CXX_STANDARD_REQUIRED ON)

install(TARGETS ${NAME}
Expand Down Expand Up @@ -368,6 +368,9 @@ if(BUILD_PYTHON_BINDINGS)

set_target_properties(${NAME} PROPERTIES PREFIX "")

set_property(TARGET ${NAME} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${NAME} PROPERTY CXX_STANDARD_REQUIRED ON)

install(TARGETS ${NAME}
EXPORT libRocketTargets
LIBRARY DESTINATION ${PYTHON_INSTDIR}
Expand All @@ -392,7 +395,10 @@ if(BUILD_LUA_BINDINGS)
VERSION ${PROJECT_VERSION}
SOVERSION ${LIBROCKET_VERSION_MAJOR}
)


set_property(TARGET ${NAME} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${NAME} PROPERTY CXX_STANDARD_REQUIRED ON)

install(TARGETS ${NAME}
EXPORT libRocketTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down Expand Up @@ -459,11 +465,6 @@ endif()
else()
add_executable(${NAME} ${${NAME}_SRC_FILES} ${${NAME}_HDR_FILES} )
endif()

if (APPLE)
# We only support i386 for the samples as it still uses Carbon
set_target_properties(${NAME} PROPERTIES OSX_ARCHITECTURES "i386;" )
endif()

target_link_libraries(${NAME} ${ARGN})
endmacro()
Expand Down Expand Up @@ -586,18 +587,14 @@ endif(NOT BUILD_FRAMEWORK)

# Build and install sample shell library
add_library(shell STATIC ${shell_SRC_FILES} ${shell_HDR_FILES})
set_property(TARGET shell PROPERTY CXX_STANDARD 17)
set_property(TARGET shell PROPERTY CXX_STANDARD 11)
set_property(TARGET shell PROPERTY CXX_STANDARD_REQUIRED ON)
if (APPLE)
# We only support i386 for the samples as it still uses Carbon
set_target_properties(shell PROPERTIES OSX_ARCHITECTURES "i386;")
endif()

# Build and install the basic samples
foreach(sample ${samples})
bl_sample(${sample} ${sample_LIBRARIES})

set_property(TARGET ${sample} PROPERTY CXX_STANDARD 17)
set_property(TARGET ${sample} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${sample} PROPERTY CXX_STANDARD_REQUIRED ON)

# The samples always set this as their current working directory
Expand Down Expand Up @@ -644,6 +641,9 @@ endif(NOT BUILD_FRAMEWORK)
include_directories(${SDL2_INCLUDE_DIR} ${GLEW_INCLUDE_DIR})

bl_sample(sdl2 ${sample_LIBRARIES} ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${GLEW_LIBRARY})
set_property(TARGET sdl2 PROPERTY CXX_STANDARD 11)
set_property(TARGET sdl2 PROPERTY CXX_STANDARD_REQUIRED ON)

# The samples always set this as their current working directory
install(DIRECTORY DESTINATION ${SAMPLES_DIR}/basic/sdl2)
install(TARGETS sdl2
Expand Down Expand Up @@ -680,7 +680,11 @@ endif(NOT BUILD_FRAMEWORK)
endif()

message("-- Can SFML 2.x sample be built")
find_package(SFML 2 COMPONENTS graphics window system main)
if (WIN32)
find_package(SFML 2 COMPONENTS graphics window system main)
else()
find_package(SFML 2 COMPONENTS graphics window system)
endif()
if(NOT SFML_FOUND)
message("-- Can SFML 2.x sample be built - no")
else()
Expand All @@ -695,7 +699,10 @@ endif(NOT BUILD_FRAMEWORK)
include_directories(${SFML_INCLUDE_DIR})
bl_sample(sfml2 ${sample_LIBRARIES} ${SFML_LIBRARIES})
endif()


set_property(TARGET sfml2 PROPERTY CXX_STANDARD 11)
set_property(TARGET sfml2 PROPERTY CXX_STANDARD_REQUIRED ON)

# The samples always set this as their current working directory
install(DIRECTORY DESTINATION ${SAMPLES_DIR}/basic/sfml2)
install(TARGETS sfml2
Expand All @@ -710,6 +717,9 @@ endif(NOT BUILD_FRAMEWORK)
set_property(TARGET ${tutorial} PROPERTY CXX_STANDARD 17)
set_property(TARGET ${tutorial} PROPERTY CXX_STANDARD_REQUIRED ON)

set_property(TARGET ${tutorial} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${tutorial} PROPERTY CXX_STANDARD_REQUIRED ON)

# The tutorials always set this as their current working directory
install(DIRECTORY DESTINATION ${SAMPLES_DIR}/tutorial/${tutorial})
install(TARGETS ${tutorial}
Expand All @@ -719,7 +729,7 @@ endif(NOT BUILD_FRAMEWORK)

# Build and install invaders sample
bl_sample(invaders ${sample_LIBRARIES})
set_property(TARGET invaders PROPERTY CXX_STANDARD 17)
set_property(TARGET invaders PROPERTY CXX_STANDARD 11)
set_property(TARGET invaders PROPERTY CXX_STANDARD_REQUIRED ON)
install(DIRECTORY DESTINATION ${SAMPLES_DIR}/invaders)
install(TARGETS invaders
Expand All @@ -729,7 +739,7 @@ endif(NOT BUILD_FRAMEWORK)
if(BUILD_PYTHON_BINDINGS)
# Build and install pyinvaders sample
bl_sample(pyinvaders ${sample_LIBRARIES} ${PYTHON_LIBRARIES} ${PY_BINDINGS_LINK_LIBS})
set_property(TARGET pyinvaders PROPERTY CXX_STANDARD 17)
set_property(TARGET pyinvaders PROPERTY CXX_STANDARD 11)
set_property(TARGET pyinvaders PROPERTY CXX_STANDARD_REQUIRED ON)
install(DIRECTORY DESTINATION ${SAMPLES_DIR}/pyinvaders)
install(TARGETS pyinvaders
Expand All @@ -739,7 +749,7 @@ endif(NOT BUILD_FRAMEWORK)

if(BUILD_LUA_BINDINGS)
bl_sample(luainvaders RocketCoreLua RocketControlsLua ${sample_LIBRARIES} ${LUA_BINDINGS_LINK_LIBS})
set_property(TARGET luainvaders PROPERTY CXX_STANDARD 17)
set_property(TARGET luainvaders PROPERTY CXX_STANDARD 11)
set_property(TARGET luainvaders PROPERTY CXX_STANDARD_REQUIRED ON)
install(DIRECTORY DESTINATION ${SAMPLES_DIR}/luainvaders)
install(TARGETS luainvaders
Expand Down
4 changes: 4 additions & 0 deletions Include/Rocket/Core/Animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ struct TransitionList {
bool none = true;
bool all = false;
std::vector<Transition> transitions;

TransitionList() {}
TransitionList(bool none, bool all, std::vector<Transition> transitions) :
none(none), all(all), transitions(transitions) {}
};

inline bool operator==(const Animation& a, const Animation& b) { return a.duration == b.duration && a.tween == b.tween && a.delay == b.delay && a.alternate == b.alternate && a.paused == b.paused && a.num_iterations == b.num_iterations && a.name == b.name; }
Expand Down
5 changes: 3 additions & 2 deletions Include/Rocket/Core/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ class ROCKETCORE_API Context : public ScriptInterface
/// Unloads all loaded documents.
void UnloadAllDocuments();

/// Enable or disable handling mouse cursor from this context.
/// Only a single context should handle the mouse cursor at the same time.
/// Enable or disable handling of the mouse cursor from this context.
/// When enabled, changes to the cursor name is transmitted through the system interface.
/// @param[in] show True to enable mouse cursor handling, false to disable.
void EnableMouseCursor(bool enable);

Expand Down Expand Up @@ -265,6 +265,7 @@ class ROCKETCORE_API Context : public ScriptInterface

// Enables cursor handling.
bool enable_cursor;
String cursor_name;
// Document attached to cursor (e.g. while dragging).
ElementDocument* cursor_proxy;

Expand Down
9 changes: 6 additions & 3 deletions Include/Rocket/Core/Dictionary.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,24 @@ namespace Core {

inline Variant* GetIf(Dictionary& dictionary, const String& key)
{
if (auto it = dictionary.find(key); it != dictionary.end())
auto it = dictionary.find(key);
if (it != dictionary.end())
return &(it->second);
return nullptr;
}
inline const Variant* GetIf(const Dictionary& dictionary, const String& key)
{
if (auto it = dictionary.find(key); it != dictionary.end())
auto it = dictionary.find(key);
if (it != dictionary.end())
return &(it->second);
return nullptr;
}
template<typename T>
inline T Get(const Dictionary& dictionary, const String& key, const T& default_value)
{
T result = default_value;
if (auto it = dictionary.find(key); it != dictionary.end())
auto it = dictionary.find(key);
if (it != dictionary.end())
it->second.GetInto(result);
return result;
}
Expand Down
5 changes: 0 additions & 5 deletions Include/Rocket/Core/Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@
// Note: Changing a ROCKETCORE_API_INLINE method
// breaks ABI compatibility!!

#ifdef STATIC_LIB
#define ROCKET_STATIC_LIB
#pragma message("DEPRECATED: STATIC_LIB macro has been deprecated in favor of ROCKET_STATIC_LIB and support will be removed in a future release")
#endif

#if !defined ROCKET_STATIC_LIB
#if defined ROCKET_PLATFORM_WIN32
#if defined RocketCore_EXPORTS
Expand Down
6 changes: 3 additions & 3 deletions Include/Rocket/Core/Lua/lua.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
//The standard Lua headers

extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
4 changes: 4 additions & 0 deletions Include/Rocket/Core/Math.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ ROCKETCORE_API float Tan(float angle);
/// @param[in] x The x-component of the line.
/// @return The angle of the line in radians.
ROCKETCORE_API float ATan2(float y, float x);
/// Evaluates the natural exponential function on a value.
/// @param[in] value The value
/// @return e^(value)
ROCKETCORE_API float Exp(float value);

/// Converts an angle from radians to degrees.
/// @param[in] The angle, in radians.
Expand Down
1 change: 0 additions & 1 deletion Include/Rocket/Core/Matrix4.inl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ Matrix4< Component, Storage >::Matrix4(const typename Matrix4< Component, Storag
{
rows[i] = other_rows[i];
}
return *this;
}

// Assignment operator
Expand Down
1 change: 0 additions & 1 deletion Include/Rocket/Core/StringUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "Header.h"
#include "Types.h"
#include "String.h"
#include <stdarg.h>

namespace Rocket {
namespace Core {
Expand Down
8 changes: 4 additions & 4 deletions Include/Rocket/Core/Transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@
#define ROCKETCORETRANSFORM_H

#include "Header.h"
#include "ReferenceCountable.h"
#include "TransformPrimitive.h"

namespace Rocket {
namespace Core {

namespace Transforms { struct Primitive; }
class Property;

/**
Expand Down Expand Up @@ -77,12 +76,13 @@ class ROCKETCORE_API Transform
Primitives& GetPrimitives() noexcept { return primitives; }
const Primitives& GetPrimitives() const noexcept { return primitives; }

String ToString() const;

private:
Primitives primitives;
};


ROCKETCORE_API String ToString(const Transform& transform);

}
}

Expand Down
Loading

0 comments on commit 90c2d50

Please sign in to comment.