benchmark-toolbox: add benchmark-toolbox
a unified benchmarking tool
This commit is contained in:
35
Source/Benchmark-Toolbox/lib/borealis/library/borealis.mk
Normal file
35
Source/Benchmark-Toolbox/lib/borealis/library/borealis.mk
Normal file
@@ -0,0 +1,35 @@
|
||||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||
current_dir := $(BOREALIS_PATH)/$(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
|
||||
|
||||
LIBS := -ldeko3d -lm $(LIBS)
|
||||
|
||||
include $(TOPDIR)/$(current_dir)/lib/extern/switch-libpulsar/deps.mk
|
||||
|
||||
SOURCES := $(SOURCES) \
|
||||
$(current_dir)/lib/core \
|
||||
$(current_dir)/lib/views \
|
||||
$(current_dir)/lib/platforms/switch \
|
||||
$(current_dir)/lib/extern/glad \
|
||||
$(current_dir)/lib/extern/nanovg-deko3d/source \
|
||||
$(current_dir)/lib/extern/nanovg-deko3d/source/framework \
|
||||
$(current_dir)/lib/extern/nanovg-deko3d/shaders \
|
||||
$(current_dir)/lib/extern/libretro-common/compat \
|
||||
$(current_dir)/lib/extern/libretro-common/encodings \
|
||||
$(current_dir)/lib/extern/libretro-common/features \
|
||||
$(current_dir)/lib/extern/nxfmtwrapper \
|
||||
$(current_dir)/lib/extern/yoga/src/yoga/event \
|
||||
$(current_dir)/lib/extern/yoga/src/yoga \
|
||||
$(current_dir)/lib/extern/tinyxml2/ \
|
||||
$(addprefix $(current_dir)/lib/extern/switch-libpulsar/, $(PLSR_SOURCES))
|
||||
|
||||
INCLUDES := $(INCLUDES) \
|
||||
$(current_dir)/include \
|
||||
$(current_dir)/lib/extern/fmt/include \
|
||||
$(current_dir)/lib/extern/yoga/src \
|
||||
$(current_dir)/lib/extern/nanovg-deko3d/include \
|
||||
$(current_dir)/lib/extern/tweeny/include \
|
||||
$(current_dir)/include/borealis/extern \
|
||||
$(current_dir)/include/borealis/extern/tinyxml2 \
|
||||
$(addprefix $(current_dir)/lib/extern/switch-libpulsar/, $(PLSR_INCLUDES))
|
||||
|
||||
CXXFLAGS := $(CXXFLAGS) -DYG_ENABLE_EVENTS -fdata-sections -DBRLS_RESOURCES="\"romfs:/\""
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright 2019-2021 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// Core
|
||||
#include <borealis/core/actions.hpp>
|
||||
#include <borealis/core/activity.hpp>
|
||||
#include <borealis/core/animation.hpp>
|
||||
#include <borealis/core/application.hpp>
|
||||
#include <borealis/core/assets.hpp>
|
||||
#include <borealis/core/audio.hpp>
|
||||
#include <borealis/core/bind.hpp>
|
||||
#include <borealis/core/box.hpp>
|
||||
#include <borealis/core/event.hpp>
|
||||
#include <borealis/core/font.hpp>
|
||||
#include <borealis/core/frame_context.hpp>
|
||||
#include <borealis/core/i18n.hpp>
|
||||
#include <borealis/core/input.hpp>
|
||||
#include <borealis/core/logger.hpp>
|
||||
#include <borealis/core/platform.hpp>
|
||||
#include <borealis/core/style.hpp>
|
||||
#include <borealis/core/task.hpp>
|
||||
#include <borealis/core/theme.hpp>
|
||||
#include <borealis/core/time.hpp>
|
||||
#include <borealis/core/timer.hpp>
|
||||
#include <borealis/core/video.hpp>
|
||||
#include <borealis/core/view.hpp>
|
||||
|
||||
//Views
|
||||
#include <borealis/views/applet_frame.hpp>
|
||||
#include <borealis/views/button.hpp>
|
||||
#include <borealis/views/header.hpp>
|
||||
#include <borealis/views/image.hpp>
|
||||
#include <borealis/views/label.hpp>
|
||||
#include <borealis/views/rectangle.hpp>
|
||||
#include <borealis/views/scrolling_frame.hpp>
|
||||
#include <borealis/views/sidebar.hpp>
|
||||
#include <borealis/views/tab_frame.hpp>
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright 2020 WerWolv
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/audio.hpp>
|
||||
#include <borealis/core/input.hpp>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
class View;
|
||||
|
||||
typedef std::function<bool(View*)> ActionListener;
|
||||
|
||||
typedef int ActionIdentifier;
|
||||
|
||||
#define ACTION_NONE -1
|
||||
|
||||
struct Action
|
||||
{
|
||||
enum ControllerButton button;
|
||||
|
||||
ActionIdentifier identifier;
|
||||
std::string hintText;
|
||||
bool available;
|
||||
bool hidden;
|
||||
enum Sound sound;
|
||||
ActionListener actionListener;
|
||||
|
||||
bool operator==(const enum ControllerButton other)
|
||||
{
|
||||
return this->button == other;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
Copyright 2020 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/view.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
#define CONTENT_FROM_XML_RES(x) \
|
||||
brls::View* createContentView() override { return brls::View::createFromXMLResource(x); }
|
||||
#define CONTENT_FROM_XML_FILE(x) \
|
||||
brls::View* createContentView() override { return brls::View::createFromXMLFile(x); }
|
||||
#define CONTENT_FROM_XML_STR(x) \
|
||||
brls::View* createContentView() override { return brls::View::createFromXMLString(x); }
|
||||
|
||||
// An activity is a "screen" of your app in which the library adds
|
||||
// the UI components. The app is made of a stack of activities, each activity
|
||||
// containing a views tree.
|
||||
class Activity
|
||||
{
|
||||
public:
|
||||
Activity();
|
||||
virtual ~Activity();
|
||||
|
||||
/**
|
||||
* Sets the content view of this activity, aka
|
||||
* the root view of the tree.
|
||||
*
|
||||
* When the activity is pushed, setContentView() is
|
||||
* automatically called with the result of createContentView().
|
||||
* As such, you should override createContentView() if you want
|
||||
* to use XML in your activity.
|
||||
*/
|
||||
void setContentView(View* view);
|
||||
|
||||
/**
|
||||
* Called when the activity is created. Should return the activity content view, if any.
|
||||
*
|
||||
* Returning nullptr means the content is not known when the activity is created.
|
||||
*
|
||||
* You can use View::createFromXMLFile(), View::createFromXMLResource() and View::createFromXMLString() to load
|
||||
* a view from respectively an XML file path, an XML name in the resources/xml romfs directory and an XML string.
|
||||
*
|
||||
* The CONTENT_FROM_XML_FILE, CONTENT_FROM_XML_RES, CONTENT_FROM_XML_STR macros
|
||||
* are made to make this process simpler: just use them in the public block of your activity
|
||||
* header and it will override createContentView() with the right code for you.
|
||||
*
|
||||
* The onContentAvailable() method will be called once the content has been created, so that
|
||||
* you can get the references to the activity views (by id).
|
||||
*/
|
||||
virtual View* createContentView();
|
||||
|
||||
/**
|
||||
* Called when the content view is created, so that
|
||||
* you can get the references to the activity views (by id).
|
||||
*/
|
||||
virtual void onContentAvailable() {};
|
||||
|
||||
View* getContentView();
|
||||
|
||||
/**
|
||||
* Returns the view with the corresponding id, or nullptr
|
||||
* if it hasn't been found in the activity.
|
||||
*/
|
||||
View* getView(std::string id);
|
||||
|
||||
/**
|
||||
* Resizes the activity to fit the window. Called when the activity
|
||||
* is created and when the window is resized (Switch dock counts as window resize).
|
||||
*/
|
||||
void resizeToFitWindow();
|
||||
|
||||
/**
|
||||
* Returns the duration of the activity show / hide animation.
|
||||
*/
|
||||
virtual float getShowAnimationDuration(TransitionAnimation animation);
|
||||
|
||||
/**
|
||||
* Is this activity translucent, aka can we see the
|
||||
* activities under it in the stack?
|
||||
*/
|
||||
bool isTranslucent();
|
||||
|
||||
void willAppear(bool resetState = false);
|
||||
void willDisappear(bool resetState = false);
|
||||
|
||||
/**
|
||||
* If set to true, will force the activity to be translucent.
|
||||
*/
|
||||
void setInFadeAnimation(bool translucent);
|
||||
|
||||
/**
|
||||
* Shows the activity with a fade in animation, or no animation at all.
|
||||
*/
|
||||
void show(std::function<void(void)> cb, bool animate, float animationDuration);
|
||||
|
||||
/**
|
||||
* Hides the activity with a fade in animation, or no animation at all.
|
||||
*/
|
||||
void hide(std::function<void(void)> cb, bool animate, float animationDuration);
|
||||
|
||||
bool isHidden();
|
||||
|
||||
/**
|
||||
* Registers an action with the given parameters on the content view. The listener will be fired
|
||||
* when the user presses the key.
|
||||
*
|
||||
* The listener should return true if the action was consumed, false otherwise.
|
||||
* The sound will only be played if the listener returned true.
|
||||
*
|
||||
* A hidden action will not show up in the bottom-right hints.
|
||||
*
|
||||
* Must be called after the content view is set.
|
||||
*
|
||||
* Returns the identifier for the action, so it can be unregistered later on. Returns ACTION_NONE if the
|
||||
* action was not registered.
|
||||
*/
|
||||
ActionIdentifier registerAction(std::string hintText, enum ControllerButton button, ActionListener actionListener, bool hidden = false, enum Sound sound = SOUND_NONE);
|
||||
|
||||
/**
|
||||
* Unregisters an action with the given identifier on the content view.
|
||||
*
|
||||
* Must be called after the content view is set.
|
||||
*/
|
||||
void unregisterAction(ActionIdentifier identifier);
|
||||
|
||||
/**
|
||||
* Registers an action to exit the application with the default button BUTTON_START.
|
||||
*
|
||||
* Must be called after the content view is set.
|
||||
*
|
||||
* Returns the identifier for the action, so it can be unregistered later on. Returns ACTION_NONE if the
|
||||
* action was not registered.
|
||||
*/
|
||||
ActionIdentifier registerExitAction(enum ControllerButton button = brls::BUTTON_START);
|
||||
|
||||
void onWindowSizeChanged();
|
||||
|
||||
View* getDefaultFocus();
|
||||
|
||||
void setAlpha(float alpha);
|
||||
|
||||
private:
|
||||
View* contentView = nullptr;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tweeny.h>
|
||||
|
||||
#include <borealis/core/time.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
using EasingFunction = tweeny::easing::enumerated;
|
||||
|
||||
// An animatable is a float which value can be animated from an initial value to a target value,
|
||||
// during a given amount of time. An easing function can also be specified.
|
||||
//
|
||||
// Declare the animatable and then use reset(initialValue) to reset the animation.
|
||||
// Add as many steps as you like by calling addStep(targetValue, duration, easing) one or multiple times.
|
||||
// Then, start and stop the animation with start() and stop().
|
||||
//
|
||||
// setEndCallback() and setTickCallback() allow you to execute code as long as the animation runs and / or once when it finishes.
|
||||
// Use .getValue() to get the current value at any time.
|
||||
//
|
||||
// An animatable has overloads for float conversion, comparison (==) and assignment operator (=) to allow
|
||||
// basic usage as a simple float. Assignment operator is a shortcut to the reset() method.
|
||||
class Animatable : public FiniteTicking
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Creates an animatable with the given initial value.
|
||||
*/
|
||||
Animatable(float value = 0.0f);
|
||||
|
||||
/**
|
||||
* Returns the current animatable value.
|
||||
*/
|
||||
float getValue();
|
||||
|
||||
/**
|
||||
* Stops and resets the animation, going back to the given initial value.
|
||||
* All steps are removed.
|
||||
* If an animation was already ongoing for that animatable, its end callback
|
||||
* will be called.
|
||||
*/
|
||||
void reset(float initialValue);
|
||||
|
||||
/**
|
||||
* Stops and resets the animation. The value will stay where it's at.
|
||||
* All steps are removed.
|
||||
* If an animation was already ongoing for that animatable, its end callback
|
||||
* will be called.
|
||||
*/
|
||||
void reset();
|
||||
|
||||
/**
|
||||
* Adds an animation step to the target value, lasting the specified duration in milliseconds.
|
||||
*
|
||||
* An animation can have multiple steps. Target value can be greater and lower than the previous step (it can go forwards or backwards).
|
||||
* Easing function is optional, default is EasingFunction::linear.
|
||||
*
|
||||
* Duration is int32_t due to internal limitations, so a step cannot last for longer than 2 147 483 647ms.
|
||||
* The sum of the duration of all steps cannot exceed 71582min.
|
||||
*/
|
||||
void addStep(float targetValue, int32_t duration, EasingFunction easing = EasingFunction::linear);
|
||||
|
||||
/**
|
||||
* Returns the progress of the animation between 0.0f and 1.0f.
|
||||
*/
|
||||
float getProgress();
|
||||
|
||||
operator float() const;
|
||||
operator float();
|
||||
void operator=(const float value);
|
||||
bool operator==(const float value);
|
||||
|
||||
protected:
|
||||
bool onUpdate(Time delta) override;
|
||||
|
||||
void onReset() override;
|
||||
void onRewind() override;
|
||||
|
||||
private:
|
||||
float currentValue = 0.0f;
|
||||
tweeny::tween<float> tween;
|
||||
};
|
||||
|
||||
void updateHighlightAnimation();
|
||||
void getHighlightAnimation(float* gradient_x, float* gradient_y, float* color);
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,246 @@
|
||||
/*
|
||||
Copyright 2019-2021 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <nanovg.h>
|
||||
#include <tinyxml2.h>
|
||||
|
||||
#include <borealis/core/activity.hpp>
|
||||
#include <borealis/core/audio.hpp>
|
||||
#include <borealis/core/font.hpp>
|
||||
#include <borealis/core/frame_context.hpp>
|
||||
#include <borealis/core/logger.hpp>
|
||||
#include <borealis/core/platform.hpp>
|
||||
#include <borealis/core/style.hpp>
|
||||
#include <borealis/core/theme.hpp>
|
||||
#include <borealis/core/view.hpp>
|
||||
#include <borealis/views/label.hpp>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
typedef std::function<View*(void)> XMLViewCreator;
|
||||
|
||||
class Application
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Inits the borealis application.
|
||||
* Returns true if it succeeded, false otherwise.
|
||||
*/
|
||||
static bool init();
|
||||
|
||||
/**
|
||||
* Creates the application window with the given title.
|
||||
* Must be called after calling init().
|
||||
*/
|
||||
static void createWindow(std::string title);
|
||||
|
||||
/**
|
||||
* Application main loop iteration.
|
||||
* Must be called in an infinite loop until it returns false.
|
||||
*/
|
||||
static bool mainLoop();
|
||||
|
||||
static Platform* getPlatform();
|
||||
static AudioPlayer* getAudioPlayer();
|
||||
|
||||
static NVGcontext* getNVGContext();
|
||||
inline static float contentWidth, contentHeight;
|
||||
|
||||
/**
|
||||
* Called by the video context when the content window is resized
|
||||
* and when the context is ready (to setup the initial content scaling).
|
||||
*/
|
||||
static void onWindowResized(int width, int height);
|
||||
|
||||
/**
|
||||
* Pushes a view on this applications's view stack.
|
||||
*
|
||||
* The view will automatically be resized to take
|
||||
* the whole screen.
|
||||
*
|
||||
* The view will gain focus if applicable.
|
||||
*
|
||||
* The first activity to be pushed cannot be popped.
|
||||
*/
|
||||
static void pushActivity(Activity* view, TransitionAnimation animation = TransitionAnimation::FADE);
|
||||
|
||||
/**
|
||||
* Pops the last pushed activity from the stack
|
||||
* and gives focus back where it was before.
|
||||
*/
|
||||
static void popActivity(
|
||||
TransitionAnimation animation = TransitionAnimation::FADE, std::function<void(void)> cb = [] {});
|
||||
|
||||
/**
|
||||
* Gives the focus to the given view
|
||||
* or clears the focus if given nullptr.
|
||||
*/
|
||||
static void giveFocus(View* view);
|
||||
|
||||
inline static Style getStyle()
|
||||
{
|
||||
return brls::getStyle();
|
||||
}
|
||||
|
||||
static Theme getTheme();
|
||||
static ThemeVariant getThemeVariant();
|
||||
|
||||
/**
|
||||
* Loads a font from a given file and stores it in the font stash.
|
||||
* Returns true if the operation succeeded.
|
||||
*/
|
||||
static bool loadFontFromFile(std::string fontName, std::string filePath);
|
||||
|
||||
/**
|
||||
* Loads a font from a given memory buffer and stores it in the font stash.
|
||||
* Returns true if the operation succeeded.
|
||||
*/
|
||||
static bool loadFontFromMemory(std::string fontName, void* data, size_t size, bool freeData);
|
||||
|
||||
/**
|
||||
* Returns the nanovg handle to the given font name, or FONT_INVALID if
|
||||
* no such font is currently loaded.
|
||||
*/
|
||||
static int getFont(std::string fontName);
|
||||
|
||||
static void notify(std::string text);
|
||||
|
||||
static void onControllerButtonPressed(enum ControllerButton button, bool repeating);
|
||||
|
||||
/**
|
||||
* "Crashes" the app (displays a fullscreen CrashFrame)
|
||||
*/
|
||||
static void crash(std::string text);
|
||||
|
||||
static void quit();
|
||||
|
||||
/**
|
||||
* Blocks any and all user inputs
|
||||
*/
|
||||
static void blockInputs();
|
||||
|
||||
/**
|
||||
* Unblocks inputs after a call to
|
||||
* blockInputs()
|
||||
*/
|
||||
static void unblockInputs();
|
||||
|
||||
static void setCommonFooter(std::string footer);
|
||||
static std::string* getCommonFooter();
|
||||
|
||||
static void setDisplayFramerate(bool enabled);
|
||||
static void toggleFramerateDisplay();
|
||||
|
||||
static void setMaximumFPS(unsigned fps);
|
||||
|
||||
inline static float windowScale;
|
||||
|
||||
/**
|
||||
* Sets whether BUTTON_START will globally be used to close the application.
|
||||
*/
|
||||
static void setGlobalQuit(bool enabled);
|
||||
|
||||
/**
|
||||
* Sets whether BUTTON_BACK will globally be used to toggle an FPS display.
|
||||
*/
|
||||
static void setGlobalFPSToggle(bool enabled);
|
||||
|
||||
static GenericEvent* getGlobalFocusChangeEvent();
|
||||
static VoidEvent* getGlobalHintsUpdateEvent();
|
||||
|
||||
static View* getCurrentFocus();
|
||||
|
||||
static std::string getTitle();
|
||||
|
||||
/**
|
||||
* Registers a view to be created from XML. You must give the name of the XML node as well
|
||||
* as a function that creates the view.
|
||||
*
|
||||
* If you need attributes, register them with the given functions in the view
|
||||
* class constructor directly. They will be called one by one after the view is instantiated.
|
||||
*
|
||||
* You should not add any children in the function, it is already taken care of.
|
||||
*/
|
||||
static void registerXMLView(std::string name, XMLViewCreator creator);
|
||||
|
||||
static bool XMLViewsRegisterContains(std::string name);
|
||||
static XMLViewCreator getXMLViewCreator(std::string name);
|
||||
|
||||
/**
|
||||
* Returns the current system locale.
|
||||
*/
|
||||
static std::string getLocale();
|
||||
|
||||
private:
|
||||
inline static bool inited = false;
|
||||
inline static bool quitRequested = false;
|
||||
|
||||
inline static Platform* platform = nullptr;
|
||||
|
||||
inline static std::string title;
|
||||
|
||||
inline static FontStash fontStash;
|
||||
|
||||
inline static std::vector<Activity*> activitiesStack;
|
||||
inline static std::vector<View*> focusStack;
|
||||
|
||||
inline static unsigned windowWidth, windowHeight;
|
||||
|
||||
inline static View* currentFocus;
|
||||
|
||||
inline static unsigned blockInputsTokens = 0; // any value > 0 means inputs are blocked
|
||||
|
||||
inline static std::string commonFooter = "";
|
||||
|
||||
inline static bool globalQuitEnabled = false;
|
||||
inline static ActionIdentifier gloablQuitIdentifier = ACTION_NONE;
|
||||
inline static bool globalFPSToggleEnabled = false;
|
||||
inline static ActionIdentifier gloablFPSToggleIdentifier = ACTION_NONE;
|
||||
|
||||
inline static View* repetitionOldFocus = nullptr;
|
||||
|
||||
inline static GenericEvent globalFocusChangeEvent;
|
||||
inline static VoidEvent globalHintsUpdateEvent;
|
||||
|
||||
inline static std::unordered_map<std::string, XMLViewCreator> xmlViewsRegister;
|
||||
|
||||
static void navigate(FocusDirection direction);
|
||||
|
||||
static void onWindowSizeChanged();
|
||||
|
||||
static void frame();
|
||||
static void clear();
|
||||
static void exit();
|
||||
|
||||
/**
|
||||
* Handles actions for the currently focused view and
|
||||
* the given button
|
||||
* Returns true if at least one action has been fired
|
||||
*/
|
||||
static bool handleAction(char button);
|
||||
|
||||
static void registerBuiltInXMLViews();
|
||||
|
||||
static ActionIdentifier registerFPSToggleAction(Activity* activity);
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright 2019-2021 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef BRLS_RESOURCES
|
||||
#error BRLS_RESOURCES define missing
|
||||
#endif
|
||||
#define BRLS_ASSET(_str) BRLS_RESOURCES _str
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
enum Sound
|
||||
{
|
||||
SOUND_NONE = 0, // no sound
|
||||
|
||||
SOUND_FOCUS_CHANGE, // played when the focus changes
|
||||
SOUND_FOCUS_ERROR, // played when the user wants to go somewhere impossible (while the highlight wiggles)
|
||||
SOUND_CLICK, // played when the click action runs
|
||||
SOUND_FOCUS_SIDEBAR, // played when the focus changes to a sidebar item
|
||||
SOUND_CLICK_ERROR, // played when the user clicks a disabled button / a view focused with no click action
|
||||
SOUND_HONK, // honk
|
||||
SOUND_CLICK_SIDEBAR, // played when a sidebar item is clicked
|
||||
|
||||
_SOUND_MAX, // not an actual sound, just used to count of many sounds there are
|
||||
};
|
||||
|
||||
// Platform agnostic Audio player
|
||||
// Each platform's AudioPlayer is responsible for managing the enum Sound -> internal representation map
|
||||
class AudioPlayer
|
||||
{
|
||||
public:
|
||||
virtual ~AudioPlayer() {};
|
||||
|
||||
/**
|
||||
* Preemptively loads the given sound so that it's ready to be played
|
||||
* when needed.
|
||||
*
|
||||
* Returns a boolean indicating if the sound has been loaded or not.
|
||||
*/
|
||||
virtual bool load(enum Sound sound) = 0;
|
||||
|
||||
/**
|
||||
* Plays the given sound.
|
||||
*
|
||||
* The AudioPlayer should not assume that the sound has been
|
||||
* loaded already, and must load it if needed.
|
||||
*
|
||||
* Returns a boolean indicating if the sound has been played or not.
|
||||
*/
|
||||
virtual bool play(enum Sound sound) = 0;
|
||||
};
|
||||
|
||||
// An AudioPlayer that does nothing
|
||||
class NullAudioPlayer : public AudioPlayer
|
||||
{
|
||||
public:
|
||||
bool load(enum Sound sound) override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool play(enum Sound sound) override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/activity.hpp>
|
||||
#include <borealis/core/view.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// Exception thrown when using a BoundView with an unknown ID for
|
||||
// the given owner.
|
||||
class ViewNotFoundException : public std::exception
|
||||
{
|
||||
public:
|
||||
ViewNotFoundException(View* owner, std::string searchedId);
|
||||
ViewNotFoundException(Activity* owner, std::string searchedId);
|
||||
|
||||
const char* what() const noexcept;
|
||||
|
||||
private:
|
||||
std::string errorMessage;
|
||||
};
|
||||
|
||||
#define BRLS_BIND(type, name, id) brls::BoundView<type> name = brls::BoundView<type>(id, this)
|
||||
|
||||
// A BoundView represents a "child" view, bound to its "parent" view class.
|
||||
// Dereferencing operator has been overridden to directly resolve the view by ID and forward the call to the view pointer for you.
|
||||
// Allows easy access of child views inside the parent class when used with the BRLS_BIND macro.
|
||||
// Does NOT do any type check - it assumes the type you give it is the same as the view you are trying to get.
|
||||
template <typename T>
|
||||
class BoundView
|
||||
{
|
||||
public:
|
||||
BoundView(std::string id, View* owner)
|
||||
: id(id)
|
||||
, ownerView(owner)
|
||||
{
|
||||
}
|
||||
|
||||
BoundView(std::string id, Activity* owner)
|
||||
: id(id)
|
||||
, ownerActivity(owner)
|
||||
{
|
||||
}
|
||||
|
||||
T* getView()
|
||||
{
|
||||
this->resolve();
|
||||
return this->view;
|
||||
}
|
||||
|
||||
operator T*()
|
||||
{
|
||||
return this->getView();
|
||||
}
|
||||
|
||||
T* operator->()
|
||||
{
|
||||
return this->getView();
|
||||
}
|
||||
|
||||
bool operator==(const T* value)
|
||||
{
|
||||
return this->getView() == value;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string id = "";
|
||||
|
||||
T* view = nullptr;
|
||||
|
||||
View* ownerView = nullptr;
|
||||
Activity* ownerActivity = nullptr;
|
||||
|
||||
/**
|
||||
* Resolve the view pointer by id.
|
||||
*
|
||||
* Not called in the constructor
|
||||
* on purpose because the owner might now be ready when
|
||||
* the BoundView is constructed, so wait for the first
|
||||
* actual call before resolving the view.
|
||||
*/
|
||||
void resolve()
|
||||
{
|
||||
if (this->view)
|
||||
return;
|
||||
|
||||
// Resolve by owner activity first
|
||||
if (this->ownerView)
|
||||
{
|
||||
this->view = (T*)this->ownerView->getView(this->id);
|
||||
|
||||
if (!this->view)
|
||||
throw ViewNotFoundException(this->ownerView, this->id);
|
||||
}
|
||||
// Then resolve by owner view
|
||||
else if (this->ownerActivity)
|
||||
{
|
||||
this->view = (T*)this->ownerActivity->getView(this->id);
|
||||
|
||||
if (!this->view)
|
||||
throw ViewNotFoundException(this->ownerActivity, this->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::logic_error("No owner view or activity given to BoundView");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,280 @@
|
||||
/*
|
||||
Copyright 2020-2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/view.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
enum class JustifyContent
|
||||
{
|
||||
FLEX_START,
|
||||
CENTER,
|
||||
FLEX_END,
|
||||
SPACE_BETWEEN,
|
||||
SPACE_AROUND,
|
||||
SPACE_EVENLY,
|
||||
};
|
||||
|
||||
enum class AlignItems
|
||||
{
|
||||
AUTO,
|
||||
FLEX_START,
|
||||
CENTER,
|
||||
FLEX_END,
|
||||
STRETCH,
|
||||
BASELINE,
|
||||
SPACE_BETWEEN,
|
||||
SPACE_AROUND,
|
||||
};
|
||||
|
||||
enum class Axis
|
||||
{
|
||||
ROW,
|
||||
COLUMN,
|
||||
};
|
||||
|
||||
enum class Direction
|
||||
{
|
||||
INHERIT,
|
||||
LEFT_TO_RIGHT,
|
||||
RIGHT_TO_LEFT,
|
||||
};
|
||||
|
||||
// Generic FlexBox layout
|
||||
class Box : public View
|
||||
{
|
||||
public:
|
||||
Box(Axis flexDirection);
|
||||
Box();
|
||||
|
||||
void draw(NVGcontext* vg, float x, float y, float width, float height, Style style, FrameContext* ctx) override;
|
||||
View* getDefaultFocus() override;
|
||||
View* getNextFocus(FocusDirection direction, View* currentView) override;
|
||||
void willAppear(bool resetState) override;
|
||||
void willDisappear(bool resetState) override;
|
||||
void onWindowSizeChanged() override;
|
||||
void onFocusGained() override;
|
||||
void onFocusLost() override;
|
||||
void onParentFocusGained(View* focusedView) override;
|
||||
void onParentFocusLost(View* focusedView) override;
|
||||
bool applyXMLAttribute(std::string name, std::string value) override;
|
||||
|
||||
static View* create();
|
||||
|
||||
/**
|
||||
* Adds a view to this Box.
|
||||
* Returns the position the view was added at.
|
||||
*/
|
||||
virtual void addView(View* view);
|
||||
|
||||
/**
|
||||
* Adds a view to this Box at the given position.
|
||||
* Returns the position the view was added at.
|
||||
*/
|
||||
virtual void addView(View* view, size_t position);
|
||||
|
||||
/**
|
||||
* Removes the given view from the Box. It will be freed.
|
||||
*/
|
||||
virtual void removeView(View* view);
|
||||
|
||||
/**
|
||||
* Sets the padding of the view, aka the internal space to give
|
||||
* between this view boundaries and its children.
|
||||
*
|
||||
* Only does one layout pass instead of four when using the four methods separately.
|
||||
*/
|
||||
virtual void setPadding(float padding);
|
||||
|
||||
/**
|
||||
* Sets the padding of the view, aka the internal space to give
|
||||
* between this view boundaries and its children.
|
||||
*
|
||||
* Only does one layout pass instead of four when using the four methods separately.
|
||||
*/
|
||||
virtual void setPadding(float top, float right, float bottom, float left);
|
||||
|
||||
/**
|
||||
* Sets the padding of the view, aka the internal space to give
|
||||
* between this view boundaries and its children.
|
||||
*/
|
||||
virtual void setPaddingTop(float top);
|
||||
|
||||
/**
|
||||
* Sets the padding of the view, aka the internal space to give
|
||||
* between this view boundaries and its children.
|
||||
*/
|
||||
virtual void setPaddingRight(float right);
|
||||
|
||||
/**
|
||||
* Sets the padding of the view, aka the internal space to give
|
||||
* between this view boundaries and its children.
|
||||
*/
|
||||
virtual void setPaddingBottom(float bottom);
|
||||
|
||||
/**
|
||||
* Sets the padding of the view, aka the internal space to give
|
||||
* between this view boundaries and its children.
|
||||
*/
|
||||
virtual void setPaddingLeft(float left);
|
||||
|
||||
/**
|
||||
* Sets the children alignment along the Box axis.
|
||||
*
|
||||
* Default is FLEX_START.
|
||||
*/
|
||||
void setJustifyContent(JustifyContent justify);
|
||||
|
||||
/**
|
||||
* Sets the children alignment along the Box cross axis.
|
||||
*
|
||||
* Default is AUTO.
|
||||
*/
|
||||
void setAlignItems(AlignItems alignment);
|
||||
|
||||
/**
|
||||
* Sets the direction of the box, aka place the views
|
||||
* left to right or right to left (flips the children).
|
||||
*
|
||||
* Default is INHERIT.
|
||||
*/
|
||||
void setDirection(Direction direction);
|
||||
|
||||
void setAxis(Axis axis);
|
||||
|
||||
std::vector<View*>& getChildren();
|
||||
|
||||
/**
|
||||
* Returns the bounds used for culling children.
|
||||
*/
|
||||
virtual void getCullingBounds(float* top, float* right, float* bottom, float* left);
|
||||
|
||||
/**
|
||||
* Registers an XML attribute to be forwarded to the given view. Works regardless of the target attribute type.
|
||||
* Useful to expose attributes of children views in the parent box without copy pasting them individually.
|
||||
*
|
||||
* The forwarded attribute value will override the value of the regular attribute if it already exists in the target view.
|
||||
*/
|
||||
void forwardXMLAttribute(std::string attributeName, View* target);
|
||||
|
||||
/**
|
||||
* Registers an XML attribute to be forwarded to the given view, while changing the target attribute name.
|
||||
* Works regardless of the target attribute type.
|
||||
* Useful to expose attributes of children views in the parent box without copy pasting them individually, but with a different name.
|
||||
*
|
||||
* The forwarded attribute value will override the value of the regular attribute if it already exists in the target view.
|
||||
*/
|
||||
void forwardXMLAttribute(std::string attributeName, View* target, std::string targetAttributeName);
|
||||
|
||||
/**
|
||||
* Fired when focus is gained on one of this view's children, or one of the children
|
||||
* of the children...
|
||||
*
|
||||
* directChild is guaranteed to be one of your children. It may not be the view that has been
|
||||
* focused.
|
||||
*
|
||||
* If focusedView == directChild, then the child of yours has been focused.
|
||||
* Otherwise, focusedView is a child of directChild.
|
||||
*/
|
||||
virtual void onChildFocusGained(View* directChild, View* focusedView);
|
||||
|
||||
/**
|
||||
* Fired when focus is lost on one of this view's children. Works similarly to
|
||||
* onChildFocusGained().
|
||||
*/
|
||||
virtual void onChildFocusLost(View* directChild, View* focusedView);
|
||||
|
||||
View* getView(std::string id) override;
|
||||
|
||||
private:
|
||||
Axis axis;
|
||||
|
||||
std::vector<View*> children;
|
||||
|
||||
size_t defaultFocusedIndex = 0;
|
||||
|
||||
std::unordered_map<std::string, std::pair<std::string, View*>> forwardedAttributes;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Inflates the Box with the given XML string.
|
||||
*
|
||||
* The root element MUST be a brls::Box, corresponding to the inflated Box itself. Its
|
||||
* attributes will be applied to the Box.
|
||||
*
|
||||
* Each child node in the root brls::Box will be treated as a view and added
|
||||
* as a child of the Box.
|
||||
*/
|
||||
void inflateFromXMLString(std::string xml);
|
||||
|
||||
/**
|
||||
* Inflates the Box with the given XML element.
|
||||
*
|
||||
* The root element MUST be a brls::Box, corresponding to the inflated Box itself. Its
|
||||
* attributes will be applied to the Box.
|
||||
*
|
||||
* Each child node in the root brls::Box will be treated as a view and added
|
||||
* as a child of the Box.
|
||||
*/
|
||||
void inflateFromXMLElement(tinyxml2::XMLElement* element);
|
||||
|
||||
/**
|
||||
* Inflates the Box with the given XML resource.
|
||||
*
|
||||
* The root element MUST be a brls::Box, corresponding to the inflated Box itself. Its
|
||||
* attributes will be applied to the Box.
|
||||
*
|
||||
* Each child node in the root brls::Box will be treated as a view and added
|
||||
* as a child of the Box.
|
||||
*/
|
||||
void inflateFromXMLRes(std::string res);
|
||||
|
||||
/**
|
||||
* Inflates the Box with the given XML file path.
|
||||
*
|
||||
* The root element MUST be a brls::Box, corresponding to the inflated Box itself. Its
|
||||
* attributes will be applied to the Box.
|
||||
*
|
||||
* Each child node in the root brls::Box will be treated as a view and added
|
||||
* as a child of the Box.
|
||||
*/
|
||||
void inflateFromXMLFile(std::string path);
|
||||
|
||||
/**
|
||||
* Handles a child XML element.
|
||||
*
|
||||
* By default, calls createFromXMLElement() and adds the result
|
||||
* to the children of the Box.
|
||||
*/
|
||||
void handleXMLElement(tinyxml2::XMLElement* element) override;
|
||||
};
|
||||
|
||||
// An empty view that has auto x auto and grow=1.0 to push
|
||||
// all the next views in its box to the right (or to the bottom)
|
||||
class Padding : public View
|
||||
{
|
||||
public:
|
||||
Padding();
|
||||
|
||||
void draw(NVGcontext* vg, float x, float y, float width, float height, Style style, FrameContext* ctx) override;
|
||||
|
||||
static View* create();
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
Copyright 2020 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// Simple observer pattern implementation
|
||||
//
|
||||
// Usage:
|
||||
// 1. typedef your event type
|
||||
// 2. create as many events as you want using that type
|
||||
// 3. call subscribe on the events with your observers
|
||||
// 4. call fire when you want to fire the events
|
||||
// it wil return true if at least one subscriber exists
|
||||
// for that event
|
||||
template <typename... Ts>
|
||||
class Event
|
||||
{
|
||||
public:
|
||||
typedef std::function<void(Ts...)> Callback;
|
||||
typedef std::list<Callback> CallbacksList;
|
||||
typedef typename CallbacksList::iterator Subscription;
|
||||
|
||||
Subscription subscribe(Callback cb);
|
||||
void unsubscribe(Subscription subscription);
|
||||
bool fire(Ts... args);
|
||||
|
||||
private:
|
||||
CallbacksList callbacks;
|
||||
};
|
||||
|
||||
template <typename... Ts>
|
||||
typename Event<Ts...>::Subscription Event<Ts...>::subscribe(Event<Ts...>::Callback cb)
|
||||
{
|
||||
this->callbacks.push_back(cb);
|
||||
return --this->callbacks.end();
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
void Event<Ts...>::unsubscribe(Event<Ts...>::Subscription subscription)
|
||||
{
|
||||
this->callbacks.erase(subscription);
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
bool Event<Ts...>::fire(Ts... args)
|
||||
{
|
||||
for (Callback cb : this->callbacks)
|
||||
cb(args...);
|
||||
|
||||
return !this->callbacks.empty();
|
||||
}
|
||||
|
||||
}; // namespace brls
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
static constexpr const int FONT_INVALID = -1;
|
||||
|
||||
static const std::string FONT_REGULAR = "regular"; // regular Latin font
|
||||
static const std::string FONT_KOREAN_REGULAR = "korean"; // regular Korean font
|
||||
static const std::string FONT_MATERIAL_ICONS = "material"; // Material icons font
|
||||
static const std::string FONT_SWITCH_ICONS = "switch"; // Switch icons font (see the HOS shared symbols font for an example)
|
||||
|
||||
typedef std::unordered_map<std::string, int> FontStash;
|
||||
|
||||
// Platform interface to load fonts from disk or other sources (system / shared font...)
|
||||
class FontLoader
|
||||
{
|
||||
public:
|
||||
virtual ~FontLoader() {}
|
||||
/**
|
||||
* Called once on init to load every font in the font stash.
|
||||
*
|
||||
* The implementation must use the Application::loadFont and
|
||||
* Application::loadFontFromMemory methods to load as much as possible
|
||||
* of the "built-in" fonts defined in the FONT_* constants above.
|
||||
*/
|
||||
virtual void loadFonts() = 0;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Convenience method to load a font from a file path
|
||||
* with some more logging.
|
||||
*/
|
||||
bool loadFontFromFile(std::string fontName, std::string filePath);
|
||||
|
||||
/**
|
||||
* Can be called internally to load the Material icons font from resources.
|
||||
* Returns true if the operation succeeds.
|
||||
*/
|
||||
bool loadMaterialFromResources();
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright 2019 natinusala
|
||||
Copyright 2019 psam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <nanovg.h>
|
||||
|
||||
#include <borealis/core/font.hpp>
|
||||
#include <borealis/core/style.hpp>
|
||||
#include <borealis/core/theme.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
class FrameContext
|
||||
{
|
||||
public:
|
||||
NVGcontext* vg = nullptr;
|
||||
float pixelRatio = 0.0;
|
||||
FontStash* fontStash = nullptr;
|
||||
Theme theme = nullptr;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
Copyright 2020-2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fmt/core.h>
|
||||
|
||||
#include <borealis/core/logger.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
const std::string LOCALE_JA = "ja";
|
||||
const std::string LOCALE_EN_US = "en-US";
|
||||
const std::string LOCALE_EN_GB = "en-GB";
|
||||
const std::string LOCALE_FR = "fr";
|
||||
const std::string LOCALE_FR_CA = "fr-CA";
|
||||
const std::string LOCALE_DE = "de";
|
||||
const std::string LOCALE_IT = "it";
|
||||
const std::string LOCALE_ES = "es";
|
||||
const std::string LOCALE_ZH_CN = "zh-CN";
|
||||
const std::string LOCALE_ZH_HANS = "zh-Hans";
|
||||
const std::string LOCALE_ZH_HANT = "zh-Hant";
|
||||
const std::string LOCALE_ZH_TW = "zh-TW";
|
||||
const std::string LOCALE_Ko = "ko";
|
||||
const std::string LOCALE_NL = "nl";
|
||||
const std::string LOCALE_PT = "pt";
|
||||
const std::string LOCALE_PT_BR = "pt-BR";
|
||||
const std::string LOCALE_RU = "ru";
|
||||
const std::string LOCALE_ES_419 = "es-419";
|
||||
|
||||
const std::string LOCALE_DEFAULT = LOCALE_EN_US;
|
||||
|
||||
namespace internal
|
||||
{
|
||||
std::string getRawStr(std::string stringName);
|
||||
} // namespace internal
|
||||
|
||||
/**
|
||||
* Returns the translation for the given string,
|
||||
* after injecting format parameters (if any)
|
||||
*/
|
||||
template <typename... Args>
|
||||
std::string getStr(std::string stringName, Args&&... args)
|
||||
{
|
||||
std::string rawStr = internal::getRawStr(stringName);
|
||||
|
||||
try
|
||||
{
|
||||
return fmt::format(rawStr, args...);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
Logger::error("Invalid format \"{}\" from string \"{}\": {}", rawStr, stringName, e.what());
|
||||
return stringName;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all translations of the current system locale + default locale
|
||||
* Must be called before trying to get a translation!
|
||||
*/
|
||||
void loadTranslations();
|
||||
|
||||
inline namespace literals
|
||||
{
|
||||
/**
|
||||
* Returns the translation for the given string, without
|
||||
* injecting any parameters
|
||||
* Shortcut to brls::getStr(stringName)
|
||||
*/
|
||||
std::string operator"" _i18n(const char* str, size_t len);
|
||||
} // namespace literals
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// Abstract buttons enum - names correspond to a generic Xbox controller
|
||||
// LT and RT should not be buttons but for the sake of simplicity we'll assume they are.
|
||||
// Similarly, DPAD (also called HAT) is assumed to be buttons here.
|
||||
enum ControllerButton
|
||||
{
|
||||
BUTTON_LT = 0,
|
||||
BUTTON_LB,
|
||||
|
||||
BUTTON_LSB,
|
||||
|
||||
BUTTON_UP,
|
||||
BUTTON_RIGHT,
|
||||
BUTTON_DOWN,
|
||||
BUTTON_LEFT,
|
||||
|
||||
BUTTON_BACK,
|
||||
BUTTON_GUIDE,
|
||||
BUTTON_START,
|
||||
|
||||
BUTTON_RSB,
|
||||
|
||||
BUTTON_Y,
|
||||
BUTTON_B,
|
||||
BUTTON_A,
|
||||
BUTTON_X,
|
||||
|
||||
BUTTON_RB,
|
||||
BUTTON_RT,
|
||||
|
||||
_BUTTON_MAX,
|
||||
};
|
||||
|
||||
// Abstract axis enum - names correspond to a generic Xbox controller
|
||||
enum ControllerAxis
|
||||
{
|
||||
LEFT_X,
|
||||
LEFT_Y,
|
||||
|
||||
// No Z axis, LT and RT are in the buttons enum for the sake of simplicity
|
||||
|
||||
RIGHT_X, // also called 5th axis
|
||||
RIGHT_Y, // also called 4th axis
|
||||
|
||||
_AXES_MAX,
|
||||
};
|
||||
|
||||
// Represents the state of the controller (a gamepad or a keyboard) in the current frame
|
||||
typedef struct ControllerState
|
||||
{
|
||||
bool buttons[_BUTTON_MAX]; // true: pressed
|
||||
float axes[_AXES_MAX]; // from 0.0f to 1.0f
|
||||
} ControllerState;
|
||||
|
||||
// Interface responsible for reporting input state to the application - button presses,
|
||||
// axis position and touch screen state
|
||||
class InputManager
|
||||
{
|
||||
public:
|
||||
virtual ~InputManager() {}
|
||||
|
||||
/**
|
||||
* Called once every frame to fill the given ControllerState struct with the controller state.
|
||||
*/
|
||||
virtual void updateControllerState(ControllerState* state) = 0;
|
||||
};
|
||||
|
||||
}; // namespace brls
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
Copyright 2019 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fmt/core.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
enum class LogLevel
|
||||
{
|
||||
ERROR = 0,
|
||||
WARNING,
|
||||
INFO,
|
||||
DEBUG
|
||||
};
|
||||
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
static void setLogLevel(LogLevel logLevel);
|
||||
|
||||
template <typename... Args>
|
||||
inline static void log(LogLevel logLevel, std::string prefix, std::string color, std::string format, Args&&... args)
|
||||
{
|
||||
if (Logger::logLevel < logLevel)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
fmt::print("\033{}[{}]\033[0m ", color, prefix);
|
||||
fmt::print(format, args...);
|
||||
fmt::print("\n");
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
// will be printed after the first fmt::print (so after the log tag)
|
||||
printf("! Invalid log format string: \"%s\": %s\n", format.c_str(), e.what());
|
||||
}
|
||||
|
||||
#ifdef __MINGW32__
|
||||
fflush(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline static void error(std::string format, Args&&... args)
|
||||
{
|
||||
Logger::log(LogLevel::ERROR, "ERROR", "[0;31m", format, args...);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline static void warning(std::string format, Args&&... args)
|
||||
{
|
||||
Logger::log(LogLevel::WARNING, "WARNING", "[0;33m", format, args...);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline static void info(std::string format, Args&&... args)
|
||||
{
|
||||
Logger::log(LogLevel::INFO, "INFO", "[0;34m", format, args...);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline static void debug(std::string format, Args&&... args)
|
||||
{
|
||||
Logger::log(LogLevel::DEBUG, "DEBUG", "[0;32m", format, args...);
|
||||
}
|
||||
|
||||
private:
|
||||
inline static LogLevel logLevel = LogLevel::INFO;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/audio.hpp>
|
||||
#include <borealis/core/font.hpp>
|
||||
#include <borealis/core/input.hpp>
|
||||
#include <borealis/core/theme.hpp>
|
||||
#include <borealis/core/video.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// Interface to provide everything platform specific required to run borealis: graphics context, inputs, audio...
|
||||
// The best platform is automatically selected when the application starts, and cannot be changed by the user at the moment
|
||||
class Platform
|
||||
{
|
||||
public:
|
||||
virtual ~Platform() {};
|
||||
|
||||
/**
|
||||
* Called on startup, right after instanciation, to create and open a window
|
||||
* with the given title and size.
|
||||
*/
|
||||
virtual void createWindow(std::string title, uint32_t width, uint32_t height) = 0;
|
||||
|
||||
/**
|
||||
* Returns the human-readable name of the platform.
|
||||
*/
|
||||
virtual std::string getName() = 0;
|
||||
|
||||
/**
|
||||
* Called at every iteration of the main loop.
|
||||
* Must return false if the app should continue running
|
||||
* (for example, return false if the X button was pressed on the window).
|
||||
*/
|
||||
virtual bool mainLoopIteration() = 0;
|
||||
|
||||
/**
|
||||
* Can be called at anytime to get the current system theme variant.
|
||||
*
|
||||
* For now, the variant is assumed to stay the same during the whole time
|
||||
* the app is running (no variant hot swap).
|
||||
*
|
||||
* As such, the result should be cached by the platform code.
|
||||
*/
|
||||
virtual ThemeVariant getThemeVariant() = 0;
|
||||
|
||||
/**
|
||||
* Can be called at anytime to get the current locale
|
||||
*
|
||||
* For now, the locale is assumed to stay the same during the whole time
|
||||
* the app is running (no locale hot swap)
|
||||
*
|
||||
* As such, the result should be cached by the platform code.
|
||||
* The method should return one of the locale constants
|
||||
* defined in the i18n header file.
|
||||
*/
|
||||
virtual std::string getLocale() = 0;
|
||||
|
||||
/**
|
||||
* Returns the AudioPlayer for the platform.
|
||||
* Cannot return nullptr.
|
||||
*/
|
||||
virtual AudioPlayer* getAudioPlayer() = 0;
|
||||
|
||||
/**
|
||||
* Returns the VideoContext for the platform.
|
||||
* Cannot return nullptr.
|
||||
*/
|
||||
virtual VideoContext* getVideoContext() = 0;
|
||||
|
||||
/**
|
||||
* Returns the InputManager for the platform.
|
||||
* Cannot return nullptr.
|
||||
*/
|
||||
virtual InputManager* getInputManager() = 0;
|
||||
|
||||
/**
|
||||
* Returns the FontLoader for the platform.
|
||||
* Cannot return nullptr.
|
||||
*/
|
||||
virtual FontLoader* getFontLoader() = 0;
|
||||
|
||||
/**
|
||||
* Selects and returns the best platform.
|
||||
*/
|
||||
static Platform* createPlatform();
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright 2019-2020 natinusala
|
||||
Copyright 2019 WerWolv
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <initializer_list>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
class StyleValues
|
||||
{
|
||||
public:
|
||||
StyleValues(std::initializer_list<std::pair<std::string, float>> list);
|
||||
|
||||
void addMetric(std::string name, float value);
|
||||
float getMetric(std::string name);
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, float> values;
|
||||
};
|
||||
|
||||
// Simple wrapper around StyleValues for the array operator
|
||||
class Style
|
||||
{
|
||||
public:
|
||||
Style(StyleValues* values);
|
||||
float operator[](std::string name);
|
||||
|
||||
void addMetric(std::string name, float value);
|
||||
float getMetric(std::string name);
|
||||
|
||||
private:
|
||||
StyleValues* values;
|
||||
};
|
||||
|
||||
Style getStyle();
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/timer.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// A RepeatingTask is a task executed repeatedly on the main thread at a given period in ms
|
||||
class RepeatingTask : private RepeatingTimer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create a RepeatingTask with the given period in ms.
|
||||
*
|
||||
* The task is guaranteed to wait for at least the given period of time between
|
||||
* handler runs, but it can wait for slightly longer (usually less than a ms late)
|
||||
*/
|
||||
RepeatingTask(Time period);
|
||||
|
||||
/**
|
||||
* Task handler executed repeatedly on the main thread at the given period.
|
||||
*/
|
||||
virtual void run() = 0;
|
||||
|
||||
/**
|
||||
* Starts the task.
|
||||
*/
|
||||
void start();
|
||||
|
||||
/**
|
||||
* Stops the task.
|
||||
*/
|
||||
void stop();
|
||||
};
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright 2019-2020 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <nanovg.h>
|
||||
|
||||
#include <initializer_list>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
enum class ThemeVariant
|
||||
{
|
||||
LIGHT,
|
||||
DARK
|
||||
};
|
||||
|
||||
class ThemeValues
|
||||
{
|
||||
public:
|
||||
ThemeValues(std::initializer_list<std::pair<std::string, NVGcolor>> list);
|
||||
|
||||
void addColor(std::string name, NVGcolor color);
|
||||
NVGcolor getColor(std::string name);
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, NVGcolor> values;
|
||||
};
|
||||
|
||||
// Simple wrapper around ThemeValues for the array operator
|
||||
class Theme
|
||||
{
|
||||
public:
|
||||
Theme(ThemeValues* values);
|
||||
NVGcolor operator[](std::string name);
|
||||
|
||||
void addColor(std::string name, NVGcolor color);
|
||||
NVGcolor getColor(std::string name);
|
||||
|
||||
private:
|
||||
ThemeValues* values;
|
||||
};
|
||||
|
||||
Theme getLightTheme();
|
||||
Theme getDarkTheme();
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <libretro-common/features/features_cpu.h>
|
||||
#include <libretro-common/libretro.h>
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
typedef retro_time_t Time;
|
||||
|
||||
/**
|
||||
* Returns the current CPU time in microseconds.
|
||||
*/
|
||||
inline Time getCPUTimeUsec()
|
||||
{
|
||||
return cpu_features_get_time_usec();
|
||||
}
|
||||
|
||||
typedef std::function<void()> TickingGenericCallback;
|
||||
|
||||
typedef std::function<void(bool)> TickingEndCallback;
|
||||
typedef TickingGenericCallback TickingTickCallback;
|
||||
|
||||
// Interface representing something that "ticks" every frame for a certain amount of frames,
|
||||
// like a timer, an animation, a background task...
|
||||
// The library manages a list of running tickings. Each ticking is reponsible for managing its own
|
||||
// lifetime by returning true or false in onUpdate.
|
||||
class Ticking
|
||||
{
|
||||
public:
|
||||
virtual ~Ticking();
|
||||
|
||||
/**
|
||||
* Starts the ticking, pushing it to the list of running tickings.
|
||||
* If the ticking is finished, it will be restarted.
|
||||
* If the ticking is already running, this method will have no effect.
|
||||
*/
|
||||
void start();
|
||||
|
||||
/**
|
||||
* Stops the ticking if it was running, and executes the end callback.
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* Sets a callback to be executed when the
|
||||
* ticking finishes.
|
||||
* The callback argument will be set to true if the ticking stopped
|
||||
* on its own, false if it was stopped early by the user.
|
||||
*/
|
||||
void setEndCallback(TickingEndCallback endCallback);
|
||||
|
||||
/**
|
||||
* Sets a callback to be executed at every tick
|
||||
* until the ticking finishes.
|
||||
*
|
||||
* The last animation tick will execute the tick callback
|
||||
* then the end callback.
|
||||
*/
|
||||
void setTickCallback(TickingTickCallback tickCallback);
|
||||
|
||||
/**
|
||||
* Returns true if the ticking is currently running.
|
||||
*/
|
||||
bool isRunning();
|
||||
|
||||
/**
|
||||
* Called internally by the main loop. Takes all running tickings
|
||||
* and updates them.
|
||||
*/
|
||||
static void updateTickings();
|
||||
|
||||
inline static std::vector<Ticking*> runningTickings;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Executed every frame while the ticking lives.
|
||||
* Delta is the time difference in ms between the last frame
|
||||
* and the current one.
|
||||
* Must return false if the ticking is finished and should be
|
||||
* removed from the list of active tickings.
|
||||
* The end callback will automatically be called then.
|
||||
*/
|
||||
virtual bool onUpdate(Time delta) = 0;
|
||||
|
||||
/**
|
||||
* Called when the ticking becomes active.
|
||||
*/
|
||||
virtual void onStart() {};
|
||||
|
||||
/**
|
||||
* Called when the ticking is stopped, either by the user
|
||||
* or because it finished.
|
||||
*/
|
||||
virtual void onStop() {};
|
||||
|
||||
private:
|
||||
void stop(bool finished);
|
||||
|
||||
bool running = false;
|
||||
|
||||
TickingEndCallback endCallback = [](bool finished) {};
|
||||
TickingTickCallback tickCallback = [] {};
|
||||
};
|
||||
|
||||
// Represents a "finite" ticking that runs for a known amount of time
|
||||
// and can be seek / reset / rewound.
|
||||
class FiniteTicking : public Ticking
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Rewinds the ticking to go back to the beginning
|
||||
* without losing its state (as opposed to reset() that clears
|
||||
* everything in the ticking).
|
||||
* Does not start or stop it.
|
||||
*/
|
||||
void rewind();
|
||||
|
||||
/**
|
||||
* Stops and resets the ticking, clearing its state
|
||||
* in the process (as opposed to rewind() that just restarts
|
||||
* the ticking from the beginning without losing the state).
|
||||
*/
|
||||
void reset();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Called when the ticking gets rewound.
|
||||
*/
|
||||
virtual void onRewind() {};
|
||||
|
||||
/**
|
||||
* Called when the ticking gets reset.
|
||||
*/
|
||||
virtual void onReset() {};
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/time.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// A Timer allows to run a callback once after a given period of time, in ms
|
||||
// Add the callback with setEndCallback(), set the duration with setDuration() then start the timer
|
||||
class Timer : public FiniteTicking
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Starts the timer directly with a given duration, in ms.
|
||||
*/
|
||||
void start(Time duration);
|
||||
|
||||
/**
|
||||
* Starts the timer with the already set duration.
|
||||
*/
|
||||
void start();
|
||||
|
||||
/**
|
||||
* Sets the duration of the timer, in ms.
|
||||
* Does not stop or reset it.
|
||||
*/
|
||||
void setDuration(Time duration);
|
||||
|
||||
void onStart() override;
|
||||
bool onUpdate(Time delta) override;
|
||||
void onReset() override;
|
||||
void onRewind() override;
|
||||
|
||||
protected:
|
||||
Time duration = 0;
|
||||
Time progress = 0;
|
||||
};
|
||||
|
||||
// A RepeatingTimer allows to run a callback repeatedly at a given time interval, in ms
|
||||
// Add the callback with setCallback(), set the period with setPeriod() then start the timer
|
||||
class RepeatingTimer : public Ticking
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Starts the timer directly with a given period, in ms.
|
||||
*/
|
||||
void start(Time period);
|
||||
|
||||
/**
|
||||
* Starts the timer with the already set period.
|
||||
*/
|
||||
void start();
|
||||
|
||||
/**
|
||||
* Sets the period of the timer, in ms.
|
||||
* Does not stop or reset it.
|
||||
*/
|
||||
void setPeriod(Time period);
|
||||
|
||||
/**
|
||||
* Sets the callback of the timer.
|
||||
* Tick callback is still executed every tick.
|
||||
* End callback is executed when the timer is stopped.
|
||||
*/
|
||||
void setCallback(TickingGenericCallback callback);
|
||||
|
||||
void onStart() override;
|
||||
bool onUpdate(Time delta) override;
|
||||
|
||||
protected:
|
||||
Time period = 0;
|
||||
Time progress = 0;
|
||||
|
||||
TickingGenericCallback callback = [] {};
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/logger.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
/**
|
||||
* Prints the given error message message and throws a std::logic_error.
|
||||
*/
|
||||
[[noreturn]] void fatal(std::string message);
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <nanovg.h>
|
||||
|
||||
// A VideoContext is responsible for providing a nanovg context for the app
|
||||
// (so by extension it manages all the graphics state as well as the window / context).
|
||||
// The VideoContext implementation must also provide the nanovg implementation. As such, there
|
||||
// can only be one VideoContext linked at any time in the binary.
|
||||
// Context creation and teardown can be done in the constructor and destructor.
|
||||
class VideoContext
|
||||
{
|
||||
public:
|
||||
virtual ~VideoContext() {};
|
||||
|
||||
/**
|
||||
* Called at the beginning of every frame to clear the window
|
||||
*/
|
||||
virtual void clear(NVGcolor color) = 0;
|
||||
|
||||
/**
|
||||
* Called at the beginning of every frame to begin it.
|
||||
*/
|
||||
virtual void beginFrame() = 0;
|
||||
|
||||
/**
|
||||
* Called at the end of every frame to end it (swap buffers...).
|
||||
*/
|
||||
virtual void endFrame() = 0;
|
||||
|
||||
/**
|
||||
* Can be called by the application to reset the graphics
|
||||
* state, in case there is a need to use the graphics API
|
||||
* directly (for instance direct OpenGL calls).
|
||||
*/
|
||||
virtual void resetState() = 0;
|
||||
|
||||
virtual NVGcontext* getNVGContext() = 0;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
3274
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/glad/glad.h
vendored
Normal file
3274
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/glad/glad.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
39
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/libretro-common/boolean.h
vendored
Normal file
39
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/libretro-common/boolean.h
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (boolean.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __LIBRETRO_SDK_BOOLEAN_H
|
||||
#define __LIBRETRO_SDK_BOOLEAN_H
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1800 && !defined(SN_TARGET_PS3)
|
||||
/* Hack applied for MSVC when compiling in C89 mode as it isn't C99 compliant. */
|
||||
#define bool unsigned char
|
||||
#define true 1
|
||||
#define false 0
|
||||
#else
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (strl.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __LIBRETRO_SDK_COMPAT_STRL_H
|
||||
#define __LIBRETRO_SDK_COMPAT_STRL_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H)
|
||||
#include "../../../config.h"
|
||||
#endif
|
||||
|
||||
#include <libretro-common/retro_common_api.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
#ifdef __MACH__
|
||||
#ifndef HAVE_STRL
|
||||
#define HAVE_STRL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRL
|
||||
/* Avoid possible naming collisions during link since
|
||||
* we prefer to use the actual name. */
|
||||
#define strlcpy(dst, src, size) strlcpy_retro__(dst, src, size)
|
||||
|
||||
#define strlcat(dst, src, size) strlcat_retro__(dst, src, size)
|
||||
|
||||
size_t strlcpy(char *dest, const char *source, size_t size);
|
||||
size_t strlcat(char *dest, const char *source, size_t size);
|
||||
|
||||
#endif
|
||||
|
||||
char *strldup(const char *s, size_t n);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,67 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (utf.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _LIBRETRO_ENCODINGS_UTF_H
|
||||
#define _LIBRETRO_ENCODINGS_UTF_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <libretro-common/boolean.h>
|
||||
|
||||
#include <libretro-common/retro_common_api.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
enum CodePage
|
||||
{
|
||||
CODEPAGE_LOCAL = 0, /* CP_ACP */
|
||||
CODEPAGE_UTF8 = 65001 /* CP_UTF8 */
|
||||
};
|
||||
|
||||
size_t utf8_conv_utf32(uint32_t *out, size_t out_chars,
|
||||
const char *in, size_t in_size);
|
||||
|
||||
bool utf16_conv_utf8(uint8_t *out, size_t *out_chars,
|
||||
const uint16_t *in, size_t in_size);
|
||||
|
||||
size_t utf8len(const char *string);
|
||||
|
||||
size_t utf8cpy(char *d, size_t d_len, const char *s, size_t chars);
|
||||
|
||||
const char *utf8skip(const char *str, size_t chars);
|
||||
|
||||
uint32_t utf8_walk(const char **string);
|
||||
|
||||
bool utf16_to_char_string(const uint16_t *in, char *s, size_t len);
|
||||
|
||||
char* utf8_to_local_string_alloc(const char *str);
|
||||
|
||||
char* local_to_utf8_string_alloc(const char *str);
|
||||
|
||||
wchar_t* utf8_to_utf16_string_alloc(const char *str);
|
||||
|
||||
char* utf16_to_utf8_string_alloc(const wchar_t *str);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,75 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (features_cpu.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _LIBRETRO_SDK_CPU_INFO_H
|
||||
#define _LIBRETRO_SDK_CPU_INFO_H
|
||||
|
||||
#include <libretro-common/retro_common_api.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <libretro-common/libretro.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* cpu_features_get_perf_counter:
|
||||
*
|
||||
* Gets performance counter.
|
||||
*
|
||||
* Returns: performance counter.
|
||||
**/
|
||||
retro_perf_tick_t cpu_features_get_perf_counter(void);
|
||||
|
||||
/**
|
||||
* cpu_features_get_time_usec:
|
||||
*
|
||||
* Gets time in microseconds, from an undefined epoch.
|
||||
* The epoch may change between computers or across reboots.
|
||||
*
|
||||
* Returns: time in microseconds
|
||||
**/
|
||||
retro_time_t cpu_features_get_time_usec(void);
|
||||
|
||||
/**
|
||||
* cpu_features_get:
|
||||
*
|
||||
* Gets CPU features.
|
||||
*
|
||||
* Returns: bitmask of all CPU features available.
|
||||
**/
|
||||
uint64_t cpu_features_get(void);
|
||||
|
||||
/**
|
||||
* cpu_features_get_core_amount:
|
||||
*
|
||||
* Gets the amount of available CPU cores.
|
||||
*
|
||||
* Returns: amount of CPU cores available.
|
||||
**/
|
||||
unsigned cpu_features_get_core_amount(void);
|
||||
|
||||
void cpu_features_get_model_name(char *name, int len);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
2537
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/libretro-common/libretro.h
vendored
Normal file
2537
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/libretro-common/libretro.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (retro_assert.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __RETRO_ASSERT_H
|
||||
#define __RETRO_ASSERT_H
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include <stdio.h>
|
||||
#define retro_assert(cond) do { \
|
||||
if (!(cond)) { printf("Assertion failed at %s:%d.\n", __FILE__, __LINE__); abort(); } \
|
||||
} while(0)
|
||||
#else
|
||||
#define retro_assert(cond) assert(cond)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,117 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (retro_common_api.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _LIBRETRO_COMMON_RETRO_COMMON_API_H
|
||||
#define _LIBRETRO_COMMON_RETRO_COMMON_API_H
|
||||
|
||||
/*
|
||||
This file is designed to normalize the libretro-common compiling environment
|
||||
for public API headers. This should be leaner than a normal compiling environment,
|
||||
since it gets #included into other project's sources.
|
||||
*/
|
||||
|
||||
/* ------------------------------------ */
|
||||
|
||||
/*
|
||||
Ordinarily we want to put #ifdef __cplusplus extern "C" in C library
|
||||
headers to enable them to get used by c++ sources.
|
||||
However, we want to support building this library as C++ as well, so a
|
||||
special technique is called for.
|
||||
*/
|
||||
|
||||
#define RETRO_BEGIN_DECLS
|
||||
#define RETRO_END_DECLS
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#ifdef CXX_BUILD
|
||||
/* build wants everything to be built as c++, so no extern "C" */
|
||||
#else
|
||||
#undef RETRO_BEGIN_DECLS
|
||||
#undef RETRO_END_DECLS
|
||||
#define RETRO_BEGIN_DECLS extern "C" {
|
||||
#define RETRO_END_DECLS }
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
/* header is included by a C source file, so no extern "C" */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
IMO, this non-standard ssize_t should not be used.
|
||||
However, it's a good example of how to handle something like this.
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#ifndef HAVE_SSIZE_T
|
||||
#define HAVE_SSIZE_T
|
||||
#if defined(_WIN64)
|
||||
typedef __int64 ssize_t;
|
||||
#elif defined(_WIN32)
|
||||
typedef int ssize_t;
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(__MACH__)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER >= 1800
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
#ifndef PRId64
|
||||
#define PRId64 "I64d"
|
||||
#define PRIu64 "I64u"
|
||||
#define PRIuPTR "Iu"
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
/* C++11 says this one isn't needed, but apparently (some versions of) mingw require it anyways */
|
||||
/* https://stackoverflow.com/questions/8132399/how-to-printf-uint64-t-fails-with-spurious-trailing-in-format */
|
||||
/* https://github.com/libretro/RetroArch/issues/6009 */
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#ifndef PRId64
|
||||
#error "inttypes.h is being screwy"
|
||||
#endif
|
||||
#define STRING_REP_INT64 "%" PRId64
|
||||
#define STRING_REP_UINT64 "%" PRIu64
|
||||
#define STRING_REP_USIZE "%" PRIuPTR
|
||||
|
||||
/*
|
||||
I would like to see retro_inline.h moved in here; possibly boolean too.
|
||||
|
||||
rationale: these are used in public APIs, and it is easier to find problems
|
||||
and write code that works the first time portably when theyre included uniformly
|
||||
than to do the analysis from scratch each time you think you need it, for each feature.
|
||||
|
||||
Moreover it helps force you to make hard decisions: if you EVER bring in boolean.h,
|
||||
then you should pay the price everywhere, so you can see how much grief it will cause.
|
||||
|
||||
Of course, another school of thought is that you should do as little damage as possible
|
||||
in as few places as possible...
|
||||
*/
|
||||
|
||||
/* _LIBRETRO_COMMON_RETRO_COMMON_API_H */
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (retro_inline.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __LIBRETRO_SDK_INLINE_H
|
||||
#define __LIBRETRO_SDK_INLINE_H
|
||||
|
||||
#ifndef INLINE
|
||||
|
||||
#if defined(_WIN32) || defined(__INTEL_COMPILER)
|
||||
#define INLINE __inline
|
||||
#elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
|
||||
#define INLINE inline
|
||||
#elif defined(__GNUC__)
|
||||
#define INLINE __inline__
|
||||
#else
|
||||
#define INLINE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,94 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (retro_math.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _LIBRETRO_COMMON_MATH_H
|
||||
#define _LIBRETRO_COMMON_MATH_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#elif defined(_WIN32) && defined(_XBOX)
|
||||
#include <Xtl.h>
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <libretro-common/compat/msvc.h>
|
||||
#endif
|
||||
#include <libretro-common/retro_inline.h>
|
||||
|
||||
#ifndef M_PI
|
||||
#if !defined(USE_MATH_DEFINES)
|
||||
#define M_PI 3.14159265358979323846264338327
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* next_pow2:
|
||||
* @v : initial value
|
||||
*
|
||||
* Get next power of 2 value based on initial value.
|
||||
*
|
||||
* Returns: next power of 2 value (derived from @v).
|
||||
**/
|
||||
static INLINE uint32_t next_pow2(uint32_t v)
|
||||
{
|
||||
v--;
|
||||
v |= v >> 1;
|
||||
v |= v >> 2;
|
||||
v |= v >> 4;
|
||||
v |= v >> 8;
|
||||
v |= v >> 16;
|
||||
v++;
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
* prev_pow2:
|
||||
* @v : initial value
|
||||
*
|
||||
* Get previous power of 2 value based on initial value.
|
||||
*
|
||||
* Returns: previous power of 2 value (derived from @v).
|
||||
**/
|
||||
static INLINE uint32_t prev_pow2(uint32_t v)
|
||||
{
|
||||
v |= v >> 1;
|
||||
v |= v >> 2;
|
||||
v |= v >> 4;
|
||||
v |= v >> 8;
|
||||
v |= v >> 16;
|
||||
return v - (v >> 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,182 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (retro_miscellaneous.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __RARCH_MISCELLANEOUS_H
|
||||
#define __RARCH_MISCELLANEOUS_H
|
||||
|
||||
#define RARCH_MAX_SUBSYSTEMS 10
|
||||
#define RARCH_MAX_SUBSYSTEM_ROMS 10
|
||||
|
||||
#include <stdint.h>
|
||||
#include <libretro-common/boolean.h>
|
||||
#include <libretro-common/retro_inline.h>
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#elif defined(_WIN32) && defined(_XBOX)
|
||||
#include <Xtl.h>
|
||||
#endif
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#include <sys/fs_external.h>
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <libretro-common/compat/msvc.h>
|
||||
#endif
|
||||
|
||||
static INLINE void bits_or_bits(uint32_t *a, uint32_t *b, uint32_t count)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < count;i++)
|
||||
a[i] |= b[i];
|
||||
}
|
||||
|
||||
static INLINE void bits_clear_bits(uint32_t *a, uint32_t *b, uint32_t count)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < count;i++)
|
||||
a[i] &= ~b[i];
|
||||
}
|
||||
|
||||
static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (ptr[i] != 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef PATH_MAX_LENGTH
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#define PATH_MAX_LENGTH CELL_FS_MAX_FS_PATH_LENGTH
|
||||
#elif defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(ORBIS)
|
||||
#define PATH_MAX_LENGTH 512
|
||||
#else
|
||||
#define PATH_MAX_LENGTH 4096
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
#define BITS_GET_ELEM(a, i) ((a).data[i])
|
||||
#define BITS_GET_ELEM_PTR(a, i) ((a)->data[i])
|
||||
|
||||
#define BIT_SET(a, bit) ((a)[(bit) >> 3] |= (1 << ((bit) & 7)))
|
||||
#define BIT_CLEAR(a, bit) ((a)[(bit) >> 3] &= ~(1 << ((bit) & 7)))
|
||||
#define BIT_GET(a, bit) (((a)[(bit) >> 3] >> ((bit) & 7)) & 1)
|
||||
|
||||
#define BIT16_SET(a, bit) ((a) |= (1 << ((bit) & 15)))
|
||||
#define BIT16_CLEAR(a, bit) ((a) &= ~(1 << ((bit) & 15)))
|
||||
#define BIT16_GET(a, bit) (((a) >> ((bit) & 15)) & 1)
|
||||
#define BIT16_CLEAR_ALL(a) ((a) = 0)
|
||||
|
||||
#define BIT32_SET(a, bit) ((a) |= (1 << ((bit) & 31)))
|
||||
#define BIT32_CLEAR(a, bit) ((a) &= ~(1 << ((bit) & 31)))
|
||||
#define BIT32_GET(a, bit) (((a) >> ((bit) & 31)) & 1)
|
||||
#define BIT32_CLEAR_ALL(a) ((a) = 0)
|
||||
|
||||
#define BIT64_SET(a, bit) ((a) |= (UINT64_C(1) << ((bit) & 63)))
|
||||
#define BIT64_CLEAR(a, bit) ((a) &= ~(UINT64_C(1) << ((bit) & 63)))
|
||||
#define BIT64_GET(a, bit) (((a) >> ((bit) & 63)) & 1)
|
||||
#define BIT64_CLEAR_ALL(a) ((a) = 0)
|
||||
|
||||
#define BIT128_SET(a, bit) ((a).data[(bit) >> 5] |= (1 << ((bit) & 31)))
|
||||
#define BIT128_CLEAR(a, bit) ((a).data[(bit) >> 5] &= ~(1 << ((bit) & 31)))
|
||||
#define BIT128_GET(a, bit) (((a).data[(bit) >> 5] >> ((bit) & 31)) & 1)
|
||||
#define BIT128_CLEAR_ALL(a) memset(&(a), 0, sizeof(a))
|
||||
|
||||
#define BIT128_SET_PTR(a, bit) BIT128_SET(*a, bit)
|
||||
#define BIT128_CLEAR_PTR(a, bit) BIT128_CLEAR(*a, bit)
|
||||
#define BIT128_GET_PTR(a, bit) BIT128_GET(*a, bit)
|
||||
#define BIT128_CLEAR_ALL_PTR(a) BIT128_CLEAR_ALL(*a)
|
||||
|
||||
#define BIT256_SET(a, bit) BIT128_SET(a, bit)
|
||||
#define BIT256_CLEAR(a, bit) BIT128_CLEAR(a, bit)
|
||||
#define BIT256_GET(a, bit) BIT128_GET(a, bit)
|
||||
#define BIT256_CLEAR_ALL(a) BIT128_CLEAR_ALL(a)
|
||||
|
||||
#define BIT256_SET_PTR(a, bit) BIT256_SET(*a, bit)
|
||||
#define BIT256_CLEAR_PTR(a, bit) BIT256_CLEAR(*a, bit)
|
||||
#define BIT256_GET_PTR(a, bit) BIT256_GET(*a, bit)
|
||||
#define BIT256_CLEAR_ALL_PTR(a) BIT256_CLEAR_ALL(*a)
|
||||
|
||||
#define BITS_COPY16_PTR(a,bits) \
|
||||
{ \
|
||||
BIT128_CLEAR_ALL_PTR(a); \
|
||||
BITS_GET_ELEM_PTR(a, 0) = (bits) & 0xffff; \
|
||||
}
|
||||
|
||||
#define BITS_COPY32_PTR(a,bits) \
|
||||
{ \
|
||||
BIT128_CLEAR_ALL_PTR(a); \
|
||||
BITS_GET_ELEM_PTR(a, 0) = (bits); \
|
||||
}
|
||||
|
||||
/* Helper macros and struct to keep track of many booleans. */
|
||||
/* This struct has 256 bits. */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t data[8];
|
||||
} retro_bits_t;
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef _WIN64
|
||||
# define PRI_SIZET PRIu64
|
||||
# else
|
||||
# if _MSC_VER == 1800
|
||||
# define PRI_SIZET PRIu32
|
||||
# else
|
||||
# define PRI_SIZET "u"
|
||||
# endif
|
||||
# endif
|
||||
#elif PS2
|
||||
# define PRI_SIZET "u"
|
||||
#else
|
||||
# if (SIZE_MAX == 0xFFFF)
|
||||
# define PRI_SIZET "hu"
|
||||
# elif (SIZE_MAX == 0xFFFFFFFF)
|
||||
# define PRI_SIZET "u"
|
||||
# elif (SIZE_MAX == 0xFFFFFFFFFFFFFFFF)
|
||||
# define PRI_SIZET "lu"
|
||||
# else
|
||||
# error PRI_SIZET: unknown SIZE_MAX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
116
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/libretro-common/retro_timers.h
vendored
Normal file
116
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/libretro-common/retro_timers.h
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (retro_timers.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __LIBRETRO_COMMON_TIMERS_H
|
||||
#define __LIBRETRO_COMMON_TIMERS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
||||
#include <sys/timer.h>
|
||||
#elif defined(XENON)
|
||||
#include <time/time.h>
|
||||
#elif defined(GEKKO) || defined(__PSL1GHT__) || defined(__QNX__)
|
||||
#include <unistd.h>
|
||||
#elif defined(WIIU)
|
||||
#include <wiiu/os/thread.h>
|
||||
#elif defined(PSP)
|
||||
#include <pspthreadman.h>
|
||||
#elif defined(VITA)
|
||||
#include <psp2/kernel/threadmgr.h>
|
||||
#elif defined(PS2)
|
||||
#include <SDL/SDL_timer.h>
|
||||
#elif defined(_3DS)
|
||||
#include <3ds.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#elif defined(_WIN32) && defined(_XBOX)
|
||||
#include <Xtl.h>
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <libretro-common/compat/msvc.h>
|
||||
#endif
|
||||
#include <libretro-common/retro_inline.h>
|
||||
|
||||
#ifdef DJGPP
|
||||
#define timespec timeval
|
||||
#define tv_nsec tv_usec
|
||||
#include <unistd.h>
|
||||
|
||||
extern int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
|
||||
|
||||
static int nanosleepDOS(const struct timespec *rqtp, struct timespec *rmtp)
|
||||
{
|
||||
usleep(1000000 * rqtp->tv_sec + rqtp->tv_nsec / 1000);
|
||||
|
||||
if (rmtp)
|
||||
rmtp->tv_sec = rmtp->tv_nsec=0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define nanosleep nanosleepDOS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* retro_sleep:
|
||||
* @msec : amount in milliseconds to sleep
|
||||
*
|
||||
* Sleeps for a specified amount of milliseconds (@msec).
|
||||
**/
|
||||
static INLINE void retro_sleep(unsigned msec)
|
||||
{
|
||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
||||
sys_timer_usleep(1000 * msec);
|
||||
#elif defined(PSP) || defined(VITA)
|
||||
sceKernelDelayThread(1000 * msec);
|
||||
#elif defined(PS2)
|
||||
SDL_Delay(msec);
|
||||
#elif defined(_3DS)
|
||||
svcSleepThread(1000000 * (s64)msec);
|
||||
#elif defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
SleepEx(msec, FALSE);
|
||||
#elif defined(_WIN32)
|
||||
Sleep(msec);
|
||||
#elif defined(XENON)
|
||||
udelay(1000 * msec);
|
||||
#elif defined(GEKKO) || defined(__PSL1GHT__) || defined(__QNX__)
|
||||
usleep(1000 * msec);
|
||||
#elif defined(WIIU)
|
||||
OSSleepTicks(ms_to_ticks(msec));
|
||||
#else
|
||||
struct timespec tv = {0};
|
||||
tv.tv_sec = msec / 1000;
|
||||
tv.tv_nsec = (msec % 1000) * 1000000;
|
||||
nanosleep(&tv, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,111 @@
|
||||
/* Copyright (C) 2010-2018 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (file_stream.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __LIBRETRO_SDK_FILE_STREAM_H
|
||||
#define __LIBRETRO_SDK_FILE_STREAM_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <libretro-common/libretro.h>
|
||||
#include <libretro-common/retro_common_api.h>
|
||||
#include <libretro-common/retro_inline.h>
|
||||
#include <libretro-common/boolean.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define FILESTREAM_REQUIRED_VFS_VERSION 2
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
typedef struct RFILE RFILE;
|
||||
|
||||
#define FILESTREAM_REQUIRED_VFS_VERSION 2
|
||||
|
||||
void filestream_vfs_init(const struct retro_vfs_interface_info* vfs_info);
|
||||
|
||||
int64_t filestream_get_size(RFILE *stream);
|
||||
|
||||
int64_t filestream_truncate(RFILE *stream, int64_t length);
|
||||
|
||||
/**
|
||||
* filestream_open:
|
||||
* @path : path to file
|
||||
* @mode : file mode to use when opening (read/write)
|
||||
* @bufsize : optional buffer size (-1 or 0 to use default)
|
||||
*
|
||||
* Opens a file for reading or writing, depending on the requested mode.
|
||||
* Returns a pointer to an RFILE if opened successfully, otherwise NULL.
|
||||
**/
|
||||
RFILE *filestream_open(const char *path, unsigned mode, unsigned hints);
|
||||
|
||||
int64_t filestream_seek(RFILE *stream, int64_t offset, int seek_position);
|
||||
|
||||
int64_t filestream_read(RFILE *stream, void *data, int64_t len);
|
||||
|
||||
int64_t filestream_write(RFILE *stream, const void *data, int64_t len);
|
||||
|
||||
int64_t filestream_tell(RFILE *stream);
|
||||
|
||||
void filestream_rewind(RFILE *stream);
|
||||
|
||||
int filestream_close(RFILE *stream);
|
||||
|
||||
int64_t filestream_read_file(const char *path, void **buf, int64_t *len);
|
||||
|
||||
char *filestream_gets(RFILE *stream, char *s, size_t len);
|
||||
|
||||
int filestream_getc(RFILE *stream);
|
||||
|
||||
int filestream_scanf(RFILE *stream, const char* format, ...);
|
||||
|
||||
int filestream_eof(RFILE *stream);
|
||||
|
||||
bool filestream_write_file(const char *path, const void *data, int64_t size);
|
||||
|
||||
int filestream_putc(RFILE *stream, int c);
|
||||
|
||||
int filestream_vprintf(RFILE *stream, const char* format, va_list args);
|
||||
|
||||
int filestream_printf(RFILE *stream, const char* format, ...);
|
||||
|
||||
int filestream_error(RFILE *stream);
|
||||
|
||||
int filestream_flush(RFILE *stream);
|
||||
|
||||
int filestream_delete(const char *path);
|
||||
|
||||
int filestream_rename(const char *old_path, const char *new_path);
|
||||
|
||||
const char *filestream_get_path(RFILE *stream);
|
||||
|
||||
bool filestream_exists(const char *path);
|
||||
|
||||
char *filestream_getline(RFILE *stream);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,134 @@
|
||||
/* Copyright (C) 2010-2019 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (stdstring.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __LIBRETRO_SDK_STDSTRING_H
|
||||
#define __LIBRETRO_SDK_STDSTRING_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <libretro-common/boolean.h>
|
||||
|
||||
#include <libretro-common/retro_common_api.h>
|
||||
#include <libretro-common/retro_inline.h>
|
||||
#include <libretro-common/compat/strl.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
static INLINE bool string_is_empty(const char *data)
|
||||
{
|
||||
return !data || (*data == '\0');
|
||||
}
|
||||
|
||||
static INLINE bool string_is_equal(const char *a, const char *b)
|
||||
{
|
||||
return (a && b) ? !strcmp(a, b) : false;
|
||||
}
|
||||
|
||||
#define STRLEN_CONST(x) ((sizeof((x))-1))
|
||||
|
||||
#define string_is_not_equal(a, b) !string_is_equal((a), (b))
|
||||
|
||||
#define string_add_pair_open(s, size) strlcat((s), " (", (size))
|
||||
#define string_add_pair_close(s, size) strlcat((s), ")", (size))
|
||||
#define string_add_bracket_open(s, size) strlcat((s), "{", (size))
|
||||
#define string_add_bracket_close(s, size) strlcat((s), "}", (size))
|
||||
#define string_add_single_quote(s, size) strlcat((s), "'", (size))
|
||||
#define string_add_quote(s, size) strlcat((s), "\"", (size))
|
||||
#define string_add_colon(s, size) strlcat((s), ":", (size))
|
||||
#define string_add_glob_open(s, size) strlcat((s), "glob('*", (size))
|
||||
#define string_add_glob_close(s, size) strlcat((s), "*')", (size))
|
||||
|
||||
#define string_is_not_equal_fast(a, b, size) (memcmp(a, b, size) != 0)
|
||||
#define string_is_equal_fast(a, b, size) (memcmp(a, b, size) == 0)
|
||||
|
||||
static INLINE void string_add_between_pairs(char *s, const char *str,
|
||||
size_t size)
|
||||
{
|
||||
string_add_pair_open(s, size);
|
||||
strlcat(s, str, size);
|
||||
string_add_pair_close(s, size);
|
||||
}
|
||||
|
||||
static INLINE bool string_is_equal_case_insensitive(const char *a,
|
||||
const char *b)
|
||||
{
|
||||
int result = 0;
|
||||
const unsigned char *p1 = (const unsigned char*)a;
|
||||
const unsigned char *p2 = (const unsigned char*)b;
|
||||
|
||||
if (!a || !b)
|
||||
return false;
|
||||
if (p1 == p2)
|
||||
return true;
|
||||
|
||||
while ((result = tolower (*p1) - tolower (*p2++)) == 0)
|
||||
if (*p1++ == '\0')
|
||||
break;
|
||||
|
||||
return (result == 0);
|
||||
}
|
||||
|
||||
static INLINE bool string_is_equal_noncase(const char *a, const char *b)
|
||||
{
|
||||
int result = 0;
|
||||
const unsigned char *p1 = (const unsigned char*)a;
|
||||
const unsigned char *p2 = (const unsigned char*)b;
|
||||
|
||||
if (!a || !b)
|
||||
return false;
|
||||
if (p1 == p2)
|
||||
return false;
|
||||
|
||||
while ((result = tolower (*p1) - tolower (*p2++)) == 0)
|
||||
if (*p1++ == '\0')
|
||||
break;
|
||||
|
||||
return (result == 0);
|
||||
}
|
||||
|
||||
char *string_to_upper(char *s);
|
||||
|
||||
char *string_to_lower(char *s);
|
||||
|
||||
char *string_ucwords(char *s);
|
||||
|
||||
char *string_replace_substring(const char *in, const char *pattern,
|
||||
const char *by);
|
||||
|
||||
/* Remove leading whitespaces */
|
||||
char *string_trim_whitespace_left(char *const s);
|
||||
|
||||
/* Remove trailing whitespaces */
|
||||
char *string_trim_whitespace_right(char *const s);
|
||||
|
||||
/* Remove leading and trailing whitespaces */
|
||||
char *string_trim_whitespace(char *const s);
|
||||
|
||||
/* max_lines == 0 means no limit */
|
||||
char *word_wrap(char *buffer, const char *string,
|
||||
int line_width, bool unicode, unsigned max_lines);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
18
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/LICENSE.txt
vendored
Normal file
18
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/LICENSE.txt
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
Copyright (c) 2013 Mikko Mononen memon@inside.org
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
1768
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/fontstash.h
vendored
Normal file
1768
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/fontstash.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
685
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/nanovg.h
vendored
Normal file
685
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/nanovg.h
vendored
Normal file
@@ -0,0 +1,685 @@
|
||||
//
|
||||
// Copyright (c) 2013 Mikko Mononen memon@inside.org
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#ifndef NANOVG_H
|
||||
#define NANOVG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NVG_PI 3.14159265358979323846264338327f
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
|
||||
#endif
|
||||
|
||||
typedef struct NVGcontext NVGcontext;
|
||||
|
||||
struct NVGcolor {
|
||||
union {
|
||||
float rgba[4];
|
||||
struct {
|
||||
float r,g,b,a;
|
||||
};
|
||||
};
|
||||
};
|
||||
typedef struct NVGcolor NVGcolor;
|
||||
|
||||
struct NVGpaint {
|
||||
float xform[6];
|
||||
float extent[2];
|
||||
float radius;
|
||||
float feather;
|
||||
NVGcolor innerColor;
|
||||
NVGcolor outerColor;
|
||||
int image;
|
||||
};
|
||||
typedef struct NVGpaint NVGpaint;
|
||||
|
||||
enum NVGwinding {
|
||||
NVG_CCW = 1, // Winding for solid shapes
|
||||
NVG_CW = 2, // Winding for holes
|
||||
};
|
||||
|
||||
enum NVGsolidity {
|
||||
NVG_SOLID = 1, // CCW
|
||||
NVG_HOLE = 2, // CW
|
||||
};
|
||||
|
||||
enum NVGlineCap {
|
||||
NVG_BUTT,
|
||||
NVG_ROUND,
|
||||
NVG_SQUARE,
|
||||
NVG_BEVEL,
|
||||
NVG_MITER,
|
||||
};
|
||||
|
||||
enum NVGalign {
|
||||
// Horizontal align
|
||||
NVG_ALIGN_LEFT = 1<<0, // Default, align text horizontally to left.
|
||||
NVG_ALIGN_CENTER = 1<<1, // Align text horizontally to center.
|
||||
NVG_ALIGN_RIGHT = 1<<2, // Align text horizontally to right.
|
||||
// Vertical align
|
||||
NVG_ALIGN_TOP = 1<<3, // Align text vertically to top.
|
||||
NVG_ALIGN_MIDDLE = 1<<4, // Align text vertically to middle.
|
||||
NVG_ALIGN_BOTTOM = 1<<5, // Align text vertically to bottom.
|
||||
NVG_ALIGN_BASELINE = 1<<6, // Default, align text vertically to baseline.
|
||||
};
|
||||
|
||||
enum NVGblendFactor {
|
||||
NVG_ZERO = 1<<0,
|
||||
NVG_ONE = 1<<1,
|
||||
NVG_SRC_COLOR = 1<<2,
|
||||
NVG_ONE_MINUS_SRC_COLOR = 1<<3,
|
||||
NVG_DST_COLOR = 1<<4,
|
||||
NVG_ONE_MINUS_DST_COLOR = 1<<5,
|
||||
NVG_SRC_ALPHA = 1<<6,
|
||||
NVG_ONE_MINUS_SRC_ALPHA = 1<<7,
|
||||
NVG_DST_ALPHA = 1<<8,
|
||||
NVG_ONE_MINUS_DST_ALPHA = 1<<9,
|
||||
NVG_SRC_ALPHA_SATURATE = 1<<10,
|
||||
};
|
||||
|
||||
enum NVGcompositeOperation {
|
||||
NVG_SOURCE_OVER,
|
||||
NVG_SOURCE_IN,
|
||||
NVG_SOURCE_OUT,
|
||||
NVG_ATOP,
|
||||
NVG_DESTINATION_OVER,
|
||||
NVG_DESTINATION_IN,
|
||||
NVG_DESTINATION_OUT,
|
||||
NVG_DESTINATION_ATOP,
|
||||
NVG_LIGHTER,
|
||||
NVG_COPY,
|
||||
NVG_XOR,
|
||||
};
|
||||
|
||||
struct NVGcompositeOperationState {
|
||||
int srcRGB;
|
||||
int dstRGB;
|
||||
int srcAlpha;
|
||||
int dstAlpha;
|
||||
};
|
||||
typedef struct NVGcompositeOperationState NVGcompositeOperationState;
|
||||
|
||||
struct NVGglyphPosition {
|
||||
const char* str; // Position of the glyph in the input string.
|
||||
float x; // The x-coordinate of the logical glyph position.
|
||||
float minx, maxx; // The bounds of the glyph shape.
|
||||
};
|
||||
typedef struct NVGglyphPosition NVGglyphPosition;
|
||||
|
||||
struct NVGtextRow {
|
||||
const char* start; // Pointer to the input text where the row starts.
|
||||
const char* end; // Pointer to the input text where the row ends (one past the last character).
|
||||
const char* next; // Pointer to the beginning of the next row.
|
||||
float width; // Logical width of the row.
|
||||
float minx, maxx; // Actual bounds of the row. Logical with and bounds can differ because of kerning and some parts over extending.
|
||||
};
|
||||
typedef struct NVGtextRow NVGtextRow;
|
||||
|
||||
enum NVGimageFlags {
|
||||
NVG_IMAGE_GENERATE_MIPMAPS = 1<<0, // Generate mipmaps during creation of the image.
|
||||
NVG_IMAGE_REPEATX = 1<<1, // Repeat image in X direction.
|
||||
NVG_IMAGE_REPEATY = 1<<2, // Repeat image in Y direction.
|
||||
NVG_IMAGE_FLIPY = 1<<3, // Flips (inverses) image in Y direction when rendered.
|
||||
NVG_IMAGE_PREMULTIPLIED = 1<<4, // Image data has premultiplied alpha.
|
||||
NVG_IMAGE_NEAREST = 1<<5, // Image interpolation is Nearest instead Linear
|
||||
};
|
||||
|
||||
// Begin drawing a new frame
|
||||
// Calls to nanovg drawing API should be wrapped in nvgBeginFrame() & nvgEndFrame()
|
||||
// nvgBeginFrame() defines the size of the window to render to in relation currently
|
||||
// set viewport (i.e. glViewport on GL backends). Device pixel ration allows to
|
||||
// control the rendering on Hi-DPI devices.
|
||||
// For example, GLFW returns two dimension for an opened window: window size and
|
||||
// frame buffer size. In that case you would set windowWidth/Height to the window size
|
||||
// devicePixelRatio to: frameBufferWidth / windowWidth.
|
||||
void nvgBeginFrame(NVGcontext* ctx, float windowWidth, float windowHeight, float devicePixelRatio);
|
||||
|
||||
// Cancels drawing the current frame.
|
||||
void nvgCancelFrame(NVGcontext* ctx);
|
||||
|
||||
// Ends drawing flushing remaining render state.
|
||||
void nvgEndFrame(NVGcontext* ctx);
|
||||
|
||||
//
|
||||
// Composite operation
|
||||
//
|
||||
// The composite operations in NanoVG are modeled after HTML Canvas API, and
|
||||
// the blend func is based on OpenGL (see corresponding manuals for more info).
|
||||
// The colors in the blending state have premultiplied alpha.
|
||||
|
||||
// Sets the composite operation. The op parameter should be one of NVGcompositeOperation.
|
||||
void nvgGlobalCompositeOperation(NVGcontext* ctx, int op);
|
||||
|
||||
// Sets the composite operation with custom pixel arithmetic. The parameters should be one of NVGblendFactor.
|
||||
void nvgGlobalCompositeBlendFunc(NVGcontext* ctx, int sfactor, int dfactor);
|
||||
|
||||
// Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately. The parameters should be one of NVGblendFactor.
|
||||
void nvgGlobalCompositeBlendFuncSeparate(NVGcontext* ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha);
|
||||
|
||||
//
|
||||
// Color utils
|
||||
//
|
||||
// Colors in NanoVG are stored as unsigned ints in ABGR format.
|
||||
|
||||
// Returns a color value from red, green, blue values. Alpha will be set to 255 (1.0f).
|
||||
NVGcolor nvgRGB(unsigned char r, unsigned char g, unsigned char b);
|
||||
|
||||
// Returns a color value from red, green, blue values. Alpha will be set to 1.0f.
|
||||
NVGcolor nvgRGBf(float r, float g, float b);
|
||||
|
||||
|
||||
// Returns a color value from red, green, blue and alpha values.
|
||||
NVGcolor nvgRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
|
||||
|
||||
// Returns a color value from red, green, blue and alpha values.
|
||||
NVGcolor nvgRGBAf(float r, float g, float b, float a);
|
||||
|
||||
|
||||
// Linearly interpolates from color c0 to c1, and returns resulting color value.
|
||||
NVGcolor nvgLerpRGBA(NVGcolor c0, NVGcolor c1, float u);
|
||||
|
||||
// Sets transparency of a color value.
|
||||
NVGcolor nvgTransRGBA(NVGcolor c0, unsigned char a);
|
||||
|
||||
// Sets transparency of a color value.
|
||||
NVGcolor nvgTransRGBAf(NVGcolor c0, float a);
|
||||
|
||||
// Returns color value specified by hue, saturation and lightness.
|
||||
// HSL values are all in range [0..1], alpha will be set to 255.
|
||||
NVGcolor nvgHSL(float h, float s, float l);
|
||||
|
||||
// Returns color value specified by hue, saturation and lightness and alpha.
|
||||
// HSL values are all in range [0..1], alpha in range [0..255]
|
||||
NVGcolor nvgHSLA(float h, float s, float l, unsigned char a);
|
||||
|
||||
//
|
||||
// State Handling
|
||||
//
|
||||
// NanoVG contains state which represents how paths will be rendered.
|
||||
// The state contains transform, fill and stroke styles, text and font styles,
|
||||
// and scissor clipping.
|
||||
|
||||
// Pushes and saves the current render state into a state stack.
|
||||
// A matching nvgRestore() must be used to restore the state.
|
||||
void nvgSave(NVGcontext* ctx);
|
||||
|
||||
// Pops and restores current render state.
|
||||
void nvgRestore(NVGcontext* ctx);
|
||||
|
||||
// Resets current render state to default values. Does not affect the render state stack.
|
||||
void nvgReset(NVGcontext* ctx);
|
||||
|
||||
//
|
||||
// Render styles
|
||||
//
|
||||
// Fill and stroke render style can be either a solid color or a paint which is a gradient or a pattern.
|
||||
// Solid color is simply defined as a color value, different kinds of paints can be created
|
||||
// using nvgLinearGradient(), nvgBoxGradient(), nvgRadialGradient() and nvgImagePattern().
|
||||
//
|
||||
// Current render style can be saved and restored using nvgSave() and nvgRestore().
|
||||
|
||||
// Sets whether to draw antialias for nvgStroke() and nvgFill(). It's enabled by default.
|
||||
void nvgShapeAntiAlias(NVGcontext* ctx, int enabled);
|
||||
|
||||
// Sets current stroke style to a solid color.
|
||||
void nvgStrokeColor(NVGcontext* ctx, NVGcolor color);
|
||||
|
||||
// Sets current stroke style to a paint, which can be a one of the gradients or a pattern.
|
||||
void nvgStrokePaint(NVGcontext* ctx, NVGpaint paint);
|
||||
|
||||
// Sets current fill style to a solid color.
|
||||
void nvgFillColor(NVGcontext* ctx, NVGcolor color);
|
||||
|
||||
// Sets current fill style to a paint, which can be a one of the gradients or a pattern.
|
||||
void nvgFillPaint(NVGcontext* ctx, NVGpaint paint);
|
||||
|
||||
// Sets the miter limit of the stroke style.
|
||||
// Miter limit controls when a sharp corner is beveled.
|
||||
void nvgMiterLimit(NVGcontext* ctx, float limit);
|
||||
|
||||
// Sets the stroke width of the stroke style.
|
||||
void nvgStrokeWidth(NVGcontext* ctx, float size);
|
||||
|
||||
// Sets how the end of the line (cap) is drawn,
|
||||
// Can be one of: NVG_BUTT (default), NVG_ROUND, NVG_SQUARE.
|
||||
void nvgLineCap(NVGcontext* ctx, int cap);
|
||||
|
||||
// Sets how sharp path corners are drawn.
|
||||
// Can be one of NVG_MITER (default), NVG_ROUND, NVG_BEVEL.
|
||||
void nvgLineJoin(NVGcontext* ctx, int join);
|
||||
|
||||
// Sets the transparency applied to all rendered shapes.
|
||||
// Already transparent paths will get proportionally more transparent as well.
|
||||
void nvgGlobalAlpha(NVGcontext* ctx, float alpha);
|
||||
|
||||
//
|
||||
// Transforms
|
||||
//
|
||||
// The paths, gradients, patterns and scissor region are transformed by an transformation
|
||||
// matrix at the time when they are passed to the API.
|
||||
// The current transformation matrix is a affine matrix:
|
||||
// [sx kx tx]
|
||||
// [ky sy ty]
|
||||
// [ 0 0 1]
|
||||
// Where: sx,sy define scaling, kx,ky skewing, and tx,ty translation.
|
||||
// The last row is assumed to be 0,0,1 and is not stored.
|
||||
//
|
||||
// Apart from nvgResetTransform(), each transformation function first creates
|
||||
// specific transformation matrix and pre-multiplies the current transformation by it.
|
||||
//
|
||||
// Current coordinate system (transformation) can be saved and restored using nvgSave() and nvgRestore().
|
||||
|
||||
// Resets current transform to a identity matrix.
|
||||
void nvgResetTransform(NVGcontext* ctx);
|
||||
|
||||
// Premultiplies current coordinate system by specified matrix.
|
||||
// The parameters are interpreted as matrix as follows:
|
||||
// [a c e]
|
||||
// [b d f]
|
||||
// [0 0 1]
|
||||
void nvgTransform(NVGcontext* ctx, float a, float b, float c, float d, float e, float f);
|
||||
|
||||
// Translates current coordinate system.
|
||||
void nvgTranslate(NVGcontext* ctx, float x, float y);
|
||||
|
||||
// Rotates current coordinate system. Angle is specified in radians.
|
||||
void nvgRotate(NVGcontext* ctx, float angle);
|
||||
|
||||
// Skews the current coordinate system along X axis. Angle is specified in radians.
|
||||
void nvgSkewX(NVGcontext* ctx, float angle);
|
||||
|
||||
// Skews the current coordinate system along Y axis. Angle is specified in radians.
|
||||
void nvgSkewY(NVGcontext* ctx, float angle);
|
||||
|
||||
// Scales the current coordinate system.
|
||||
void nvgScale(NVGcontext* ctx, float x, float y);
|
||||
|
||||
// Stores the top part (a-f) of the current transformation matrix in to the specified buffer.
|
||||
// [a c e]
|
||||
// [b d f]
|
||||
// [0 0 1]
|
||||
// There should be space for 6 floats in the return buffer for the values a-f.
|
||||
void nvgCurrentTransform(NVGcontext* ctx, float* xform);
|
||||
|
||||
|
||||
// The following functions can be used to make calculations on 2x3 transformation matrices.
|
||||
// A 2x3 matrix is represented as float[6].
|
||||
|
||||
// Sets the transform to identity matrix.
|
||||
void nvgTransformIdentity(float* dst);
|
||||
|
||||
// Sets the transform to translation matrix matrix.
|
||||
void nvgTransformTranslate(float* dst, float tx, float ty);
|
||||
|
||||
// Sets the transform to scale matrix.
|
||||
void nvgTransformScale(float* dst, float sx, float sy);
|
||||
|
||||
// Sets the transform to rotate matrix. Angle is specified in radians.
|
||||
void nvgTransformRotate(float* dst, float a);
|
||||
|
||||
// Sets the transform to skew-x matrix. Angle is specified in radians.
|
||||
void nvgTransformSkewX(float* dst, float a);
|
||||
|
||||
// Sets the transform to skew-y matrix. Angle is specified in radians.
|
||||
void nvgTransformSkewY(float* dst, float a);
|
||||
|
||||
// Sets the transform to the result of multiplication of two transforms, of A = A*B.
|
||||
void nvgTransformMultiply(float* dst, const float* src);
|
||||
|
||||
// Sets the transform to the result of multiplication of two transforms, of A = B*A.
|
||||
void nvgTransformPremultiply(float* dst, const float* src);
|
||||
|
||||
// Sets the destination to inverse of specified transform.
|
||||
// Returns 1 if the inverse could be calculated, else 0.
|
||||
int nvgTransformInverse(float* dst, const float* src);
|
||||
|
||||
// Transform a point by given transform.
|
||||
void nvgTransformPoint(float* dstx, float* dsty, const float* xform, float srcx, float srcy);
|
||||
|
||||
// Converts degrees to radians and vice versa.
|
||||
float nvgDegToRad(float deg);
|
||||
float nvgRadToDeg(float rad);
|
||||
|
||||
//
|
||||
// Images
|
||||
//
|
||||
// NanoVG allows you to load jpg, png, psd, tga, pic and gif files to be used for rendering.
|
||||
// In addition you can upload your own image. The image loading is provided by stb_image.
|
||||
// The parameter imageFlags is combination of flags defined in NVGimageFlags.
|
||||
|
||||
// Creates image by loading it from the disk from specified file name.
|
||||
// Returns handle to the image.
|
||||
int nvgCreateImage(NVGcontext* ctx, const char* filename, int imageFlags);
|
||||
|
||||
// Creates image by loading it from the specified chunk of memory.
|
||||
// Returns handle to the image.
|
||||
int nvgCreateImageMem(NVGcontext* ctx, int imageFlags, unsigned char* data, int ndata);
|
||||
|
||||
// Creates image from specified image data.
|
||||
// Returns handle to the image.
|
||||
int nvgCreateImageRGBA(NVGcontext* ctx, int w, int h, int imageFlags, const unsigned char* data);
|
||||
|
||||
// Updates image data specified by image handle.
|
||||
void nvgUpdateImage(NVGcontext* ctx, int image, const unsigned char* data);
|
||||
|
||||
// Returns the dimensions of a created image.
|
||||
void nvgImageSize(NVGcontext* ctx, int image, int* w, int* h);
|
||||
|
||||
// Deletes created image.
|
||||
void nvgDeleteImage(NVGcontext* ctx, int image);
|
||||
|
||||
//
|
||||
// Paints
|
||||
//
|
||||
// NanoVG supports four types of paints: linear gradient, box gradient, radial gradient and image pattern.
|
||||
// These can be used as paints for strokes and fills.
|
||||
|
||||
// Creates and returns a linear gradient. Parameters (sx,sy)-(ex,ey) specify the start and end coordinates
|
||||
// of the linear gradient, icol specifies the start color and ocol the end color.
|
||||
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
|
||||
NVGpaint nvgLinearGradient(NVGcontext* ctx, float sx, float sy, float ex, float ey,
|
||||
NVGcolor icol, NVGcolor ocol);
|
||||
|
||||
// Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering
|
||||
// drop shadows or highlights for boxes. Parameters (x,y) define the top-left corner of the rectangle,
|
||||
// (w,h) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry
|
||||
// the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient.
|
||||
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
|
||||
NVGpaint nvgBoxGradient(NVGcontext* ctx, float x, float y, float w, float h,
|
||||
float r, float f, NVGcolor icol, NVGcolor ocol);
|
||||
|
||||
// Creates and returns a radial gradient. Parameters (cx,cy) specify the center, inr and outr specify
|
||||
// the inner and outer radius of the gradient, icol specifies the start color and ocol the end color.
|
||||
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
|
||||
NVGpaint nvgRadialGradient(NVGcontext* ctx, float cx, float cy, float inr, float outr,
|
||||
NVGcolor icol, NVGcolor ocol);
|
||||
|
||||
// Creates and returns an image patter. Parameters (ox,oy) specify the left-top location of the image pattern,
|
||||
// (ex,ey) the size of one image, angle rotation around the top-left corner, image is handle to the image to render.
|
||||
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
|
||||
NVGpaint nvgImagePattern(NVGcontext* ctx, float ox, float oy, float ex, float ey,
|
||||
float angle, int image, float alpha);
|
||||
|
||||
//
|
||||
// Scissoring
|
||||
//
|
||||
// Scissoring allows you to clip the rendering into a rectangle. This is useful for various
|
||||
// user interface cases like rendering a text edit or a timeline.
|
||||
|
||||
// Sets the current scissor rectangle.
|
||||
// The scissor rectangle is transformed by the current transform.
|
||||
void nvgScissor(NVGcontext* ctx, float x, float y, float w, float h);
|
||||
|
||||
// Intersects current scissor rectangle with the specified rectangle.
|
||||
// The scissor rectangle is transformed by the current transform.
|
||||
// Note: in case the rotation of previous scissor rect differs from
|
||||
// the current one, the intersection will be done between the specified
|
||||
// rectangle and the previous scissor rectangle transformed in the current
|
||||
// transform space. The resulting shape is always rectangle.
|
||||
void nvgIntersectScissor(NVGcontext* ctx, float x, float y, float w, float h);
|
||||
|
||||
// Reset and disables scissoring.
|
||||
void nvgResetScissor(NVGcontext* ctx);
|
||||
|
||||
//
|
||||
// Paths
|
||||
//
|
||||
// Drawing a new shape starts with nvgBeginPath(), it clears all the currently defined paths.
|
||||
// Then you define one or more paths and sub-paths which describe the shape. The are functions
|
||||
// to draw common shapes like rectangles and circles, and lower level step-by-step functions,
|
||||
// which allow to define a path curve by curve.
|
||||
//
|
||||
// NanoVG uses even-odd fill rule to draw the shapes. Solid shapes should have counter clockwise
|
||||
// winding and holes should have counter clockwise order. To specify winding of a path you can
|
||||
// call nvgPathWinding(). This is useful especially for the common shapes, which are drawn CCW.
|
||||
//
|
||||
// Finally you can fill the path using current fill style by calling nvgFill(), and stroke it
|
||||
// with current stroke style by calling nvgStroke().
|
||||
//
|
||||
// The curve segments and sub-paths are transformed by the current transform.
|
||||
|
||||
// Clears the current path and sub-paths.
|
||||
void nvgBeginPath(NVGcontext* ctx);
|
||||
|
||||
// Starts new sub-path with specified point as first point.
|
||||
void nvgMoveTo(NVGcontext* ctx, float x, float y);
|
||||
|
||||
// Adds line segment from the last point in the path to the specified point.
|
||||
void nvgLineTo(NVGcontext* ctx, float x, float y);
|
||||
|
||||
// Adds cubic bezier segment from last point in the path via two control points to the specified point.
|
||||
void nvgBezierTo(NVGcontext* ctx, float c1x, float c1y, float c2x, float c2y, float x, float y);
|
||||
|
||||
// Adds quadratic bezier segment from last point in the path via a control point to the specified point.
|
||||
void nvgQuadTo(NVGcontext* ctx, float cx, float cy, float x, float y);
|
||||
|
||||
// Adds an arc segment at the corner defined by the last path point, and two specified points.
|
||||
void nvgArcTo(NVGcontext* ctx, float x1, float y1, float x2, float y2, float radius);
|
||||
|
||||
// Closes current sub-path with a line segment.
|
||||
void nvgClosePath(NVGcontext* ctx);
|
||||
|
||||
// Sets the current sub-path winding, see NVGwinding and NVGsolidity.
|
||||
void nvgPathWinding(NVGcontext* ctx, int dir);
|
||||
|
||||
// Creates new circle arc shaped sub-path. The arc center is at cx,cy, the arc radius is r,
|
||||
// and the arc is drawn from angle a0 to a1, and swept in direction dir (NVG_CCW, or NVG_CW).
|
||||
// Angles are specified in radians.
|
||||
void nvgArc(NVGcontext* ctx, float cx, float cy, float r, float a0, float a1, int dir);
|
||||
|
||||
// Creates new rectangle shaped sub-path.
|
||||
void nvgRect(NVGcontext* ctx, float x, float y, float w, float h);
|
||||
|
||||
// Creates new rounded rectangle shaped sub-path.
|
||||
void nvgRoundedRect(NVGcontext* ctx, float x, float y, float w, float h, float r);
|
||||
|
||||
// Creates new rounded rectangle shaped sub-path with varying radii for each corner.
|
||||
void nvgRoundedRectVarying(NVGcontext* ctx, float x, float y, float w, float h, float radTopLeft, float radTopRight, float radBottomRight, float radBottomLeft);
|
||||
|
||||
// Creates new ellipse shaped sub-path.
|
||||
void nvgEllipse(NVGcontext* ctx, float cx, float cy, float rx, float ry);
|
||||
|
||||
// Creates new circle shaped sub-path.
|
||||
void nvgCircle(NVGcontext* ctx, float cx, float cy, float r);
|
||||
|
||||
// Fills the current path with current fill style.
|
||||
void nvgFill(NVGcontext* ctx);
|
||||
|
||||
// Fills the current path with current stroke style.
|
||||
void nvgStroke(NVGcontext* ctx);
|
||||
|
||||
|
||||
//
|
||||
// Text
|
||||
//
|
||||
// NanoVG allows you to load .ttf files and use the font to render text.
|
||||
//
|
||||
// The appearance of the text can be defined by setting the current text style
|
||||
// and by specifying the fill color. Common text and font settings such as
|
||||
// font size, letter spacing and text align are supported. Font blur allows you
|
||||
// to create simple text effects such as drop shadows.
|
||||
//
|
||||
// At render time the font face can be set based on the font handles or name.
|
||||
//
|
||||
// Font measure functions return values in local space, the calculations are
|
||||
// carried in the same resolution as the final rendering. This is done because
|
||||
// the text glyph positions are snapped to the nearest pixels sharp rendering.
|
||||
//
|
||||
// The local space means that values are not rotated or scale as per the current
|
||||
// transformation. For example if you set font size to 12, which would mean that
|
||||
// line height is 16, then regardless of the current scaling and rotation, the
|
||||
// returned line height is always 16. Some measures may vary because of the scaling
|
||||
// since aforementioned pixel snapping.
|
||||
//
|
||||
// While this may sound a little odd, the setup allows you to always render the
|
||||
// same way regardless of scaling. I.e. following works regardless of scaling:
|
||||
//
|
||||
// const char* txt = "Text me up.";
|
||||
// nvgTextBounds(vg, x,y, txt, NULL, bounds);
|
||||
// nvgBeginPath(vg);
|
||||
// nvgRoundedRect(vg, bounds[0],bounds[1], bounds[2]-bounds[0], bounds[3]-bounds[1]);
|
||||
// nvgFill(vg);
|
||||
//
|
||||
// Note: currently only solid color fill is supported for text.
|
||||
|
||||
// Creates font by loading it from the disk from specified file name.
|
||||
// Returns handle to the font.
|
||||
int nvgCreateFont(NVGcontext* ctx, const char* name, const char* filename);
|
||||
|
||||
// Creates font by loading it from the specified memory chunk.
|
||||
// Returns handle to the font.
|
||||
int nvgCreateFontMem(NVGcontext* ctx, const char* name, unsigned char* data, int ndata, int freeData);
|
||||
|
||||
// Finds a loaded font of specified name, and returns handle to it, or -1 if the font is not found.
|
||||
int nvgFindFont(NVGcontext* ctx, const char* name);
|
||||
|
||||
// Adds a fallback font by handle.
|
||||
int nvgAddFallbackFontId(NVGcontext* ctx, int baseFont, int fallbackFont);
|
||||
|
||||
// Adds a fallback font by name.
|
||||
int nvgAddFallbackFont(NVGcontext* ctx, const char* baseFont, const char* fallbackFont);
|
||||
|
||||
// Sets the font size of current text style.
|
||||
void nvgFontSize(NVGcontext* ctx, float size);
|
||||
|
||||
// Sets the blur of current text style.
|
||||
void nvgFontBlur(NVGcontext* ctx, float blur);
|
||||
|
||||
// Sets the letter spacing of current text style.
|
||||
void nvgTextLetterSpacing(NVGcontext* ctx, float spacing);
|
||||
|
||||
// Sets the proportional line height of current text style. The line height is specified as multiple of font size.
|
||||
void nvgTextLineHeight(NVGcontext* ctx, float lineHeight);
|
||||
|
||||
// Sets the text align of current text style, see NVGalign for options.
|
||||
void nvgTextAlign(NVGcontext* ctx, int align);
|
||||
|
||||
// Sets the font face based on specified id of current text style.
|
||||
void nvgFontFaceId(NVGcontext* ctx, int font);
|
||||
|
||||
// Sets the font face based on specified name of current text style.
|
||||
void nvgFontFace(NVGcontext* ctx, const char* font);
|
||||
|
||||
// Draws text string at specified location. If end is specified only the sub-string up to the end is drawn.
|
||||
float nvgText(NVGcontext* ctx, float x, float y, const char* string, const char* end);
|
||||
|
||||
// Draws multi-line text string at specified location wrapped at the specified width. If end is specified only the sub-string up to the end is drawn.
|
||||
// White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered.
|
||||
// Words longer than the max width are slit at nearest character (i.e. no hyphenation).
|
||||
void nvgTextBox(NVGcontext* ctx, float x, float y, float breakRowWidth, const char* string, const char* end);
|
||||
|
||||
// Measures the specified text string. Parameter bounds should be a pointer to float[4],
|
||||
// if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax]
|
||||
// Returns the horizontal advance of the measured text (i.e. where the next character should drawn).
|
||||
// Measured values are returned in local coordinate space.
|
||||
float nvgTextBounds(NVGcontext* ctx, float x, float y, const char* string, const char* end, float* bounds);
|
||||
|
||||
// Measures the specified multi-text string. Parameter bounds should be a pointer to float[4],
|
||||
// if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax]
|
||||
// Measured values are returned in local coordinate space.
|
||||
void nvgTextBoxBounds(NVGcontext* ctx, float x, float y, float breakRowWidth, const char* string, const char* end, float* bounds);
|
||||
|
||||
// Calculates the glyph x positions of the specified text. If end is specified only the sub-string will be used.
|
||||
// Measured values are returned in local coordinate space.
|
||||
int nvgTextGlyphPositions(NVGcontext* ctx, float x, float y, const char* string, const char* end, NVGglyphPosition* positions, int maxPositions);
|
||||
|
||||
// Returns the vertical metrics based on the current text style.
|
||||
// Measured values are returned in local coordinate space.
|
||||
void nvgTextMetrics(NVGcontext* ctx, float* ascender, float* descender, float* lineh);
|
||||
|
||||
// Breaks the specified text into lines. If end is specified only the sub-string will be used.
|
||||
// White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered.
|
||||
// Words longer than the max width are slit at nearest character (i.e. no hyphenation).
|
||||
int nvgTextBreakLines(NVGcontext* ctx, const char* string, const char* end, float breakRowWidth, NVGtextRow* rows, int maxRows);
|
||||
|
||||
//
|
||||
// Internal Render API
|
||||
//
|
||||
enum NVGtexture {
|
||||
NVG_TEXTURE_ALPHA = 0x01,
|
||||
NVG_TEXTURE_RGBA = 0x02,
|
||||
};
|
||||
|
||||
struct NVGscissor {
|
||||
float xform[6];
|
||||
float extent[2];
|
||||
};
|
||||
typedef struct NVGscissor NVGscissor;
|
||||
|
||||
struct NVGvertex {
|
||||
float x,y,u,v;
|
||||
};
|
||||
typedef struct NVGvertex NVGvertex;
|
||||
|
||||
struct NVGpath {
|
||||
int first;
|
||||
int count;
|
||||
unsigned char closed;
|
||||
int nbevel;
|
||||
NVGvertex* fill;
|
||||
int nfill;
|
||||
NVGvertex* stroke;
|
||||
int nstroke;
|
||||
int winding;
|
||||
int convex;
|
||||
};
|
||||
typedef struct NVGpath NVGpath;
|
||||
|
||||
struct NVGparams {
|
||||
void* userPtr;
|
||||
int edgeAntiAlias;
|
||||
int (*renderCreate)(void* uptr);
|
||||
int (*renderCreateTexture)(void* uptr, int type, int w, int h, int imageFlags, const unsigned char* data);
|
||||
int (*renderDeleteTexture)(void* uptr, int image);
|
||||
int (*renderUpdateTexture)(void* uptr, int image, int x, int y, int w, int h, const unsigned char* data);
|
||||
int (*renderGetTextureSize)(void* uptr, int image, int* w, int* h);
|
||||
void (*renderViewport)(void* uptr, float width, float height, float devicePixelRatio);
|
||||
void (*renderCancel)(void* uptr);
|
||||
void (*renderFlush)(void* uptr);
|
||||
void (*renderFill)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths);
|
||||
void (*renderStroke)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe, float strokeWidth, const NVGpath* paths, int npaths);
|
||||
void (*renderTriangles)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, const NVGvertex* verts, int nverts);
|
||||
void (*renderDelete)(void* uptr);
|
||||
};
|
||||
typedef struct NVGparams NVGparams;
|
||||
|
||||
// Constructor and destructor, called by the render back-end.
|
||||
NVGcontext* nvgCreateInternal(NVGparams* params);
|
||||
void nvgDeleteInternal(NVGcontext* ctx);
|
||||
|
||||
NVGparams* nvgInternalParams(NVGcontext* ctx);
|
||||
|
||||
// Debug function to dump cached path data.
|
||||
void nvgDebugDumpPathCache(NVGcontext* ctx);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#define NVG_NOTUSED(v) for (;;) { (void)(1 ? (void)0 : ( (void)(v) ) ); break; }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NANOVG_H
|
||||
1649
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/nanovg_gl.h
vendored
Normal file
1649
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/nanovg_gl.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
154
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/nanovg_gl_utils.h
vendored
Normal file
154
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/nanovg_gl_utils.h
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
//
|
||||
// Copyright (c) 2009-2013 Mikko Mononen memon@inside.org
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
#ifndef NANOVG_GL_UTILS_H
|
||||
#define NANOVG_GL_UTILS_H
|
||||
|
||||
struct NVGLUframebuffer {
|
||||
NVGcontext* ctx;
|
||||
GLuint fbo;
|
||||
GLuint rbo;
|
||||
GLuint texture;
|
||||
int image;
|
||||
};
|
||||
typedef struct NVGLUframebuffer NVGLUframebuffer;
|
||||
|
||||
// Helper function to create GL frame buffer to render to.
|
||||
void nvgluBindFramebuffer(NVGLUframebuffer* fb);
|
||||
NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int w, int h, int imageFlags);
|
||||
void nvgluDeleteFramebuffer(NVGLUframebuffer* fb);
|
||||
|
||||
#endif // NANOVG_GL_UTILS_H
|
||||
|
||||
#ifdef NANOVG_GL_IMPLEMENTATION
|
||||
|
||||
#if defined(NANOVG_GL3) || defined(NANOVG_GLES2) || defined(NANOVG_GLES3)
|
||||
// FBO is core in OpenGL 3>.
|
||||
# define NANOVG_FBO_VALID 1
|
||||
#elif defined(NANOVG_GL2)
|
||||
// On OS X including glext defines FBO on GL2 too.
|
||||
# ifdef __APPLE__
|
||||
# include <OpenGL/glext.h>
|
||||
# define NANOVG_FBO_VALID 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static GLint defaultFBO = -1;
|
||||
|
||||
NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int w, int h, int imageFlags)
|
||||
{
|
||||
#ifdef NANOVG_FBO_VALID
|
||||
GLint defaultFBO;
|
||||
GLint defaultRBO;
|
||||
NVGLUframebuffer* fb = NULL;
|
||||
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO);
|
||||
glGetIntegerv(GL_RENDERBUFFER_BINDING, &defaultRBO);
|
||||
|
||||
fb = (NVGLUframebuffer*)malloc(sizeof(NVGLUframebuffer));
|
||||
if (fb == NULL) goto error;
|
||||
memset(fb, 0, sizeof(NVGLUframebuffer));
|
||||
|
||||
fb->image = nvgCreateImageRGBA(ctx, w, h, imageFlags | NVG_IMAGE_FLIPY | NVG_IMAGE_PREMULTIPLIED, NULL);
|
||||
|
||||
#if defined NANOVG_GL2
|
||||
fb->texture = nvglImageHandleGL2(ctx, fb->image);
|
||||
#elif defined NANOVG_GL3
|
||||
fb->texture = nvglImageHandleGL3(ctx, fb->image);
|
||||
#elif defined NANOVG_GLES2
|
||||
fb->texture = nvglImageHandleGLES2(ctx, fb->image);
|
||||
#elif defined NANOVG_GLES3
|
||||
fb->texture = nvglImageHandleGLES3(ctx, fb->image);
|
||||
#endif
|
||||
|
||||
fb->ctx = ctx;
|
||||
|
||||
// frame buffer object
|
||||
glGenFramebuffers(1, &fb->fbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fb->fbo);
|
||||
|
||||
// render buffer object
|
||||
glGenRenderbuffers(1, &fb->rbo);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, fb->rbo);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, w, h);
|
||||
|
||||
// combine all
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fb->texture, 0);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fb->rbo);
|
||||
|
||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
||||
#ifdef GL_DEPTH24_STENCIL8
|
||||
// If GL_STENCIL_INDEX8 is not supported, try GL_DEPTH24_STENCIL8 as a fallback.
|
||||
// Some graphics cards require a depth buffer along with a stencil.
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, w, h);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fb->texture, 0);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fb->rbo);
|
||||
|
||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||
#endif // GL_DEPTH24_STENCIL8
|
||||
goto error;
|
||||
}
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, defaultRBO);
|
||||
return fb;
|
||||
error:
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, defaultRBO);
|
||||
nvgluDeleteFramebuffer(fb);
|
||||
return NULL;
|
||||
#else
|
||||
NVG_NOTUSED(ctx);
|
||||
NVG_NOTUSED(w);
|
||||
NVG_NOTUSED(h);
|
||||
NVG_NOTUSED(imageFlags);
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void nvgluBindFramebuffer(NVGLUframebuffer* fb)
|
||||
{
|
||||
#ifdef NANOVG_FBO_VALID
|
||||
if (defaultFBO == -1) glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fb != NULL ? fb->fbo : defaultFBO);
|
||||
#else
|
||||
NVG_NOTUSED(fb);
|
||||
#endif
|
||||
}
|
||||
|
||||
void nvgluDeleteFramebuffer(NVGLUframebuffer* fb)
|
||||
{
|
||||
#ifdef NANOVG_FBO_VALID
|
||||
if (fb == NULL) return;
|
||||
if (fb->fbo != 0)
|
||||
glDeleteFramebuffers(1, &fb->fbo);
|
||||
if (fb->rbo != 0)
|
||||
glDeleteRenderbuffers(1, &fb->rbo);
|
||||
if (fb->image >= 0)
|
||||
nvgDeleteImage(fb->ctx, fb->image);
|
||||
fb->ctx = NULL;
|
||||
fb->fbo = 0;
|
||||
fb->rbo = 0;
|
||||
fb->texture = 0;
|
||||
fb->image = -1;
|
||||
free(fb);
|
||||
#else
|
||||
NVG_NOTUSED(fb);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // NANOVG_GL_IMPLEMENTATION
|
||||
7547
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/stb_image.h
vendored
Normal file
7547
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/stb_image.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4882
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/stb_truetype.h
vendored
Normal file
4882
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nanovg-gl/stb_truetype.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
25447
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nlohmann/json.hpp
vendored
Normal file
25447
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/nlohmann/json.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2365
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/tinyxml2/tinyxml2.h
vendored
Normal file
2365
Source/Benchmark-Toolbox/lib/borealis/library/include/borealis/extern/tinyxml2/tinyxml2.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/font.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// Font loader that reads everything from resources
|
||||
class GLFWFontLoader : public FontLoader
|
||||
{
|
||||
public:
|
||||
void loadFonts() override;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/input.hpp>
|
||||
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// Input manager for GLFW gamepad and keyboard
|
||||
class GLFWInputManager : public InputManager
|
||||
{
|
||||
public:
|
||||
GLFWInputManager(GLFWwindow* window);
|
||||
|
||||
void updateControllerState(ControllerState* state) override;
|
||||
|
||||
private:
|
||||
GLFWwindow* window;
|
||||
};
|
||||
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/platform.hpp>
|
||||
#include <borealis/platforms/glfw/glfw_font.hpp>
|
||||
#include <borealis/platforms/glfw/glfw_input.hpp>
|
||||
#include <borealis/platforms/glfw/glfw_video.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
class GLFWPlatform : public Platform
|
||||
{
|
||||
public:
|
||||
GLFWPlatform();
|
||||
~GLFWPlatform();
|
||||
|
||||
std::string getName() override;
|
||||
void createWindow(std::string windowTitle, uint32_t windowWidth, uint32_t windowHeight) override;
|
||||
|
||||
bool mainLoopIteration() override;
|
||||
ThemeVariant getThemeVariant() override;
|
||||
std::string getLocale() override;
|
||||
|
||||
AudioPlayer* getAudioPlayer() override;
|
||||
VideoContext* getVideoContext() override;
|
||||
InputManager* getInputManager() override;
|
||||
FontLoader* getFontLoader() override;
|
||||
|
||||
private:
|
||||
NullAudioPlayer* audioPlayer = nullptr;
|
||||
GLFWVideoContext* videoContext = nullptr;
|
||||
GLFWInputManager* inputManager = nullptr;
|
||||
GLFWFontLoader* fontLoader = nullptr;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/video.hpp>
|
||||
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// GLFW Video Context
|
||||
class GLFWVideoContext : public VideoContext
|
||||
{
|
||||
public:
|
||||
GLFWVideoContext(std::string windowTitle, uint32_t windowWidth, uint32_t windowHeight);
|
||||
~GLFWVideoContext();
|
||||
|
||||
NVGcontext* getNVGContext() override;
|
||||
|
||||
void clear(NVGcolor color) override;
|
||||
void beginFrame() override;
|
||||
void endFrame() override;
|
||||
void resetState() override;
|
||||
|
||||
GLFWwindow* getGLFWWindow();
|
||||
|
||||
private:
|
||||
GLFWwindow* window = nullptr;
|
||||
NVGcontext* nvgContext = nullptr;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pulsar.h>
|
||||
|
||||
#include <borealis/core/audio.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// AudioPlayer implementation that uses libpulsar to load and play
|
||||
// qlaunch sounds loaded at runtime
|
||||
class SwitchAudioPlayer : public AudioPlayer
|
||||
{
|
||||
public:
|
||||
SwitchAudioPlayer();
|
||||
~SwitchAudioPlayer();
|
||||
|
||||
bool load(enum Sound sound) override;
|
||||
bool play(enum Sound sound) override;
|
||||
|
||||
private:
|
||||
bool init = false;
|
||||
|
||||
PLSR_BFSAR qlaunchBfsar;
|
||||
|
||||
PLSR_PlayerSoundId sounds[_SOUND_MAX];
|
||||
};
|
||||
|
||||
} //namespace brls
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/font.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// Font loader using the pl system service
|
||||
class SwitchFontLoader : public FontLoader
|
||||
{
|
||||
public:
|
||||
void loadFonts() override;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <switch.h>
|
||||
|
||||
#include <borealis/core/input.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// InputManager that uses the hid sysmodule to get inputs
|
||||
class SwitchInputManager : public InputManager
|
||||
{
|
||||
public:
|
||||
SwitchInputManager();
|
||||
|
||||
void updateControllerState(ControllerState* state);
|
||||
|
||||
private:
|
||||
PadState padState;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/platforms/glfw/glfw_platform.hpp>
|
||||
#include <borealis/platforms/switch/switch_audio.hpp>
|
||||
#include <borealis/platforms/switch/switch_font.hpp>
|
||||
#include <borealis/platforms/switch/switch_input.hpp>
|
||||
#include <borealis/platforms/switch/switch_video.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
class SwitchPlatform : public Platform
|
||||
{
|
||||
public:
|
||||
SwitchPlatform();
|
||||
~SwitchPlatform();
|
||||
|
||||
void createWindow(std::string windowTitle, uint32_t windowWidth, uint32_t windowHeight) override;
|
||||
|
||||
std::string getName() override;
|
||||
|
||||
bool mainLoopIteration() override;
|
||||
ThemeVariant getThemeVariant() override;
|
||||
std::string getLocale() override;
|
||||
|
||||
VideoContext* getVideoContext() override;
|
||||
AudioPlayer* getAudioPlayer() override;
|
||||
InputManager* getInputManager() override;
|
||||
FontLoader* getFontLoader() override;
|
||||
|
||||
void appletCallback(AppletHookType hookType);
|
||||
|
||||
private:
|
||||
AppletHookCookie appletCookie;
|
||||
|
||||
ThemeVariant themeVariant;
|
||||
std::string locale;
|
||||
|
||||
SwitchAudioPlayer* audioPlayer;
|
||||
SwitchInputManager* inputManager;
|
||||
SwitchVideoContext* videoContext;
|
||||
SwitchFontLoader* fontLoader;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
Copyright 2020 Adubbz
|
||||
Copyright 2020-2021 Luis Scheurenbrand
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <nanovg/framework/CMemPool.h>
|
||||
#include <switch.h>
|
||||
|
||||
#include <borealis/core/video.hpp>
|
||||
#include <deko3d.hpp>
|
||||
#include <nanovg/dk_renderer.hpp>
|
||||
#include <optional>
|
||||
|
||||
typedef Event _LibNXEvent; // "Event" alone clashes with brls::Event
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
static constexpr const unsigned FRAMEBUFFERS_COUNT = 2;
|
||||
|
||||
// deko3d video context
|
||||
class SwitchVideoContext : public VideoContext
|
||||
{
|
||||
public:
|
||||
SwitchVideoContext();
|
||||
~SwitchVideoContext();
|
||||
|
||||
void clear(NVGcolor color) override;
|
||||
void resetState() override;
|
||||
void beginFrame() override;
|
||||
void endFrame() override;
|
||||
virtual NVGcontext* getNVGContext() override;
|
||||
|
||||
void appletCallback(AppletHookType hookType);
|
||||
|
||||
private:
|
||||
_LibNXEvent defaultDisplayResolutionChangeEvent;
|
||||
bool displayResolutionChangeEventReady = true;
|
||||
|
||||
void resetFramebuffer(); // triggered by either display resolution change event or operation mode change event
|
||||
void updateWindowSize();
|
||||
void createFramebufferResources();
|
||||
void recordStaticCommands();
|
||||
|
||||
void destroyFramebufferResources();
|
||||
|
||||
float framebufferWidth, framebufferHeight;
|
||||
int imageSlot;
|
||||
|
||||
dk::UniqueDevice device;
|
||||
dk::UniqueQueue queue;
|
||||
dk::UniqueCmdBuf cmdbuf;
|
||||
dk::UniqueSwapchain swapchain;
|
||||
|
||||
dk::Image depthBuffer;
|
||||
CMemPool::Handle depthBufferHandle;
|
||||
|
||||
dk::Image framebuffers[FRAMEBUFFERS_COUNT];
|
||||
CMemPool::Handle framebuffersHandles[FRAMEBUFFERS_COUNT];
|
||||
|
||||
DkCmdList framebuffersCmdLists[FRAMEBUFFERS_COUNT];
|
||||
DkCmdList renderCmdlist;
|
||||
|
||||
std::optional<CMemPool> imagesPool;
|
||||
std::optional<CMemPool> codePool;
|
||||
std::optional<CMemPool> dataPool;
|
||||
|
||||
std::optional<nvg::DkRenderer> renderer;
|
||||
NVGcontext* nvgContext;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
Copyright 2019 WerWolv
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
class Swkbd
|
||||
{
|
||||
public:
|
||||
static bool openForText(std::function<void(std::string)> f, std::string headerText = "", std::string subText = "", int maxStringLength = 32, std::string initialText = "");
|
||||
static bool openForNumber(std::function<void(int)> f, std::string headerText = "", std::string subText = "", int maxStringLength = 32, std::string initialText = "", std::string leftButton = "", std::string rightButton = "");
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright 2019-2021 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/bind.hpp>
|
||||
#include <borealis/core/box.hpp>
|
||||
#include <borealis/views/image.hpp>
|
||||
#include <borealis/views/label.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// A Horizon settings-like frame, with header and footer (no sidebar)
|
||||
class AppletFrame : public Box
|
||||
{
|
||||
public:
|
||||
AppletFrame();
|
||||
|
||||
void handleXMLElement(tinyxml2::XMLElement* element) override;
|
||||
|
||||
/**
|
||||
* Sets the content view for that AppletFrame.
|
||||
* Will be placed between header and footer and expanded with grow factor
|
||||
* and width / height to AUTO.
|
||||
*/
|
||||
void setContentView(View* view);
|
||||
|
||||
void setTitle(std::string title);
|
||||
|
||||
void setIconFromRes(std::string name);
|
||||
void setIconFromFile(std::string path);
|
||||
|
||||
static View* create();
|
||||
|
||||
private:
|
||||
BRLS_BIND(Label, title, "brls/applet_frame/title_label");
|
||||
BRLS_BIND(Image, icon, "brls/applet_frame/title_icon");
|
||||
|
||||
protected:
|
||||
View* contentView = nullptr;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
Copyright 2019-2021 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/bind.hpp>
|
||||
#include <borealis/core/box.hpp>
|
||||
#include <borealis/views/label.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// Style and colors of different buttons styles
|
||||
// Border color entries can be empty if thickness is 0
|
||||
// Highlight padding can be empty
|
||||
// Background color entries can be empty
|
||||
// Border thickness can be empty
|
||||
// The rest is mandatory
|
||||
typedef struct ButtonStyle
|
||||
{
|
||||
// Regular values
|
||||
ShadowType shadowType;
|
||||
bool hideHighlightBackground;
|
||||
|
||||
// Style entries
|
||||
std::string highlightPadding;
|
||||
std::string borderThickness;
|
||||
|
||||
// Theme entries
|
||||
std::string enabledBackgroundColor;
|
||||
std::string enabledLabelColor;
|
||||
std::string enabledBorderColor;
|
||||
|
||||
std::string disabledBackgroundColor;
|
||||
std::string disabledLabelColor;
|
||||
std::string disabledBorderColor;
|
||||
} ButtonStyle;
|
||||
|
||||
// primary action button (different background color than default, to catch the eye)
|
||||
inline const ButtonStyle BUTTONSTYLE_PRIMARY = {
|
||||
.shadowType = ShadowType::GENERIC,
|
||||
.hideHighlightBackground = true,
|
||||
|
||||
.highlightPadding = "brls/button/primary_highlight_padding",
|
||||
.borderThickness = "",
|
||||
|
||||
.enabledBackgroundColor = "brls/button/primary_enabled_background",
|
||||
.enabledLabelColor = "brls/button/primary_enabled_text",
|
||||
.enabledBorderColor = "",
|
||||
|
||||
.disabledBackgroundColor = "brls/button/primary_disabled_background",
|
||||
.disabledLabelColor = "brls/button/primary_disabled_text",
|
||||
.disabledBorderColor = "",
|
||||
};
|
||||
|
||||
// between primary and default - text color is different, background color is the same
|
||||
inline const ButtonStyle BUTTONSTYLE_HIGHLIGHT = {
|
||||
.shadowType = ShadowType::GENERIC,
|
||||
.hideHighlightBackground = true,
|
||||
|
||||
.highlightPadding = "",
|
||||
.borderThickness = "",
|
||||
|
||||
.enabledBackgroundColor = "brls/button/default_enabled_background",
|
||||
.enabledLabelColor = "brls/button/highlight_enabled_text",
|
||||
.enabledBorderColor = "",
|
||||
|
||||
.disabledBackgroundColor = "brls/button/default_disabled_background",
|
||||
.disabledLabelColor = "brls/button/highlight_disabled_text",
|
||||
.disabledBorderColor = "",
|
||||
};
|
||||
|
||||
// default, plain button
|
||||
inline const ButtonStyle BUTTONSTYLE_DEFAULT = {
|
||||
.shadowType = ShadowType::GENERIC,
|
||||
.hideHighlightBackground = true,
|
||||
|
||||
.highlightPadding = "",
|
||||
.borderThickness = "",
|
||||
|
||||
.enabledBackgroundColor = "brls/button/default_enabled_background",
|
||||
.enabledLabelColor = "brls/button/default_enabled_text",
|
||||
.enabledBorderColor = "",
|
||||
|
||||
.disabledBackgroundColor = "brls/button/default_disabled_background",
|
||||
.disabledLabelColor = "brls/button/default_disabled_text",
|
||||
.disabledBorderColor = "",
|
||||
};
|
||||
|
||||
// text and a border
|
||||
inline const ButtonStyle BUTTONSTYLE_BORDERED = {
|
||||
.shadowType = ShadowType::NONE,
|
||||
.hideHighlightBackground = false,
|
||||
|
||||
.highlightPadding = "",
|
||||
.borderThickness = "brls/button/border_thickness",
|
||||
|
||||
.enabledBackgroundColor = "",
|
||||
.enabledLabelColor = "brls/button/default_enabled_text",
|
||||
.enabledBorderColor = "brls/button/enabled_border_color",
|
||||
|
||||
.disabledBackgroundColor = "",
|
||||
.disabledLabelColor = "brls/button/default_disabled_text",
|
||||
.disabledBorderColor = "brls/button/disabled_border_color",
|
||||
};
|
||||
|
||||
// only text
|
||||
inline const ButtonStyle BUTTONSTYLE_BORDERLESS = {
|
||||
.shadowType = ShadowType::NONE,
|
||||
.hideHighlightBackground = false,
|
||||
|
||||
.highlightPadding = "",
|
||||
.borderThickness = "",
|
||||
|
||||
.enabledBackgroundColor = "",
|
||||
.enabledLabelColor = "brls/button/default_enabled_text",
|
||||
.enabledBorderColor = "",
|
||||
|
||||
.disabledBackgroundColor = "",
|
||||
.disabledLabelColor = "brls/button/default_disabled_text",
|
||||
.disabledBorderColor = "",
|
||||
};
|
||||
|
||||
enum class ButtonState
|
||||
{
|
||||
ENABLED = 0, // the user can select and click on the button
|
||||
DISABLED, // the user can select but not click on the button (greyed out)
|
||||
};
|
||||
|
||||
// A button
|
||||
class Button : public Box
|
||||
{
|
||||
public:
|
||||
Button();
|
||||
|
||||
void onFocusGained() override;
|
||||
void onFocusLost() override;
|
||||
|
||||
static View* create();
|
||||
|
||||
/**
|
||||
* Sets the style of the button. can be a pointer to one of the
|
||||
* BUTTONSTYLE constants or any other user created style.
|
||||
*/
|
||||
void setStyle(const ButtonStyle* style);
|
||||
|
||||
/**
|
||||
* Sets the state of the button.
|
||||
*/
|
||||
void setState(ButtonState state);
|
||||
|
||||
/**
|
||||
* Sets the text of the button.
|
||||
*/
|
||||
void setText(std::string text);
|
||||
|
||||
/**
|
||||
* Returns the text of the button
|
||||
*/
|
||||
std::string getText();
|
||||
|
||||
private:
|
||||
const ButtonStyle* style = &BUTTONSTYLE_DEFAULT;
|
||||
ButtonState state = ButtonState::ENABLED;
|
||||
|
||||
void applyStyle();
|
||||
|
||||
BRLS_BIND(Label, label, "brls/button/label");
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright 2019-2021 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/bind.hpp>
|
||||
#include <borealis/core/box.hpp>
|
||||
#include <borealis/views/label.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// A simple header with a title, an optional subtitle, a rectangle on the left
|
||||
// and a separator
|
||||
class Header : public Box
|
||||
{
|
||||
public:
|
||||
Header();
|
||||
|
||||
void setTitle(std::string text);
|
||||
void setSubtitle(std::string text);
|
||||
|
||||
static View* create();
|
||||
|
||||
private:
|
||||
BRLS_BIND(Label, title, "brls/header/title");
|
||||
BRLS_BIND(Label, subtitle, "brls/header/subtitle");
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
Copyright 2019 WerWolv
|
||||
Copyright 2019 p-sam
|
||||
Copyright 2020-2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/view.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// This dictates what to do with the image if there is not
|
||||
// enough room for the view to grow and display the whole image,
|
||||
// or if the view is bigger than the image
|
||||
enum class ImageScalingType
|
||||
{
|
||||
// The image is scaled to fit the view boundaries, aspect ratio is conserved
|
||||
FIT,
|
||||
// The image is stretched to fit the view boundaries (aspect ratio is not conserved). The original image dimensions are entirely ignored in the layout process.
|
||||
STRETCH,
|
||||
// The image is either cropped (not enough space) or untouched (too much space)
|
||||
CROP,
|
||||
};
|
||||
|
||||
// This dictates what interpolation to use when down / up scaling the image
|
||||
enum class ImageInterpolation
|
||||
{
|
||||
LINEAR,
|
||||
NEAREST
|
||||
};
|
||||
|
||||
// Alignment of the image inside the view for FIT and CROP scaling types
|
||||
enum class ImageAlignment
|
||||
{
|
||||
TOP,
|
||||
RIGHT,
|
||||
BOTTOM,
|
||||
LEFT,
|
||||
CENTER,
|
||||
};
|
||||
|
||||
// An image. The view will try to grow as much
|
||||
// as possible to fit the image. The scaling type dictates
|
||||
// what to do with the image if there is not enough or too much space
|
||||
// for the view compared to the image inside.
|
||||
// Supported formats are: JPG, PNG, TGA, BMP and GIF (not animated).
|
||||
class Image : public View
|
||||
{
|
||||
public:
|
||||
Image();
|
||||
~Image();
|
||||
|
||||
void draw(NVGcontext* vg, float x, float y, float width, float height, Style style, FrameContext* ctx) override;
|
||||
void onLayout() override;
|
||||
|
||||
/**
|
||||
* Sets the interpolation method for the image. Default is LINEAR.
|
||||
*
|
||||
* As the interpolation is set when the texture is created, and since we don't
|
||||
* want to always store the image buffer in the view, this only takes effect
|
||||
* after (re) loading the image using the setImage* methods.
|
||||
*
|
||||
* If you are using the interpolation XML attribute, you have to set it before the
|
||||
* actual image attribute.
|
||||
*/
|
||||
void setInterpolation(ImageInterpolation interpolation);
|
||||
|
||||
/**
|
||||
* Sets the image from the given resource name.
|
||||
*
|
||||
* See Image class documentation for the list of supported
|
||||
* image formats.
|
||||
*/
|
||||
void setImageFromRes(std::string name);
|
||||
|
||||
/**
|
||||
* Sets the image from the given file path.
|
||||
*
|
||||
* See Image class documentation for the list of supported
|
||||
* image formats.
|
||||
*/
|
||||
void setImageFromFile(std::string path);
|
||||
|
||||
/**
|
||||
* Sets the scaling type for this image.
|
||||
*
|
||||
* Default is FIT.
|
||||
*/
|
||||
void setScalingType(ImageScalingType scalingType);
|
||||
|
||||
ImageScalingType getScalingType();
|
||||
|
||||
/**
|
||||
* Sets the alignment of the image inside the view.
|
||||
* Only used if scaling it set to FIT when the aspect ratio is different
|
||||
* or CROP, to change the region of the image to draw.
|
||||
*
|
||||
* Default is CENTER.
|
||||
*/
|
||||
void setImageAlign(ImageAlignment align);
|
||||
|
||||
int getTexture();
|
||||
float getOriginalImageWidth();
|
||||
float getOriginalImageHeight();
|
||||
|
||||
static View* create();
|
||||
|
||||
private:
|
||||
ImageScalingType scalingType = ImageScalingType::FIT;
|
||||
ImageAlignment align = ImageAlignment::CENTER;
|
||||
ImageInterpolation interpolation = ImageInterpolation::LINEAR;
|
||||
|
||||
int texture = 0;
|
||||
|
||||
NVGpaint paint;
|
||||
|
||||
void invalidateImageBounds();
|
||||
int getImageFlags();
|
||||
|
||||
float originalImageWidth = 0;
|
||||
float originalImageHeight = 0;
|
||||
|
||||
float imageX = 0;
|
||||
float imageY = 0;
|
||||
float imageHeight = 0;
|
||||
float imageWidth = 0;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
Copyright 2019-2021 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/animation.hpp>
|
||||
#include <borealis/core/timer.hpp>
|
||||
#include <borealis/core/view.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
enum class HorizontalAlign
|
||||
{
|
||||
LEFT,
|
||||
CENTER,
|
||||
RIGHT,
|
||||
};
|
||||
|
||||
enum class VerticalAlign
|
||||
{
|
||||
BASELINE,
|
||||
TOP,
|
||||
CENTER,
|
||||
BOTTOM,
|
||||
};
|
||||
|
||||
// Some text. The Label will automatically grow as much as possible.
|
||||
// If there is enough space, the label dimensions will fit the text.
|
||||
// If there is not enough horizontal space available, it will wrap and expand its height.
|
||||
// If there is not enough vertical space available to wrap, the text will be truncated instead.
|
||||
// The truncated text will animate if the Label or one of its parents is focused.
|
||||
// Animation will be disabled if the alignment is other than LEFT.
|
||||
// Warning: to wrap, the label width MUST be constrained
|
||||
class Label : public View
|
||||
{
|
||||
public:
|
||||
Label();
|
||||
~Label();
|
||||
|
||||
void draw(NVGcontext* vg, float x, float y, float width, float height, Style style, FrameContext* ctx) override;
|
||||
void onLayout() override;
|
||||
void onFocusGained() override;
|
||||
void onFocusLost() override;
|
||||
void onParentFocusGained(View* focusedView) override;
|
||||
void onParentFocusLost(View* focusedView) override;
|
||||
|
||||
/**
|
||||
* Sets the text of the label.
|
||||
*/
|
||||
void setText(std::string text);
|
||||
|
||||
/**
|
||||
* Sets the alignment of the text inside
|
||||
* the view. Will not move the view, only
|
||||
* the text inside.
|
||||
*
|
||||
* Default is CENTER.
|
||||
*/
|
||||
void setHorizontalAlign(HorizontalAlign align);
|
||||
|
||||
/**
|
||||
* Sets the alignment of the text inside
|
||||
* the view. Will not move the view, only
|
||||
* the text inside.
|
||||
*
|
||||
* Only applies to single-line labels.
|
||||
*
|
||||
* Default is CENTER.
|
||||
*/
|
||||
void setVerticalAlign(VerticalAlign align);
|
||||
|
||||
void setFontSize(float value);
|
||||
void setLineHeight(float value);
|
||||
void setTextColor(NVGcolor color);
|
||||
|
||||
int getFont();
|
||||
float getFontSize();
|
||||
float getLineHeight();
|
||||
|
||||
std::string getFullText();
|
||||
|
||||
static View* create();
|
||||
|
||||
void setRequiredWidth(float requiredWidth);
|
||||
void setEllipsisWidth(float ellipsisWidth);
|
||||
|
||||
/**
|
||||
* If an "animated" label is too large to fit its bounds, the full text will
|
||||
* be displayed in a scrolling animation instead of being truncated
|
||||
* with an ellipsis ("...").
|
||||
*
|
||||
* Unless the autoAnimate flag is set to false, a label will automatically
|
||||
* be set to "animated" if it is focused or if one of its parent is.
|
||||
*/
|
||||
void setAnimated(bool animated);
|
||||
|
||||
/**
|
||||
* Controls whether focus changes automatically animates the label or not.
|
||||
* Doesn't stop the ongoing animation should there be one.
|
||||
*/
|
||||
void setAutoAnimate(bool autoAnimate);
|
||||
|
||||
/**
|
||||
* A single-line label will not wrap and increase its
|
||||
* height, even if the remaining vertical space allows it.
|
||||
*
|
||||
* Instead, it will always be truncated (if too large) to fit the horizontal space.
|
||||
*/
|
||||
void setSingleLine(bool singleLine);
|
||||
|
||||
bool isSingleLine();
|
||||
|
||||
/**
|
||||
* Internal flag set by the measure function.
|
||||
*/
|
||||
void setIsWrapping(bool isWrapping);
|
||||
|
||||
private:
|
||||
std::string truncatedText = "";
|
||||
std::string fullText = "";
|
||||
|
||||
int font;
|
||||
float fontSize;
|
||||
float lineHeight;
|
||||
|
||||
NVGcolor textColor;
|
||||
|
||||
float requiredWidth;
|
||||
unsigned ellipsisWidth;
|
||||
|
||||
bool singleLine = false;
|
||||
bool isWrapping = false;
|
||||
|
||||
bool autoAnimate = true;
|
||||
bool animated = false; // should it animate?
|
||||
bool animating = false; // currently animating?
|
||||
|
||||
Timer scrollingTimer;
|
||||
Animatable scrollingAnimation;
|
||||
|
||||
void stopScrollingAnimation();
|
||||
void resetScrollingAnimation();
|
||||
|
||||
void startScrollTimer();
|
||||
void onScrollTimerFinished();
|
||||
|
||||
HorizontalAlign horizontalAlign = HorizontalAlign::LEFT;
|
||||
VerticalAlign verticalAlign = VerticalAlign::CENTER;
|
||||
|
||||
enum NVGalign getNVGHorizontalAlign();
|
||||
enum NVGalign getNVGVerticalAlign();
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright 2020-2021 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/frame_context.hpp>
|
||||
#include <borealis/core/view.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
// A solid color rectangle
|
||||
class Rectangle : public View
|
||||
{
|
||||
public:
|
||||
Rectangle(NVGcolor color);
|
||||
Rectangle();
|
||||
~Rectangle() {}
|
||||
|
||||
void draw(NVGcontext* vg, float x, float y, float width, float height, Style style, FrameContext* ctx) override;
|
||||
|
||||
void setColor(NVGcolor color);
|
||||
|
||||
static View* create();
|
||||
|
||||
private:
|
||||
NVGcolor color = nvgRGB(0, 0, 255);
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
Copyright 2020-2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/animation.hpp>
|
||||
#include <borealis/core/box.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
enum class ScrollingBehavior
|
||||
{
|
||||
// Inputs scroll the view like the scroll wheel on a web page, focus changes only when the next view to focus is fully on screen
|
||||
// To work properly, there must be at least one focusable view in the "top" area of the frame (there should not be the need to scroll to see it)
|
||||
NATURAL,
|
||||
|
||||
// The focused view is always in the center, inputs always change focus and scroll immediately
|
||||
CENTERED,
|
||||
};
|
||||
|
||||
// A vertical-only frame that can scroll if its content overflows.
|
||||
// This frame can only contain one child view.
|
||||
// The content view is detached from the rest of the tree
|
||||
// so that its height can grow as much as possible.
|
||||
class ScrollingFrame : public Box
|
||||
{
|
||||
public:
|
||||
ScrollingFrame();
|
||||
|
||||
void draw(NVGcontext* vg, float x, float y, float width, float height, Style style, FrameContext* ctx) override;
|
||||
void onChildFocusGained(View* directChild, View* focusedView) override;
|
||||
void onChildFocusLost(View* directChild, View* focusedView) override;
|
||||
void willAppear(bool resetState) override;
|
||||
void addView(View* view) override;
|
||||
void removeView(View* view) override;
|
||||
void onLayout() override;
|
||||
void setPadding(float top, float right, float bottom, float left) override;
|
||||
void setPaddingTop(float top) override;
|
||||
void setPaddingRight(float right) override;
|
||||
void setPaddingBottom(float bottom) override;
|
||||
void setPaddingLeft(float left) override;
|
||||
|
||||
/**
|
||||
* Sets the content view of this scrolling box. There can only be one
|
||||
* content view per scrolling box at a time.
|
||||
*/
|
||||
void setContentView(View* view);
|
||||
|
||||
/**
|
||||
* Sets the scrolling behavior of this scrolling frame.
|
||||
* Default is NATURAL.
|
||||
*/
|
||||
void setScrollingBehavior(ScrollingBehavior behavior);
|
||||
|
||||
static View* create();
|
||||
|
||||
private:
|
||||
View* contentView = nullptr;
|
||||
|
||||
bool updateScrollingOnNextFrame = false;
|
||||
bool childFocused = false;
|
||||
|
||||
float middleY = 0; // y + height/2
|
||||
float bottomY = 0; // y + height
|
||||
|
||||
Animatable scrollY = 0.0f; // from 0.0f to 1.0f, in % of content view height
|
||||
|
||||
void prebakeScrolling();
|
||||
bool updateScrolling(bool animated);
|
||||
void startScrolling(bool animated, float newScroll);
|
||||
void scrollAnimationTick();
|
||||
|
||||
float getScrollingAreaTopBoundary();
|
||||
float getScrollingAreaHeight();
|
||||
|
||||
float getContentHeight();
|
||||
|
||||
ScrollingBehavior behavior = ScrollingBehavior::NATURAL;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
Copyright 2019-2021 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/bind.hpp>
|
||||
#include <borealis/core/box.hpp>
|
||||
#include <borealis/views/label.hpp>
|
||||
#include <borealis/views/rectangle.hpp>
|
||||
#include <borealis/views/scrolling_frame.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
class SidebarItem;
|
||||
|
||||
class SidebarSeparator : public View
|
||||
{
|
||||
public:
|
||||
SidebarSeparator();
|
||||
|
||||
void draw(NVGcontext* vg, float x, float y, float width, float height, Style style, FrameContext* ctx) override;
|
||||
};
|
||||
|
||||
class SidebarItemGroup
|
||||
{
|
||||
public:
|
||||
void add(SidebarItem* item);
|
||||
void setActive(SidebarItem* item);
|
||||
|
||||
private:
|
||||
std::vector<SidebarItem*> items;
|
||||
};
|
||||
|
||||
class SidebarItem : public Box
|
||||
{
|
||||
public:
|
||||
SidebarItem();
|
||||
|
||||
void onFocusGained() override;
|
||||
void onFocusLost() override;
|
||||
|
||||
void setGroup(SidebarItemGroup* group);
|
||||
|
||||
void setLabel(std::string label);
|
||||
|
||||
void setActive(bool active);
|
||||
|
||||
GenericEvent* getActiveEvent();
|
||||
|
||||
private:
|
||||
BRLS_BIND(Rectangle, accent, "brls/sidebar/item_accent");
|
||||
BRLS_BIND(Label, label, "brls/sidebar/item_label");
|
||||
|
||||
GenericEvent activeEvent;
|
||||
|
||||
SidebarItemGroup* group;
|
||||
|
||||
bool active = false;
|
||||
};
|
||||
|
||||
class Sidebar : public ScrollingFrame
|
||||
{
|
||||
public:
|
||||
Sidebar();
|
||||
|
||||
/**
|
||||
* Adds an item to this sidebar. The given callback will be called
|
||||
* when the item becomes active.
|
||||
*/
|
||||
void addItem(std::string label, GenericEvent::Callback focusCallback);
|
||||
|
||||
/**
|
||||
* Adds a separator to this sidebar.
|
||||
*/
|
||||
void addSeparator();
|
||||
|
||||
static View* create();
|
||||
|
||||
private:
|
||||
SidebarItemGroup group;
|
||||
|
||||
Box* contentBox;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
Copyright 2019-2021 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <borealis/core/bind.hpp>
|
||||
#include <borealis/views/applet_frame.hpp>
|
||||
#include <borealis/views/sidebar.hpp>
|
||||
#include <functional>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
typedef std::function<View*(void)> TabViewCreator;
|
||||
|
||||
// An applet frame containing a sidebar on the left with multiple tabs which content is showing on the right.
|
||||
// Only one tab is kept in memory at all times : when switching, the current tab is freed before the the new one is instantiated.
|
||||
class TabFrame : public AppletFrame
|
||||
{
|
||||
public:
|
||||
TabFrame();
|
||||
|
||||
void handleXMLElement(tinyxml2::XMLElement* element) override;
|
||||
|
||||
void addTab(std::string label, TabViewCreator creator);
|
||||
void addSeparator();
|
||||
|
||||
static View* create();
|
||||
|
||||
private:
|
||||
BRLS_BIND(Sidebar, sidebar, "brls/tab_frame/sidebar");
|
||||
|
||||
View* activeTab = nullptr;
|
||||
};
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
Copyright 2020 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <borealis/core/activity.hpp>
|
||||
#include <borealis/core/application.hpp>
|
||||
#include <borealis/core/i18n.hpp>
|
||||
|
||||
using namespace brls::literals;
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
Activity::Activity()
|
||||
{
|
||||
}
|
||||
|
||||
void Activity::setContentView(View* view)
|
||||
{
|
||||
if (this->contentView)
|
||||
{
|
||||
this->contentView->willDisappear();
|
||||
delete this->contentView;
|
||||
}
|
||||
|
||||
this->contentView = view;
|
||||
// willAppear is only called when the activity is pushed onto the stack
|
||||
|
||||
this->resizeToFitWindow();
|
||||
}
|
||||
|
||||
void Activity::resizeToFitWindow()
|
||||
{
|
||||
if (!this->contentView)
|
||||
return;
|
||||
|
||||
this->contentView->setDimensions(Application::contentWidth, Application::contentHeight);
|
||||
}
|
||||
|
||||
View* Activity::createContentView()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
float Activity::getShowAnimationDuration(TransitionAnimation animation)
|
||||
{
|
||||
Style style = Application::getStyle();
|
||||
|
||||
if (animation == TransitionAnimation::SLIDE_LEFT || animation == TransitionAnimation::SLIDE_RIGHT)
|
||||
return style["brls/animations/show_slide"];
|
||||
|
||||
return style["brls/animations/show"];
|
||||
}
|
||||
|
||||
void Activity::onWindowSizeChanged()
|
||||
{
|
||||
this->resizeToFitWindow();
|
||||
}
|
||||
|
||||
bool Activity::isTranslucent()
|
||||
{
|
||||
if (!this->contentView)
|
||||
return true;
|
||||
|
||||
return this->contentView->isTranslucent();
|
||||
}
|
||||
|
||||
void Activity::willAppear(bool resetState)
|
||||
{
|
||||
if (this->contentView)
|
||||
this->contentView->willAppear(resetState);
|
||||
}
|
||||
|
||||
void Activity::willDisappear(bool resetState)
|
||||
{
|
||||
if (this->contentView)
|
||||
this->contentView->willDisappear(resetState);
|
||||
}
|
||||
|
||||
void Activity::setInFadeAnimation(bool inFadeAnimation)
|
||||
{
|
||||
if (this->contentView)
|
||||
this->contentView->setInFadeAnimation(inFadeAnimation);
|
||||
}
|
||||
|
||||
void Activity::show(std::function<void(void)> cb, bool animate, float animationDuration)
|
||||
{
|
||||
if (this->contentView)
|
||||
this->contentView->show(cb, animate, animationDuration);
|
||||
}
|
||||
|
||||
void Activity::hide(std::function<void(void)> cb, bool animate, float animationDuration)
|
||||
{
|
||||
if (this->contentView)
|
||||
this->contentView->hide(cb, animate, animationDuration);
|
||||
}
|
||||
|
||||
bool Activity::isHidden()
|
||||
{
|
||||
if (!this->contentView)
|
||||
return false;
|
||||
|
||||
return this->contentView->isHidden();
|
||||
}
|
||||
|
||||
ActionIdentifier Activity::registerAction(std::string hintText, enum ControllerButton button, ActionListener actionListener, bool hidden, enum Sound sound)
|
||||
{
|
||||
if (this->contentView)
|
||||
return this->contentView->registerAction(hintText, button, actionListener, hidden, sound);
|
||||
|
||||
return ACTION_NONE;
|
||||
}
|
||||
|
||||
void Activity::unregisterAction(ActionIdentifier identifier)
|
||||
{
|
||||
if (this->contentView)
|
||||
this->contentView->unregisterAction(identifier);
|
||||
}
|
||||
|
||||
ActionIdentifier Activity::registerExitAction(enum ControllerButton button)
|
||||
{
|
||||
if (this->contentView)
|
||||
return this->contentView->registerAction("brls/hints/exit"_i18n, button, [](View* view) { Application::quit(); return true; });
|
||||
|
||||
return ACTION_NONE;
|
||||
}
|
||||
|
||||
View* Activity::getDefaultFocus()
|
||||
{
|
||||
if (!this->contentView)
|
||||
return nullptr;
|
||||
|
||||
return this->contentView->getDefaultFocus();
|
||||
}
|
||||
|
||||
void Activity::setAlpha(float alpha)
|
||||
{
|
||||
if (this->contentView)
|
||||
this->contentView->setAlpha(alpha);
|
||||
}
|
||||
|
||||
View* Activity::getContentView()
|
||||
{
|
||||
return this->contentView;
|
||||
}
|
||||
|
||||
View* Activity::getView(std::string id)
|
||||
{
|
||||
if (!this->contentView)
|
||||
return nullptr;
|
||||
|
||||
return this->contentView->getView(id);
|
||||
}
|
||||
|
||||
Activity::~Activity()
|
||||
{
|
||||
if (this->contentView)
|
||||
{
|
||||
this->contentView->willDisappear();
|
||||
|
||||
delete this->contentView;
|
||||
this->contentView = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <borealis/core/animation.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
Animatable::Animatable(float value)
|
||||
: currentValue(value)
|
||||
{
|
||||
}
|
||||
|
||||
void Animatable::onReset()
|
||||
{
|
||||
this->tween = tweeny::tween<float>::from(this->currentValue);
|
||||
}
|
||||
|
||||
void Animatable::reset(float initialValue)
|
||||
{
|
||||
this->currentValue = initialValue;
|
||||
FiniteTicking::reset();
|
||||
}
|
||||
|
||||
void Animatable::reset()
|
||||
{
|
||||
FiniteTicking::reset();
|
||||
}
|
||||
|
||||
void Animatable::onRewind()
|
||||
{
|
||||
this->currentValue = this->tween.seek(0);
|
||||
}
|
||||
|
||||
void Animatable::addStep(float targetValue, int32_t duration, EasingFunction easing)
|
||||
{
|
||||
this->tween.to(targetValue).during(duration).via(easing);
|
||||
}
|
||||
|
||||
float Animatable::getProgress()
|
||||
{
|
||||
return this->tween.progress();
|
||||
}
|
||||
|
||||
bool Animatable::onUpdate(retro_time_t delta)
|
||||
{
|
||||
// int32_t for stepping works as long as the app goes faster than 0.00001396983 FPS
|
||||
// (in which case the delta for a frame wraps in an int32_t)
|
||||
this->currentValue = this->tween.step((int32_t)delta);
|
||||
return this->tween.progress() < 1.0f;
|
||||
}
|
||||
|
||||
float Animatable::getValue()
|
||||
{
|
||||
return this->currentValue;
|
||||
}
|
||||
|
||||
Animatable::operator float() const
|
||||
{
|
||||
return this->currentValue;
|
||||
}
|
||||
|
||||
Animatable::operator float()
|
||||
{
|
||||
return this->currentValue;
|
||||
}
|
||||
|
||||
void Animatable::operator=(const float value)
|
||||
{
|
||||
this->reset(value);
|
||||
}
|
||||
|
||||
bool Animatable::operator==(const float value)
|
||||
{
|
||||
return this->currentValue == value;
|
||||
}
|
||||
|
||||
#define HIGHLIGHT_SPEED 125.0f
|
||||
|
||||
static double highlightGradientX = 0;
|
||||
static double highlightGradientY = 0;
|
||||
static double highlightColor = 0;
|
||||
|
||||
void updateHighlightAnimation()
|
||||
{
|
||||
Time currentTime = getCPUTimeUsec() / 1000;
|
||||
|
||||
// Update variables
|
||||
highlightGradientX = (cos((double)currentTime / HIGHLIGHT_SPEED / 3.0) + 1.0) / 2.0;
|
||||
highlightGradientY = (sin((double)currentTime / HIGHLIGHT_SPEED / 3.0) + 1.0) / 2.0;
|
||||
highlightColor = (sin((double)currentTime / HIGHLIGHT_SPEED * 2.0) + 1.0) / 2.0;
|
||||
}
|
||||
|
||||
void getHighlightAnimation(float* gradientX, float* gradientY, float* color)
|
||||
{
|
||||
if (gradientX)
|
||||
*gradientX = (float)highlightGradientX;
|
||||
|
||||
if (gradientY)
|
||||
*gradientY = (float)highlightGradientY;
|
||||
|
||||
if (color)
|
||||
*color = (float)highlightColor;
|
||||
}
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,791 @@
|
||||
/*
|
||||
Copyright 2019-2020 natinusala
|
||||
Copyright 2019 p-sam
|
||||
Copyright 2020 WerWolv
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <yoga/event/event.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <borealis/core/application.hpp>
|
||||
#include <borealis/core/font.hpp>
|
||||
#include <borealis/core/i18n.hpp>
|
||||
#include <borealis/core/time.hpp>
|
||||
#include <borealis/core/util.hpp>
|
||||
#include <borealis/views/button.hpp>
|
||||
#include <borealis/views/header.hpp>
|
||||
#include <borealis/views/image.hpp>
|
||||
#include <borealis/views/rectangle.hpp>
|
||||
#include <borealis/views/sidebar.hpp>
|
||||
#include <borealis/views/tab_frame.hpp>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#ifndef YG_ENABLE_EVENTS
|
||||
#error Please enable Yoga events with the YG_ENABLE_EVENTS define
|
||||
#endif
|
||||
|
||||
#include <chrono>
|
||||
#include <set>
|
||||
#include <thread>
|
||||
|
||||
// Constants used for scaling as well as
|
||||
// creating a window of the right size on PC
|
||||
constexpr uint32_t ORIGINAL_WINDOW_WIDTH = 1280;
|
||||
constexpr uint32_t ORIGINAL_WINDOW_HEIGHT = 720;
|
||||
|
||||
#define BUTTON_REPEAT_DELAY 15
|
||||
#define BUTTON_REPEAT_CADENCY 5
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
bool Application::init()
|
||||
{
|
||||
// Init platform
|
||||
Application::platform = Platform::createPlatform();
|
||||
|
||||
if (!Application::platform)
|
||||
{
|
||||
fatal("Did not find a valid platform");
|
||||
return false;
|
||||
}
|
||||
|
||||
Logger::info("Using platform {}", platform->getName());
|
||||
|
||||
// Init i18n
|
||||
loadTranslations();
|
||||
|
||||
Application::inited = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Application::createWindow(std::string windowTitle)
|
||||
{
|
||||
if (!Application::inited)
|
||||
{
|
||||
fatal("Please call brls::Application::init() before calling brls::Application::createWindow().");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the actual window
|
||||
Application::getPlatform()->createWindow(windowTitle, ORIGINAL_WINDOW_WIDTH, ORIGINAL_WINDOW_HEIGHT);
|
||||
|
||||
// Load most commonly used sounds
|
||||
AudioPlayer* audioPlayer = Application::getAudioPlayer();
|
||||
for (enum Sound sound : {
|
||||
SOUND_FOCUS_CHANGE,
|
||||
SOUND_FOCUS_ERROR,
|
||||
SOUND_CLICK,
|
||||
})
|
||||
audioPlayer->load(sound);
|
||||
|
||||
// Init rng
|
||||
std::srand(std::time(nullptr));
|
||||
|
||||
// Init static variables
|
||||
Application::currentFocus = nullptr;
|
||||
Application::title = windowTitle;
|
||||
|
||||
// Init yoga
|
||||
YGConfig* defaultConfig = YGConfigGetDefault();
|
||||
defaultConfig->useWebDefaults = true;
|
||||
|
||||
yoga::Event::subscribe([](const YGNode& node, yoga::Event::Type eventType, yoga::Event::Data eventData) {
|
||||
View* view = (View*)node.getContext();
|
||||
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
if (eventType == yoga::Event::NodeLayout)
|
||||
view->onLayout();
|
||||
});
|
||||
|
||||
// Load fonts and setup fallbacks
|
||||
Application::platform->getFontLoader()->loadFonts();
|
||||
|
||||
int regular = Application::getFont(FONT_REGULAR);
|
||||
if (regular != FONT_INVALID)
|
||||
{
|
||||
NVGcontext* vg = Application::getNVGContext();
|
||||
|
||||
// Switch icons
|
||||
int switchIcons = Application::getFont(FONT_SWITCH_ICONS);
|
||||
if (switchIcons != FONT_INVALID)
|
||||
nvgAddFallbackFontId(vg, regular, switchIcons);
|
||||
else
|
||||
Logger::warning("Switch icons font was not loaded, icons will not be displayed");
|
||||
|
||||
// Material icons
|
||||
int materialIcons = Application::getFont(FONT_MATERIAL_ICONS);
|
||||
if (materialIcons != FONT_INVALID)
|
||||
nvgAddFallbackFontId(vg, regular, materialIcons);
|
||||
else
|
||||
Logger::warning("Material icons font was not loaded, icons will not be displayed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger::warning("Regular font was not loaded, there will be no text displayed in the app");
|
||||
}
|
||||
|
||||
// Register built-in XML views
|
||||
Application::registerBuiltInXMLViews();
|
||||
}
|
||||
|
||||
bool Application::mainLoop()
|
||||
{
|
||||
static ControllerState oldControllerState = {};
|
||||
|
||||
// Main loop callback
|
||||
if (!Application::platform->mainLoopIteration() || Application::quitRequested)
|
||||
{
|
||||
Application::exit();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Input
|
||||
ControllerState controllerState = {};
|
||||
|
||||
InputManager* inputManager = Application::platform->getInputManager();
|
||||
inputManager->updateControllerState(&controllerState);
|
||||
|
||||
// Trigger controller events
|
||||
bool anyButtonPressed = false;
|
||||
bool repeating = false;
|
||||
static Time buttonPressTime = 0;
|
||||
static int repeatingButtonTimer = 0;
|
||||
|
||||
for (int i = 0; i < _BUTTON_MAX; i++)
|
||||
{
|
||||
if (controllerState.buttons[i])
|
||||
{
|
||||
anyButtonPressed = true;
|
||||
repeating = (repeatingButtonTimer > BUTTON_REPEAT_DELAY && repeatingButtonTimer % BUTTON_REPEAT_CADENCY == 0);
|
||||
|
||||
if (!oldControllerState.buttons[i] || repeating)
|
||||
Application::onControllerButtonPressed((enum ControllerButton)i, repeating);
|
||||
}
|
||||
|
||||
if (controllerState.buttons[i] != oldControllerState.buttons[i])
|
||||
buttonPressTime = repeatingButtonTimer = 0;
|
||||
}
|
||||
|
||||
if (anyButtonPressed && getCPUTimeUsec() - buttonPressTime > 1000)
|
||||
{
|
||||
buttonPressTime = getCPUTimeUsec();
|
||||
repeatingButtonTimer++; // Increased once every ~1ms
|
||||
}
|
||||
|
||||
oldControllerState = controllerState;
|
||||
|
||||
// Animations
|
||||
updateHighlightAnimation();
|
||||
Ticking::updateTickings();
|
||||
|
||||
// Render
|
||||
Application::frame();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform* Application::getPlatform()
|
||||
{
|
||||
return Application::platform;
|
||||
}
|
||||
|
||||
AudioPlayer* Application::getAudioPlayer()
|
||||
{
|
||||
return Application::platform->getAudioPlayer();
|
||||
}
|
||||
|
||||
void Application::quit()
|
||||
{
|
||||
Application::quitRequested = true;
|
||||
}
|
||||
|
||||
void Application::navigate(FocusDirection direction)
|
||||
{
|
||||
View* currentFocus = Application::currentFocus;
|
||||
|
||||
// Do nothing if there is no current focus
|
||||
if (!currentFocus)
|
||||
return;
|
||||
|
||||
View* nextFocus = nullptr;
|
||||
|
||||
// Handle custom navigation routes
|
||||
// By View ptr
|
||||
if (currentFocus->hasCustomNavigationRouteByPtr(direction))
|
||||
{
|
||||
nextFocus = currentFocus->getCustomNavigationRoutePtr(direction);
|
||||
|
||||
if (!nextFocus)
|
||||
Logger::warning("Tried to follow a navigation route that leads to a nullptr view! (from=\"" + currentFocus->describe() + "\", direction=" + std::to_string((int)direction) + ")");
|
||||
}
|
||||
// By ID
|
||||
else if (currentFocus->hasCustomNavigationRouteById(direction))
|
||||
{
|
||||
std::string id = currentFocus->getCustomNavigationRouteId(direction);
|
||||
nextFocus = currentFocus->getNearestView(id);
|
||||
|
||||
if (!nextFocus)
|
||||
Logger::warning("Tried to follow a navigation route that leads to an unknown view ID! (from=\"" + currentFocus->describe() + "\", direction=" + std::to_string((int)direction) + ", targetId=\"" + id + "\")");
|
||||
}
|
||||
// Do nothing if current focus doesn't have a parent
|
||||
// (in which case there is nothing to traverse)
|
||||
else if (currentFocus->hasParent())
|
||||
{
|
||||
// Get next view to focus by traversing the views tree upwards
|
||||
nextFocus = currentFocus->getParent()->getNextFocus(direction, currentFocus);
|
||||
|
||||
while (!nextFocus) // stop when we find a view to focus
|
||||
{
|
||||
if (!currentFocus->hasParent() || !currentFocus->getParent()->hasParent()) // stop when we reach the root of the tree
|
||||
break;
|
||||
|
||||
currentFocus = currentFocus->getParent();
|
||||
nextFocus = currentFocus->getParent()->getNextFocus(direction, currentFocus);
|
||||
}
|
||||
}
|
||||
|
||||
// No view to focus at the end of the traversal: wiggle and return
|
||||
if (!nextFocus)
|
||||
{
|
||||
Application::getAudioPlayer()->play(SOUND_FOCUS_ERROR);
|
||||
Application::currentFocus->shakeHighlight(direction);
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise play sound give it focus
|
||||
enum Sound focusSound = nextFocus->getFocusSound();
|
||||
Application::getAudioPlayer()->play(focusSound);
|
||||
Application::giveFocus(nextFocus);
|
||||
}
|
||||
|
||||
void Application::onControllerButtonPressed(enum ControllerButton button, bool repeating)
|
||||
{
|
||||
if (Application::blockInputsTokens != 0)
|
||||
{
|
||||
Logger::debug("{} button press blocked (tokens={})", button, Application::blockInputsTokens);
|
||||
return;
|
||||
}
|
||||
|
||||
if (repeating && Application::repetitionOldFocus == Application::currentFocus)
|
||||
return;
|
||||
|
||||
Application::repetitionOldFocus = Application::currentFocus;
|
||||
|
||||
// Actions
|
||||
if (Application::handleAction(button))
|
||||
return;
|
||||
|
||||
// Navigation
|
||||
// Only navigate if the button hasn't been consumed by an action
|
||||
// (allows overriding DPAD buttons using actions)
|
||||
switch (button)
|
||||
{
|
||||
case BUTTON_DOWN:
|
||||
Application::navigate(FocusDirection::DOWN);
|
||||
break;
|
||||
case BUTTON_UP:
|
||||
Application::navigate(FocusDirection::UP);
|
||||
break;
|
||||
case BUTTON_LEFT:
|
||||
Application::navigate(FocusDirection::LEFT);
|
||||
break;
|
||||
case BUTTON_RIGHT:
|
||||
Application::navigate(FocusDirection::RIGHT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
View* Application::getCurrentFocus()
|
||||
{
|
||||
return Application::currentFocus;
|
||||
}
|
||||
|
||||
bool Application::handleAction(char button)
|
||||
{
|
||||
if (Application::activitiesStack.empty())
|
||||
return false;
|
||||
|
||||
View* hintParent = Application::currentFocus;
|
||||
std::set<enum ControllerButton> consumedButtons;
|
||||
|
||||
if (!hintParent)
|
||||
hintParent = Application::activitiesStack[Application::activitiesStack.size() - 1]->getContentView();
|
||||
|
||||
while (hintParent)
|
||||
{
|
||||
for (auto& action : hintParent->getActions())
|
||||
{
|
||||
if (action.button != static_cast<enum ControllerButton>(button))
|
||||
continue;
|
||||
|
||||
if (consumedButtons.find(action.button) != consumedButtons.end())
|
||||
continue;
|
||||
|
||||
if (action.available)
|
||||
{
|
||||
if (action.actionListener(hintParent))
|
||||
{
|
||||
if (button == BUTTON_A)
|
||||
hintParent->playClickAnimation();
|
||||
|
||||
Application::getAudioPlayer()->play(action.sound);
|
||||
|
||||
consumedButtons.insert(action.button);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hintParent = hintParent->getParent();
|
||||
}
|
||||
|
||||
// Only play the error sound if action is a click
|
||||
if (button == BUTTON_A && consumedButtons.empty())
|
||||
Application::getAudioPlayer()->play(SOUND_CLICK_ERROR);
|
||||
|
||||
return !consumedButtons.empty();
|
||||
}
|
||||
|
||||
void Application::frame()
|
||||
{
|
||||
VideoContext* videoContext = Application::platform->getVideoContext();
|
||||
|
||||
// Frame context
|
||||
FrameContext frameContext = FrameContext();
|
||||
|
||||
frameContext.pixelRatio = (float)Application::windowWidth / (float)Application::windowHeight;
|
||||
frameContext.vg = Application::getNVGContext();
|
||||
frameContext.fontStash = &Application::fontStash;
|
||||
frameContext.theme = Application::getTheme();
|
||||
|
||||
// Begin frame and clear
|
||||
NVGcolor backgroundColor = frameContext.theme["brls/background"];
|
||||
videoContext->beginFrame();
|
||||
videoContext->clear(backgroundColor);
|
||||
|
||||
nvgBeginFrame(Application::getNVGContext(), Application::windowWidth, Application::windowHeight, frameContext.pixelRatio);
|
||||
nvgScale(Application::getNVGContext(), Application::windowScale, Application::windowScale);
|
||||
|
||||
std::vector<View*> viewsToDraw;
|
||||
|
||||
// Draw all activities in the stack
|
||||
// until we find one that's not translucent
|
||||
for (size_t i = 0; i < Application::activitiesStack.size(); i++)
|
||||
{
|
||||
Activity* activity = Application::activitiesStack[Application::activitiesStack.size() - 1 - i];
|
||||
|
||||
View* view = activity->getContentView();
|
||||
if (view)
|
||||
viewsToDraw.push_back(view);
|
||||
|
||||
if (!activity->isTranslucent())
|
||||
break;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < viewsToDraw.size(); i++)
|
||||
{
|
||||
View* view = viewsToDraw[viewsToDraw.size() - 1 - i];
|
||||
view->frame(&frameContext);
|
||||
}
|
||||
|
||||
// End frame
|
||||
nvgResetTransform(Application::getNVGContext()); // scale
|
||||
nvgEndFrame(Application::getNVGContext());
|
||||
|
||||
Application::platform->getVideoContext()->endFrame();
|
||||
}
|
||||
|
||||
void Application::exit()
|
||||
{
|
||||
Logger::info("Exiting...");
|
||||
|
||||
Application::clear();
|
||||
|
||||
delete Application::platform;
|
||||
}
|
||||
|
||||
void Application::setDisplayFramerate(bool enabled)
|
||||
{
|
||||
// To be implemented
|
||||
}
|
||||
|
||||
void Application::toggleFramerateDisplay()
|
||||
{
|
||||
// To be implemented (call setDisplayFramerate)
|
||||
}
|
||||
|
||||
ActionIdentifier Application::registerFPSToggleAction(Activity* activity)
|
||||
{
|
||||
return activity->registerAction(
|
||||
"FPS", BUTTON_BACK, [](View* view) { Application::toggleFramerateDisplay(); return true; }, true);
|
||||
}
|
||||
|
||||
void Application::setGlobalQuit(bool enabled)
|
||||
{
|
||||
Application::globalQuitEnabled = enabled;
|
||||
for (auto it = Application::activitiesStack.begin(); it != Application::activitiesStack.end(); ++it)
|
||||
{
|
||||
if (enabled)
|
||||
Application::gloablQuitIdentifier = (*it)->registerExitAction();
|
||||
else
|
||||
(*it)->unregisterAction(Application::gloablQuitIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
void Application::setGlobalFPSToggle(bool enabled)
|
||||
{
|
||||
Application::globalFPSToggleEnabled = enabled;
|
||||
for (auto it = Application::activitiesStack.begin(); it != Application::activitiesStack.end(); ++it)
|
||||
{
|
||||
if (enabled)
|
||||
Application::gloablFPSToggleIdentifier = Application::registerFPSToggleAction(*it);
|
||||
else
|
||||
(*it)->unregisterAction(Application::gloablFPSToggleIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
void Application::notify(std::string text)
|
||||
{
|
||||
// To be implemented
|
||||
}
|
||||
|
||||
void Application::giveFocus(View* view)
|
||||
{
|
||||
View* oldFocus = Application::currentFocus;
|
||||
View* newFocus = view ? view->getDefaultFocus() : nullptr;
|
||||
|
||||
if (oldFocus != newFocus)
|
||||
{
|
||||
if (oldFocus)
|
||||
oldFocus->onFocusLost();
|
||||
|
||||
Application::currentFocus = newFocus;
|
||||
Application::globalFocusChangeEvent.fire(newFocus);
|
||||
|
||||
if (newFocus)
|
||||
{
|
||||
newFocus->onFocusGained();
|
||||
Logger::debug("Giving focus to {}", newFocus->describe());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Application::popActivity(TransitionAnimation animation, std::function<void(void)> cb)
|
||||
{
|
||||
if (Application::activitiesStack.size() <= 1) // never pop the first activity
|
||||
return;
|
||||
|
||||
Application::blockInputs();
|
||||
|
||||
Activity* last = Application::activitiesStack[Application::activitiesStack.size() - 1];
|
||||
last->willDisappear(true);
|
||||
|
||||
last->setInFadeAnimation(true);
|
||||
|
||||
bool wait = animation == TransitionAnimation::FADE; // wait for the new activity animation to be done before showing the old one?
|
||||
|
||||
// Hide animation (and show previous activity, if any)
|
||||
last->hide([last, animation, wait, cb] {
|
||||
last->setInFadeAnimation(false);
|
||||
Application::activitiesStack.pop_back();
|
||||
delete last;
|
||||
|
||||
// Animate the old activity once the new one
|
||||
// has ended its animation
|
||||
if (Application::activitiesStack.size() > 0 && wait)
|
||||
{
|
||||
Activity* newLast = Application::activitiesStack[Application::activitiesStack.size() - 1];
|
||||
|
||||
if (newLast->isHidden())
|
||||
{
|
||||
newLast->willAppear(false);
|
||||
newLast->show(cb, true, newLast->getShowAnimationDuration(animation));
|
||||
}
|
||||
else
|
||||
{
|
||||
cb();
|
||||
}
|
||||
}
|
||||
|
||||
Application::unblockInputs();
|
||||
},
|
||||
true, last->getShowAnimationDuration(animation));
|
||||
|
||||
// Animate the old activity immediately
|
||||
if (!wait && Application::activitiesStack.size() > 1)
|
||||
{
|
||||
Activity* toShow = Application::activitiesStack[Application::activitiesStack.size() - 2];
|
||||
toShow->willAppear(false);
|
||||
toShow->show(cb, true, toShow->getShowAnimationDuration(animation));
|
||||
}
|
||||
|
||||
// Focus
|
||||
if (Application::focusStack.size() > 0)
|
||||
{
|
||||
View* newFocus = Application::focusStack[Application::focusStack.size() - 1];
|
||||
|
||||
Logger::debug("Giving focus to {}, and removing it from the focus stack", newFocus->describe());
|
||||
|
||||
Application::giveFocus(newFocus);
|
||||
Application::focusStack.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::pushActivity(Activity* activity, TransitionAnimation animation)
|
||||
{
|
||||
Application::blockInputs();
|
||||
|
||||
// Create the activity content view
|
||||
activity->setContentView(activity->createContentView());
|
||||
activity->onContentAvailable();
|
||||
|
||||
// Call hide() on the previous activity in the stack if no
|
||||
// activities are translucent, then call show() once the animation ends
|
||||
Activity* last = nullptr;
|
||||
if (Application::activitiesStack.size() > 0)
|
||||
last = Application::activitiesStack[Application::activitiesStack.size() - 1];
|
||||
|
||||
bool fadeOut = last && !last->isTranslucent() && !activity->isTranslucent(); // play the fade out animation?
|
||||
bool wait = animation == TransitionAnimation::FADE; // wait for the old activity animation to be done before showing the new one?
|
||||
|
||||
if (Application::globalQuitEnabled)
|
||||
Application::gloablQuitIdentifier = activity->registerExitAction();
|
||||
|
||||
if (Application::globalFPSToggleEnabled)
|
||||
Application::gloablFPSToggleIdentifier = Application::registerFPSToggleAction(activity);
|
||||
|
||||
// Fade out animation
|
||||
if (fadeOut)
|
||||
{
|
||||
activity->setInFadeAnimation(true); // set the new activity translucent until the fade out animation is done playing
|
||||
|
||||
// Animate the new activity directly
|
||||
if (!wait)
|
||||
{
|
||||
activity->show([] {
|
||||
Application::unblockInputs();
|
||||
},
|
||||
true, activity->getShowAnimationDuration(animation));
|
||||
}
|
||||
|
||||
last->hide([animation, wait] {
|
||||
Activity* newLast = Application::activitiesStack[Application::activitiesStack.size() - 1];
|
||||
newLast->setInFadeAnimation(false);
|
||||
|
||||
// Animate the new activity once the old one
|
||||
// has ended its animation
|
||||
if (wait)
|
||||
newLast->show([] { Application::unblockInputs(); }, true, newLast->getShowAnimationDuration(animation));
|
||||
},
|
||||
true, last->getShowAnimationDuration(animation));
|
||||
}
|
||||
|
||||
activity->resizeToFitWindow();
|
||||
|
||||
if (!fadeOut)
|
||||
activity->show([] { Application::unblockInputs(); }, true, activity->getShowAnimationDuration(animation));
|
||||
else
|
||||
activity->setAlpha(0.0f);
|
||||
|
||||
// Focus
|
||||
if (Application::activitiesStack.size() > 0 && Application::currentFocus != nullptr)
|
||||
{
|
||||
Logger::debug("Pushing {} to the focus stack", Application::currentFocus->describe());
|
||||
Application::focusStack.push_back(Application::currentFocus);
|
||||
}
|
||||
|
||||
// Layout and prepare activity
|
||||
activity->willAppear(true);
|
||||
Application::giveFocus(activity->getDefaultFocus());
|
||||
|
||||
// And push it
|
||||
Application::activitiesStack.push_back(activity);
|
||||
}
|
||||
|
||||
void Application::clear()
|
||||
{
|
||||
for (Activity* activity : Application::activitiesStack)
|
||||
{
|
||||
activity->willDisappear(true);
|
||||
delete activity;
|
||||
}
|
||||
|
||||
Application::activitiesStack.clear();
|
||||
}
|
||||
|
||||
Theme Application::getTheme()
|
||||
{
|
||||
if (Application::getThemeVariant() == ThemeVariant::LIGHT)
|
||||
return getLightTheme();
|
||||
else
|
||||
return getDarkTheme();
|
||||
}
|
||||
|
||||
ThemeVariant Application::getThemeVariant()
|
||||
{
|
||||
return Application::platform->getThemeVariant();
|
||||
}
|
||||
|
||||
std::string Application::getLocale()
|
||||
{
|
||||
return Application::getPlatform()->getLocale();
|
||||
}
|
||||
|
||||
bool Application::loadFontFromFile(std::string fontName, std::string filePath)
|
||||
{
|
||||
int handle = nvgCreateFont(Application::getNVGContext(), fontName.c_str(), filePath.c_str());
|
||||
|
||||
if (handle == FONT_INVALID)
|
||||
{
|
||||
Logger::warning("Could not load the font \"{}\"", fontName);
|
||||
return false;
|
||||
}
|
||||
|
||||
Application::fontStash[fontName] = handle;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Application::loadFontFromMemory(std::string fontName, void* address, size_t size, bool freeData)
|
||||
{
|
||||
int handle = nvgCreateFontMem(Application::getNVGContext(), fontName.c_str(), (unsigned char*)address, size, freeData);
|
||||
|
||||
if (handle == FONT_INVALID)
|
||||
{
|
||||
Logger::warning("Could not load the font \"{}\"", fontName);
|
||||
return false;
|
||||
}
|
||||
|
||||
Application::fontStash[fontName] = handle;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Application::crash(std::string text)
|
||||
{
|
||||
// To be implemented
|
||||
}
|
||||
|
||||
void Application::blockInputs()
|
||||
{
|
||||
Application::blockInputsTokens += 1;
|
||||
Logger::debug("Adding an inputs block token (tokens={})", Application::blockInputsTokens);
|
||||
}
|
||||
|
||||
void Application::unblockInputs()
|
||||
{
|
||||
if (Application::blockInputsTokens > 0)
|
||||
Application::blockInputsTokens -= 1;
|
||||
|
||||
Logger::debug("Removing an inputs block token (tokens={})", Application::blockInputsTokens);
|
||||
}
|
||||
|
||||
NVGcontext* Application::getNVGContext()
|
||||
{
|
||||
return Application::platform->getVideoContext()->getNVGContext();
|
||||
}
|
||||
|
||||
void Application::setCommonFooter(std::string footer)
|
||||
{
|
||||
Application::commonFooter = footer;
|
||||
}
|
||||
|
||||
std::string* Application::getCommonFooter()
|
||||
{
|
||||
return &Application::commonFooter;
|
||||
}
|
||||
|
||||
void Application::onWindowResized(int width, int height)
|
||||
{
|
||||
Application::windowWidth = width;
|
||||
Application::windowHeight = height;
|
||||
|
||||
// Rescale UI
|
||||
Application::windowScale = (float)width / (float)ORIGINAL_WINDOW_WIDTH;
|
||||
|
||||
float contentHeight = ((float)height / (Application::windowScale * (float)ORIGINAL_WINDOW_HEIGHT)) * (float)ORIGINAL_WINDOW_HEIGHT;
|
||||
|
||||
Application::contentWidth = ORIGINAL_WINDOW_WIDTH;
|
||||
Application::contentHeight = (unsigned)roundf(contentHeight);
|
||||
|
||||
Logger::info("Window size changed to {}x{}", width, height);
|
||||
Logger::info("New scale factor is {}", Application::windowScale);
|
||||
|
||||
// Trigger a layout
|
||||
Logger::debug("Layout triggered");
|
||||
|
||||
for (Activity* activity : Application::activitiesStack)
|
||||
activity->onWindowSizeChanged();
|
||||
}
|
||||
|
||||
std::string Application::getTitle()
|
||||
{
|
||||
return Application::title;
|
||||
}
|
||||
|
||||
GenericEvent* Application::getGlobalFocusChangeEvent()
|
||||
{
|
||||
return &Application::globalFocusChangeEvent;
|
||||
}
|
||||
|
||||
VoidEvent* Application::getGlobalHintsUpdateEvent()
|
||||
{
|
||||
return &Application::globalHintsUpdateEvent;
|
||||
}
|
||||
|
||||
int Application::getFont(std::string fontName)
|
||||
{
|
||||
if (Application::fontStash.count(fontName) == 0)
|
||||
return FONT_INVALID;
|
||||
|
||||
return Application::fontStash[fontName];
|
||||
}
|
||||
|
||||
bool Application::XMLViewsRegisterContains(std::string name)
|
||||
{
|
||||
return Application::xmlViewsRegister.count(name) > 0;
|
||||
}
|
||||
|
||||
XMLViewCreator Application::getXMLViewCreator(std::string name)
|
||||
{
|
||||
return Application::xmlViewsRegister[name];
|
||||
}
|
||||
|
||||
void Application::registerBuiltInXMLViews()
|
||||
{
|
||||
Application::registerXMLView("brls:Box", Box::create);
|
||||
Application::registerXMLView("brls:Rectangle", Rectangle::create);
|
||||
Application::registerXMLView("brls:AppletFrame", AppletFrame::create);
|
||||
Application::registerXMLView("brls:Label", Label::create);
|
||||
Application::registerXMLView("brls:TabFrame", TabFrame::create);
|
||||
Application::registerXMLView("brls:Sidebar", Sidebar::create);
|
||||
Application::registerXMLView("brls:Header", Header::create);
|
||||
Application::registerXMLView("brls:ScrollingFrame", ScrollingFrame::create);
|
||||
Application::registerXMLView("brls:Image", Image::create);
|
||||
Application::registerXMLView("brls:Padding", Padding::create);
|
||||
Application::registerXMLView("brls:Button", Button::create);
|
||||
}
|
||||
|
||||
void Application::registerXMLView(std::string name, XMLViewCreator creator)
|
||||
{
|
||||
Application::xmlViewsRegister[name] = creator;
|
||||
}
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <borealis/core/bind.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
ViewNotFoundException::ViewNotFoundException(View* owner, std::string searchedId)
|
||||
{
|
||||
this->errorMessage = "Cannot find view with ID \"" + searchedId + "\" in owner view " + owner->describe();
|
||||
}
|
||||
|
||||
ViewNotFoundException::ViewNotFoundException(Activity* owner, std::string searchedId)
|
||||
{
|
||||
this->errorMessage = "Cannot find view with ID \"" + searchedId + "\" in given owner activity";
|
||||
}
|
||||
|
||||
const char* ViewNotFoundException::what() const noexcept
|
||||
{
|
||||
return this->errorMessage.c_str();
|
||||
}
|
||||
|
||||
} // namespace brls
|
||||
593
Source/Benchmark-Toolbox/lib/borealis/library/lib/core/box.cpp
Normal file
593
Source/Benchmark-Toolbox/lib/borealis/library/lib/core/box.cpp
Normal file
@@ -0,0 +1,593 @@
|
||||
/*
|
||||
Copyright 2020-2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <tinyxml2.h>
|
||||
|
||||
#include <borealis/core/application.hpp>
|
||||
#include <borealis/core/box.hpp>
|
||||
#include <borealis/core/util.hpp>
|
||||
#include <cmath>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
static YGFlexDirection getYGFlexDirection(Axis axis)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
default:
|
||||
case Axis::ROW:
|
||||
return YGFlexDirectionRow;
|
||||
case Axis::COLUMN:
|
||||
return YGFlexDirectionColumn;
|
||||
}
|
||||
}
|
||||
|
||||
Box::Box(Axis axis)
|
||||
: axis(axis)
|
||||
{
|
||||
YGNodeStyleSetFlexDirection(this->ygNode, getYGFlexDirection(axis));
|
||||
|
||||
// no need to invalidate if the box is empty and is not attached to any parent
|
||||
|
||||
// Register XML attributes
|
||||
BRLS_REGISTER_ENUM_XML_ATTRIBUTE(
|
||||
"axis", Axis, this->setAxis,
|
||||
{
|
||||
{ "row", Axis::ROW },
|
||||
{ "column", Axis::COLUMN },
|
||||
});
|
||||
|
||||
BRLS_REGISTER_ENUM_XML_ATTRIBUTE(
|
||||
"direction", Direction, this->setDirection,
|
||||
{
|
||||
{ "inherit", Direction::INHERIT },
|
||||
{ "leftToRight", Direction::LEFT_TO_RIGHT },
|
||||
{ "rightToLeft", Direction::RIGHT_TO_LEFT },
|
||||
});
|
||||
|
||||
BRLS_REGISTER_ENUM_XML_ATTRIBUTE(
|
||||
"justifyContent", JustifyContent, this->setJustifyContent,
|
||||
{
|
||||
{ "flexStart", JustifyContent::FLEX_START },
|
||||
{ "center", JustifyContent::CENTER },
|
||||
{ "flexEnd", JustifyContent::FLEX_END },
|
||||
{ "spaceBetween", JustifyContent::SPACE_BETWEEN },
|
||||
{ "spaceAround", JustifyContent::SPACE_AROUND },
|
||||
{ "spaceEvenly", JustifyContent::SPACE_EVENLY },
|
||||
});
|
||||
|
||||
BRLS_REGISTER_ENUM_XML_ATTRIBUTE(
|
||||
"alignItems", AlignItems, this->setAlignItems,
|
||||
{
|
||||
{ "auto", AlignItems::AUTO },
|
||||
{ "flexStart", AlignItems::FLEX_START },
|
||||
{ "center", AlignItems::CENTER },
|
||||
{ "flexEnd", AlignItems::FLEX_END },
|
||||
{ "stretch", AlignItems::STRETCH },
|
||||
{ "baseline", AlignItems::BASELINE },
|
||||
{ "spaceBetween", AlignItems::SPACE_BETWEEN },
|
||||
{ "spaceAround", AlignItems::SPACE_AROUND },
|
||||
});
|
||||
|
||||
// Padding
|
||||
this->registerFloatXMLAttribute("paddingTop", [this](float value) {
|
||||
this->setPaddingTop(value);
|
||||
});
|
||||
|
||||
this->registerFloatXMLAttribute("paddingRight", [this](float value) {
|
||||
this->setPaddingRight(value);
|
||||
});
|
||||
|
||||
this->registerFloatXMLAttribute("paddingBottom", [this](float value) {
|
||||
this->setPaddingBottom(value);
|
||||
});
|
||||
|
||||
this->registerFloatXMLAttribute("paddingLeft", [this](float value) {
|
||||
this->setPaddingLeft(value);
|
||||
});
|
||||
|
||||
this->registerFloatXMLAttribute("padding", [this](float value) {
|
||||
this->setPadding(value);
|
||||
});
|
||||
}
|
||||
|
||||
Box::Box()
|
||||
: Box(Axis::ROW)
|
||||
{
|
||||
// Empty ctor for XML
|
||||
}
|
||||
|
||||
void Box::getCullingBounds(float* top, float* right, float* bottom, float* left)
|
||||
{
|
||||
*top = this->getY();
|
||||
*left = this->getX();
|
||||
*right = *left + this->getWidth();
|
||||
*bottom = *top + this->getHeight();
|
||||
}
|
||||
|
||||
void Box::draw(NVGcontext* vg, float x, float y, float width, float height, Style style, FrameContext* ctx)
|
||||
{
|
||||
for (View* child : this->children)
|
||||
{
|
||||
// Ensure that the child is in bounds of all parents before drawing it
|
||||
// Only do that check for leaf views, as nested boxes will do that check themselves
|
||||
if (!dynamic_cast<Box*>(child) && child->isCulled())
|
||||
{
|
||||
float childTop = child->getY();
|
||||
float childLeft = child->getX();
|
||||
float childRight = childLeft + child->getWidth();
|
||||
float childBottom = childTop + child->getHeight();
|
||||
|
||||
bool draw = true;
|
||||
|
||||
for (Box* bounds = this; bounds != nullptr; bounds = bounds->getParent())
|
||||
{
|
||||
float top, right, bottom, left;
|
||||
bounds->getCullingBounds(&top, &right, &bottom, &left);
|
||||
|
||||
if (
|
||||
childBottom < top || // too high
|
||||
childRight < left || // too far left
|
||||
childLeft > right || // too far right
|
||||
childTop > bottom // too low
|
||||
)
|
||||
{
|
||||
draw = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!draw)
|
||||
continue;
|
||||
}
|
||||
|
||||
child->frame(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void Box::addView(View* view)
|
||||
{
|
||||
size_t position = YGNodeGetChildCount(this->ygNode);
|
||||
this->addView(view, position);
|
||||
}
|
||||
|
||||
void Box::addView(View* view, size_t position)
|
||||
{
|
||||
// Add the view to our children and YGNode
|
||||
this->children.insert(this->children.begin() + position, view);
|
||||
|
||||
if (!view->isDetached())
|
||||
YGNodeInsertChild(this->ygNode, view->getYGNode(), position);
|
||||
|
||||
// Allocate and set parent userdata
|
||||
size_t* userdata = (size_t*)malloc(sizeof(size_t));
|
||||
*userdata = position;
|
||||
|
||||
view->setParent(this, userdata);
|
||||
|
||||
// Layout and events
|
||||
this->invalidate();
|
||||
view->willAppear();
|
||||
}
|
||||
|
||||
void Box::removeView(View* view)
|
||||
{
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
// Find the index of the view
|
||||
size_t index;
|
||||
bool found = false;
|
||||
|
||||
for (size_t i = 0; i < this->children.size(); i++)
|
||||
{
|
||||
View* child = this->children[i];
|
||||
|
||||
if (child == view)
|
||||
{
|
||||
found = true;
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
return;
|
||||
|
||||
// Remove it
|
||||
YGNodeRemoveChild(this->ygNode, view->getYGNode());
|
||||
this->children.erase(this->children.begin() + index);
|
||||
|
||||
view->willDisappear(true);
|
||||
delete view;
|
||||
|
||||
this->invalidate();
|
||||
}
|
||||
|
||||
void Box::onFocusGained()
|
||||
{
|
||||
View::onFocusGained();
|
||||
|
||||
for (View* child : this->children)
|
||||
child->onParentFocusGained(this);
|
||||
}
|
||||
|
||||
void Box::onFocusLost()
|
||||
{
|
||||
View::onFocusLost();
|
||||
|
||||
for (View* child : this->children)
|
||||
child->onParentFocusLost(this);
|
||||
}
|
||||
|
||||
void Box::onParentFocusGained(View* focusedView)
|
||||
{
|
||||
View::onParentFocusGained(focusedView);
|
||||
|
||||
for (View* child : this->children)
|
||||
child->onParentFocusGained(focusedView);
|
||||
}
|
||||
|
||||
void Box::onParentFocusLost(View* focusedView)
|
||||
{
|
||||
View::onParentFocusLost(focusedView);
|
||||
|
||||
for (View* child : this->children)
|
||||
child->onParentFocusLost(focusedView);
|
||||
}
|
||||
|
||||
void Box::setPadding(float top, float right, float bottom, float left)
|
||||
{
|
||||
YGNodeStyleSetPadding(this->ygNode, YGEdgeTop, top);
|
||||
YGNodeStyleSetPadding(this->ygNode, YGEdgeRight, right);
|
||||
YGNodeStyleSetPadding(this->ygNode, YGEdgeBottom, bottom);
|
||||
YGNodeStyleSetPadding(this->ygNode, YGEdgeLeft, left);
|
||||
|
||||
this->invalidate();
|
||||
}
|
||||
|
||||
void Box::setPadding(float padding)
|
||||
{
|
||||
this->setPadding(padding, padding, padding, padding);
|
||||
}
|
||||
|
||||
void Box::setPaddingTop(float top)
|
||||
{
|
||||
YGNodeStyleSetPadding(this->ygNode, YGEdgeTop, top);
|
||||
this->invalidate();
|
||||
}
|
||||
|
||||
void Box::setPaddingRight(float right)
|
||||
{
|
||||
YGNodeStyleSetPadding(this->ygNode, YGEdgeRight, right);
|
||||
this->invalidate();
|
||||
}
|
||||
|
||||
void Box::setPaddingBottom(float bottom)
|
||||
{
|
||||
YGNodeStyleSetPadding(this->ygNode, YGEdgeBottom, bottom);
|
||||
this->invalidate();
|
||||
}
|
||||
|
||||
void Box::setPaddingLeft(float left)
|
||||
{
|
||||
YGNodeStyleSetPadding(this->ygNode, YGEdgeLeft, left);
|
||||
this->invalidate();
|
||||
}
|
||||
|
||||
View* Box::getDefaultFocus()
|
||||
{
|
||||
// Focus ourself first
|
||||
if (this->isFocusable())
|
||||
return this;
|
||||
|
||||
// Then try default focus
|
||||
if (this->defaultFocusedIndex < this->children.size())
|
||||
{
|
||||
View* newFocus = this->children[this->defaultFocusedIndex]->getDefaultFocus();
|
||||
|
||||
if (newFocus)
|
||||
return newFocus;
|
||||
}
|
||||
|
||||
// Fallback to finding the first focusable view
|
||||
for (size_t i = 0; i < this->children.size(); i++)
|
||||
{
|
||||
View* newFocus = this->children[i]->getDefaultFocus();
|
||||
|
||||
if (newFocus)
|
||||
return newFocus;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
View* Box::getNextFocus(FocusDirection direction, View* currentView)
|
||||
{
|
||||
void* parentUserData = currentView->getParentUserData();
|
||||
|
||||
// Return nullptr immediately if focus direction mismatches the box axis (clang-format refuses to split it in multiple lines...)
|
||||
if ((this->axis == Axis::ROW && direction != FocusDirection::LEFT && direction != FocusDirection::RIGHT) || (this->axis == Axis::COLUMN && direction != FocusDirection::UP && direction != FocusDirection::DOWN))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Traverse the children
|
||||
size_t offset = 1; // which way we are going in the children list
|
||||
|
||||
if ((this->axis == Axis::ROW && direction == FocusDirection::LEFT) || (this->axis == Axis::COLUMN && direction == FocusDirection::UP))
|
||||
{
|
||||
offset = -1;
|
||||
}
|
||||
|
||||
size_t currentFocusIndex = *((size_t*)parentUserData) + offset;
|
||||
View* currentFocus = nullptr;
|
||||
|
||||
while (!currentFocus && currentFocusIndex >= 0 && currentFocusIndex < this->children.size())
|
||||
{
|
||||
currentFocus = this->children[currentFocusIndex]->getDefaultFocus();
|
||||
currentFocusIndex += offset;
|
||||
}
|
||||
|
||||
return currentFocus;
|
||||
}
|
||||
|
||||
void Box::willAppear(bool resetState)
|
||||
{
|
||||
for (View* child : this->children)
|
||||
child->willAppear(resetState);
|
||||
}
|
||||
|
||||
void Box::willDisappear(bool resetState)
|
||||
{
|
||||
for (View* child : this->children)
|
||||
child->willDisappear(resetState);
|
||||
}
|
||||
|
||||
void Box::onWindowSizeChanged()
|
||||
{
|
||||
for (View* child : this->children)
|
||||
child->onWindowSizeChanged();
|
||||
}
|
||||
|
||||
std::vector<View*>& Box::getChildren()
|
||||
{
|
||||
return this->children;
|
||||
}
|
||||
|
||||
void Box::inflateFromXMLString(std::string xml)
|
||||
{
|
||||
// Load XML
|
||||
tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument();
|
||||
tinyxml2::XMLError error = document->Parse(xml.c_str());
|
||||
|
||||
this->bindXMLDocument(document);
|
||||
|
||||
if (error != tinyxml2::XMLError::XML_SUCCESS)
|
||||
fatal("Invalid XML when inflating " + this->describe() + ": error " + std::to_string(error));
|
||||
|
||||
tinyxml2::XMLElement* element = document->RootElement();
|
||||
|
||||
if (!element)
|
||||
fatal("Invalid XML: no element found");
|
||||
|
||||
return Box::inflateFromXMLElement(element);
|
||||
}
|
||||
|
||||
void Box::inflateFromXMLRes(std::string name)
|
||||
{
|
||||
return Box::inflateFromXMLFile(std::string(BRLS_RESOURCES) + name);
|
||||
}
|
||||
|
||||
void Box::inflateFromXMLFile(std::string path)
|
||||
{
|
||||
// Load XML
|
||||
tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument();
|
||||
tinyxml2::XMLError error = document->LoadFile(path.c_str());
|
||||
|
||||
this->bindXMLDocument(document);
|
||||
|
||||
if (error != tinyxml2::XMLError::XML_SUCCESS)
|
||||
fatal("Invalid XML when inflating " + this->describe() + ": error " + std::to_string(error));
|
||||
|
||||
tinyxml2::XMLElement* element = document->RootElement();
|
||||
|
||||
if (!element)
|
||||
fatal("Invalid XML: no element found");
|
||||
|
||||
return Box::inflateFromXMLElement(element);
|
||||
}
|
||||
|
||||
void Box::inflateFromXMLElement(tinyxml2::XMLElement* element)
|
||||
{
|
||||
// Ensure element is a Box
|
||||
if (std::string(element->Name()) != "brls:Box")
|
||||
fatal("First XML element is " + std::string(element->Name()) + ", expected brls:Box");
|
||||
|
||||
// Apply attributes
|
||||
this->applyXMLAttributes(element);
|
||||
|
||||
// Handle children
|
||||
for (tinyxml2::XMLElement* child = element->FirstChildElement(); child != nullptr; child = child->NextSiblingElement())
|
||||
this->addView(View::createFromXMLElement(child)); // don't call handleXMLElement because this method is for user XMLs
|
||||
}
|
||||
|
||||
void Box::handleXMLElement(tinyxml2::XMLElement* element)
|
||||
{
|
||||
this->addView(View::createFromXMLElement(element));
|
||||
}
|
||||
|
||||
void Box::setAxis(Axis axis)
|
||||
{
|
||||
YGNodeStyleSetFlexDirection(this->ygNode, getYGFlexDirection(axis));
|
||||
this->axis = axis;
|
||||
this->invalidate();
|
||||
}
|
||||
|
||||
void Box::setDirection(Direction direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case Direction::INHERIT:
|
||||
YGNodeStyleSetDirection(this->ygNode, YGDirectionInherit);
|
||||
break;
|
||||
case Direction::LEFT_TO_RIGHT:
|
||||
YGNodeStyleSetDirection(this->ygNode, YGDirectionLTR);
|
||||
break;
|
||||
case Direction::RIGHT_TO_LEFT:
|
||||
YGNodeStyleSetDirection(this->ygNode, YGDirectionRTL);
|
||||
break;
|
||||
}
|
||||
|
||||
this->invalidate();
|
||||
}
|
||||
|
||||
void Box::setJustifyContent(JustifyContent justify)
|
||||
{
|
||||
switch (justify)
|
||||
{
|
||||
case JustifyContent::FLEX_START:
|
||||
YGNodeStyleSetJustifyContent(this->ygNode, YGJustifyFlexStart);
|
||||
break;
|
||||
case JustifyContent::CENTER:
|
||||
YGNodeStyleSetJustifyContent(this->ygNode, YGJustifyCenter);
|
||||
break;
|
||||
case JustifyContent::FLEX_END:
|
||||
YGNodeStyleSetJustifyContent(this->ygNode, YGJustifyFlexEnd);
|
||||
break;
|
||||
case JustifyContent::SPACE_BETWEEN:
|
||||
YGNodeStyleSetJustifyContent(this->ygNode, YGJustifySpaceBetween);
|
||||
break;
|
||||
case JustifyContent::SPACE_AROUND:
|
||||
YGNodeStyleSetJustifyContent(this->ygNode, YGJustifySpaceAround);
|
||||
break;
|
||||
case JustifyContent::SPACE_EVENLY:
|
||||
YGNodeStyleSetJustifyContent(this->ygNode, YGJustifySpaceEvenly);
|
||||
break;
|
||||
}
|
||||
|
||||
this->invalidate();
|
||||
}
|
||||
|
||||
void Box::setAlignItems(AlignItems alignment)
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case AlignItems::AUTO:
|
||||
YGNodeStyleSetAlignItems(this->ygNode, YGAlignAuto);
|
||||
break;
|
||||
case AlignItems::FLEX_START:
|
||||
YGNodeStyleSetAlignItems(this->ygNode, YGAlignFlexStart);
|
||||
break;
|
||||
case AlignItems::CENTER:
|
||||
YGNodeStyleSetAlignItems(this->ygNode, YGAlignCenter);
|
||||
break;
|
||||
case AlignItems::FLEX_END:
|
||||
YGNodeStyleSetAlignItems(this->ygNode, YGAlignFlexEnd);
|
||||
break;
|
||||
case AlignItems::STRETCH:
|
||||
YGNodeStyleSetAlignItems(this->ygNode, YGAlignStretch);
|
||||
break;
|
||||
case AlignItems::BASELINE:
|
||||
YGNodeStyleSetAlignItems(this->ygNode, YGAlignBaseline);
|
||||
break;
|
||||
case AlignItems::SPACE_BETWEEN:
|
||||
YGNodeStyleSetAlignItems(this->ygNode, YGAlignSpaceBetween);
|
||||
break;
|
||||
case AlignItems::SPACE_AROUND:
|
||||
YGNodeStyleSetAlignItems(this->ygNode, YGAlignSpaceAround);
|
||||
break;
|
||||
}
|
||||
|
||||
this->invalidate();
|
||||
}
|
||||
|
||||
View* Box::getView(std::string id)
|
||||
{
|
||||
if (id == this->id)
|
||||
return this;
|
||||
|
||||
for (View* child : this->children)
|
||||
{
|
||||
View* result = child->getView(id);
|
||||
|
||||
if (result)
|
||||
return result;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Box::applyXMLAttribute(std::string name, std::string value)
|
||||
{
|
||||
if (this->forwardedAttributes.count(name) > 0)
|
||||
{
|
||||
std::pair<std::string, View*> pair = this->forwardedAttributes[name];
|
||||
return pair.second->applyXMLAttribute(pair.first, value);
|
||||
}
|
||||
|
||||
return View::applyXMLAttribute(name, value);
|
||||
}
|
||||
|
||||
void Box::forwardXMLAttribute(std::string attributeName, View* target)
|
||||
{
|
||||
this->forwardXMLAttribute(attributeName, target, attributeName);
|
||||
}
|
||||
|
||||
void Box::forwardXMLAttribute(std::string attributeName, View* target, std::string targetAttributeName)
|
||||
{
|
||||
if (!target->isXMLAttributeValid(targetAttributeName))
|
||||
fatal("Error when forwarding \"" + attributeName + "\" of \"" + this->describe() + "\": attribute \"" + targetAttributeName + "\" is not a XML valid attribute for view \"" + target->describe() + "\"");
|
||||
|
||||
if (this->forwardedAttributes.count(attributeName) > 0)
|
||||
fatal("Error when forwarding \"" + attributeName + "\" of \"" + this->describe() + "\": the same attribute cannot be forwarded twice");
|
||||
|
||||
this->forwardedAttributes[attributeName] = std::make_pair(targetAttributeName, target);
|
||||
}
|
||||
|
||||
void Box::onChildFocusGained(View* directChild, View* focusedView)
|
||||
{
|
||||
if (this->hasParent())
|
||||
this->getParent()->onChildFocusGained(this, focusedView);
|
||||
}
|
||||
|
||||
void Box::onChildFocusLost(View* directChild, View* focusedView)
|
||||
{
|
||||
if (this->hasParent())
|
||||
this->getParent()->onChildFocusLost(this, focusedView);
|
||||
}
|
||||
|
||||
View* Box::create()
|
||||
{
|
||||
return new Box();
|
||||
}
|
||||
|
||||
Padding::Padding()
|
||||
{
|
||||
this->setGrow(1.0f);
|
||||
}
|
||||
|
||||
void Padding::draw(NVGcontext* vg, float x, float y, float width, float height, Style style, FrameContext* ctx)
|
||||
{
|
||||
}
|
||||
|
||||
View* Padding::create()
|
||||
{
|
||||
return new Padding();
|
||||
}
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <borealis/core/application.hpp>
|
||||
#include <borealis/core/assets.hpp>
|
||||
#include <borealis/core/font.hpp>
|
||||
|
||||
#define MATERIAL_ICONS_PATH BRLS_ASSET("material/MaterialIcons-Regular.ttf")
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
bool FontLoader::loadFontFromFile(std::string fontName, std::string filePath)
|
||||
{
|
||||
if (access(filePath.c_str(), F_OK) != -1)
|
||||
{
|
||||
bool loaded = Application::loadFontFromFile(fontName, filePath);
|
||||
|
||||
if (!loaded)
|
||||
{
|
||||
Logger::error("{} font was located but couldn't be loaded", fontName);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Logger::error("\"{}\" font couldn't be located (searched at \"{}\")", fontName, filePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FontLoader::loadMaterialFromResources()
|
||||
{
|
||||
return this->loadFontFromFile(FONT_MATERIAL_ICONS, MATERIAL_ICONS_PATH);
|
||||
}
|
||||
|
||||
} // namespace brls
|
||||
142
Source/Benchmark-Toolbox/lib/borealis/library/lib/core/i18n.cpp
Normal file
142
Source/Benchmark-Toolbox/lib/borealis/library/lib/core/i18n.cpp
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
Copyright 2020-2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <borealis/core/application.hpp>
|
||||
#include <borealis/core/assets.hpp>
|
||||
#include <borealis/core/i18n.hpp>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
static nlohmann::json defaultLocale = {};
|
||||
static nlohmann::json currentLocale = {};
|
||||
|
||||
static bool endsWith(const std::string& str, const std::string& suffix)
|
||||
{
|
||||
// if I wanted to write my own endsWith I would have made borealis in PHP
|
||||
return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix);
|
||||
}
|
||||
|
||||
static void loadLocale(std::string locale, nlohmann::json* target)
|
||||
{
|
||||
std::string localePath = BRLS_ASSET("i18n/" + locale);
|
||||
|
||||
if (!std::filesystem::exists(localePath))
|
||||
{
|
||||
Logger::error("Cannot load locale {}: directory {} doesn't exist", locale, localePath);
|
||||
return;
|
||||
}
|
||||
else if (!std::filesystem::is_directory(localePath))
|
||||
{
|
||||
Logger::error("Cannot load locale {}: {} isn't a directory", locale, localePath);
|
||||
return;
|
||||
}
|
||||
|
||||
// Iterate over all JSON files in the directory
|
||||
for (const std::filesystem::directory_entry& entry : std::filesystem::directory_iterator(localePath))
|
||||
{
|
||||
if (entry.is_directory())
|
||||
continue;
|
||||
|
||||
std::string name = entry.path().filename().string();
|
||||
|
||||
if (!endsWith(name, ".json"))
|
||||
continue;
|
||||
|
||||
std::string path = entry.path().string();
|
||||
|
||||
nlohmann::json strings;
|
||||
|
||||
std::ifstream jsonStream;
|
||||
jsonStream.open(path);
|
||||
|
||||
try
|
||||
{
|
||||
jsonStream >> strings;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
Logger::error("Error while loading \"{}\": {}", path, e.what());
|
||||
}
|
||||
|
||||
jsonStream.close();
|
||||
|
||||
(*target)[name.substr(0, name.length() - 5)] = strings;
|
||||
}
|
||||
}
|
||||
|
||||
void loadTranslations()
|
||||
{
|
||||
loadLocale(LOCALE_DEFAULT, &defaultLocale);
|
||||
|
||||
std::string currentLocaleName = Application::getLocale();
|
||||
if (currentLocaleName != LOCALE_DEFAULT)
|
||||
loadLocale(currentLocaleName, ¤tLocale);
|
||||
}
|
||||
|
||||
namespace internal
|
||||
{
|
||||
std::string getRawStr(std::string stringName)
|
||||
{
|
||||
nlohmann::json::json_pointer pointer;
|
||||
|
||||
try
|
||||
{
|
||||
pointer = nlohmann::json::json_pointer("/" + stringName);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
Logger::error("Error while getting string \"{}\": {}", stringName, e.what());
|
||||
return stringName;
|
||||
}
|
||||
|
||||
// First look for translated string in current locale
|
||||
try
|
||||
{
|
||||
return currentLocale[pointer].get<std::string>();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
// Then look for default locale
|
||||
try
|
||||
{
|
||||
return defaultLocale[pointer].get<std::string>();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
// Fallback to returning the string name
|
||||
return stringName;
|
||||
}
|
||||
} // namespace internal
|
||||
|
||||
inline namespace literals
|
||||
{
|
||||
std::string operator"" _i18n(const char* str, size_t len)
|
||||
{
|
||||
return internal::getRawStr(std::string(str, len));
|
||||
}
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
Copyright 2019 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <fmt/core.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <borealis/core/logger.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
void Logger::setLogLevel(LogLevel newLogLevel)
|
||||
{
|
||||
Logger::logLevel = newLogLevel;
|
||||
}
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <borealis/core/platform.hpp>
|
||||
|
||||
#ifdef __SWITCH__
|
||||
#include <borealis/platforms/switch/switch_platform.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef __GLFW__
|
||||
#include <borealis/platforms/glfw/glfw_platform.hpp>
|
||||
#endif
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
Platform* Platform::createPlatform()
|
||||
{
|
||||
#if defined(__SWITCH__)
|
||||
return new SwitchPlatform();
|
||||
#elif defined(__GLFW__)
|
||||
return new GLFWPlatform();
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace brls
|
||||
388
Source/Benchmark-Toolbox/lib/borealis/library/lib/core/style.cpp
Normal file
388
Source/Benchmark-Toolbox/lib/borealis/library/lib/core/style.cpp
Normal file
@@ -0,0 +1,388 @@
|
||||
/*
|
||||
Copyright 2019 natinusala
|
||||
Copyright 2019 WerWolv
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <borealis/core/style.hpp>
|
||||
#include <borealis/core/util.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
static StyleValues styleValues = {
|
||||
// Animations
|
||||
{ "brls/animations/show", 250.0f },
|
||||
{ "brls/animations/show_slide", 125.0f },
|
||||
|
||||
{ "brls/animations/highlight", 100.0f },
|
||||
{ "brls/animations/highlight_shake", 15.0f },
|
||||
|
||||
{ "brls/animations/label_scrolling_timer", 1500.0f },
|
||||
{ "brls/animations/label_scrolling_speed", 0.05f },
|
||||
|
||||
// Highlight
|
||||
{ "brls/highlight/stroke_width", 5.0f },
|
||||
{ "brls/highlight/corner_radius", 0.5f },
|
||||
{ "brls/highlight/shadow_width", 2.0f },
|
||||
{ "brls/highlight/shadow_offset", 10.0f },
|
||||
{ "brls/highlight/shadow_feather", 10.0f },
|
||||
{ "brls/highlight/shadow_opacity", 128.0f },
|
||||
|
||||
// AppletFrame
|
||||
{ "brls/applet_frame/padding_sides", 30.0f },
|
||||
|
||||
{ "brls/applet_frame/header_height", 88.0f },
|
||||
{ "brls/applet_frame/header_padding_top_bottom", 15.0f },
|
||||
{ "brls/applet_frame/header_padding_sides", 35.0f },
|
||||
{ "brls/applet_frame/header_image_title_spacing", 18.0f },
|
||||
{ "brls/applet_frame/header_title_font_size", 28.0f },
|
||||
{ "brls/applet_frame/header_title_top_offset", 7.0f },
|
||||
|
||||
{ "brls/applet_frame/footer_height", 73.0f },
|
||||
{ "brls/applet_frame/footer_padding_top_bottom", 20.0f },
|
||||
{ "brls/applet_frame/footer_padding_sides", 25.0f },
|
||||
|
||||
// TabFrame
|
||||
{ "brls/tab_frame/sidebar_width", 410.0f },
|
||||
{ "brls/tab_frame/content_padding_top_bottom", 42.0f }, // unused by the library, here for users
|
||||
{ "brls/tab_frame/content_padding_sides", 60.0f }, // unused by the library, here for users
|
||||
|
||||
// Sidebar
|
||||
{ "brls/sidebar/border_height", 16.0f },
|
||||
{ "brls/sidebar/padding_top", 32.0f },
|
||||
{ "brls/sidebar/padding_bottom", 47.0f },
|
||||
{ "brls/sidebar/padding_left", 80.0f },
|
||||
{ "brls/sidebar/padding_right", 30.0f },
|
||||
{ "brls/sidebar/item_height", 70.0f },
|
||||
{ "brls/sidebar/item_accent_margin_top_bottom", 9.0f },
|
||||
{ "brls/sidebar/item_accent_margin_sides", 8.0f },
|
||||
{ "brls/sidebar/item_accent_rect_width", 4.0f },
|
||||
{ "brls/sidebar/item_font_size", 22.0f },
|
||||
{ "brls/sidebar/separator_height", 30.0f },
|
||||
|
||||
// Label
|
||||
{ "brls/label/default_font_size", 20.0f },
|
||||
{ "brls/label/default_line_height", 1.65f },
|
||||
{ "brls/label/scrolling_animation_spacing", 50.0f },
|
||||
{ "brls/label/highlight_padding", 2.0f },
|
||||
|
||||
// Header
|
||||
{ "brls/header/padding_top_bottom", 11.0f },
|
||||
{ "brls/header/padding_right", 11.0f },
|
||||
{ "brls/header/rectangle_width", 5.0f },
|
||||
{ "brls/header/rectangle_height", 22.0f },
|
||||
{ "brls/header/rectangle_margin", 10.0f },
|
||||
{ "brls/header/font_size", 18.0f },
|
||||
|
||||
// Button
|
||||
{ "brls/button/padding_top_bottom", 15.0f },
|
||||
{ "brls/button/padding_sides", 25.0f },
|
||||
{ "brls/button/corner_radius", 5.0f },
|
||||
{ "brls/button/text_size", 18.0f },
|
||||
{ "brls/button/primary_highlight_padding", 2.0f },
|
||||
{ "brls/button/border_thickness", 2.0f },
|
||||
|
||||
// Generic shadow
|
||||
{ "brls/shadow/width", 2.0f },
|
||||
{ "brls/shadow/feather", 10.0f },
|
||||
{ "brls/shadow/opacity", 63.75f },
|
||||
{ "brls/shadow/offset", 10.0f },
|
||||
};
|
||||
|
||||
static Style style(&styleValues);
|
||||
|
||||
Style getStyle()
|
||||
{
|
||||
return style;
|
||||
}
|
||||
|
||||
StyleValues::StyleValues(std::initializer_list<std::pair<std::string, float>> list)
|
||||
{
|
||||
for (std::pair<std::string, float> metric : list)
|
||||
this->values.insert(metric);
|
||||
}
|
||||
|
||||
void StyleValues::addMetric(std::string name, float metric)
|
||||
{
|
||||
this->values.insert(std::make_pair(name, metric));
|
||||
}
|
||||
|
||||
float StyleValues::getMetric(std::string name)
|
||||
{
|
||||
if (this->values.count(name) == 0)
|
||||
fatal("Unknown style metric \"" + name + "\"");
|
||||
|
||||
return this->values[name];
|
||||
}
|
||||
|
||||
Style::Style(StyleValues* values)
|
||||
: values(values)
|
||||
{
|
||||
}
|
||||
|
||||
float Style::getMetric(std::string name)
|
||||
{
|
||||
return this->values->getMetric(name);
|
||||
}
|
||||
|
||||
void Style::addMetric(std::string name, float metric)
|
||||
{
|
||||
return this->values->addMetric(name, metric);
|
||||
}
|
||||
|
||||
float Style::operator[](std::string name)
|
||||
{
|
||||
return this->getMetric(name);
|
||||
}
|
||||
|
||||
/*
|
||||
HorizonStyle::HorizonStyle()
|
||||
{
|
||||
this->AppletFrame = {
|
||||
.headerHeightRegular = ,
|
||||
.headerHeightPopup = 129,
|
||||
|
||||
.imageLeftPadding = 64,
|
||||
.imageTopPadding = 20,
|
||||
.imageSize = 52,
|
||||
.separatorSpacing = 30,
|
||||
|
||||
.titleSize = 28,
|
||||
.titleStart = 130,
|
||||
.titleOffset = 5,
|
||||
|
||||
.footerTextSize = 22,
|
||||
.footerTextSpacing = 30,
|
||||
|
||||
.slideAnimation = 20
|
||||
};
|
||||
|
||||
this->Highlight = {
|
||||
|
||||
};
|
||||
|
||||
this->Background = {
|
||||
.sidebarBorderHeight = 16
|
||||
};
|
||||
|
||||
this->Sidebar = {
|
||||
.width = 410,
|
||||
.spacing = 0,
|
||||
|
||||
.marginLeft = 88,
|
||||
.marginRight = 30,
|
||||
.marginTop = 40,
|
||||
.marginBottom = 40,
|
||||
|
||||
.Item = {
|
||||
.height = 70,
|
||||
.textSize = 22,
|
||||
.padding = 9,
|
||||
|
||||
.textOffsetX = 14,
|
||||
.activeMarkerWidth = 4,
|
||||
},
|
||||
|
||||
.Separator = { .height = 28 }
|
||||
};
|
||||
|
||||
this->List = {
|
||||
.marginLeftRight = 60,
|
||||
.marginTopBottom = 42,
|
||||
.spacing = 61,
|
||||
|
||||
.Item = {
|
||||
.height = 69, // offset by 1 to have the highlight hide the separator
|
||||
.heightWithSubLabel = 99,
|
||||
.valueSize = 20,
|
||||
.padding = 15,
|
||||
.thumbnailPadding = 11,
|
||||
|
||||
.descriptionIndent = 20,
|
||||
.descriptionSpacing = 16,
|
||||
|
||||
.indent = 40,
|
||||
|
||||
.selectRadius = 15 }
|
||||
};
|
||||
|
||||
this->Label = {
|
||||
.regularFontSize = 20,
|
||||
.mediumFontSize = 18,
|
||||
.smallFontSize = 16,
|
||||
.descriptionFontSize = 16,
|
||||
.crashFontSize = 24,
|
||||
.buttonFontSize = 24,
|
||||
.listItemFontSize = 24,
|
||||
.notificationFontSize = 18,
|
||||
.dialogFontSize = 24,
|
||||
.hintFontSize = 22,
|
||||
|
||||
.lineHeight = 1.65f,
|
||||
.notificationLineHeight = 1.35f
|
||||
};
|
||||
|
||||
this->CrashFrame = {
|
||||
.labelWidth = 0.60f,
|
||||
.boxStrokeWidth = 5,
|
||||
.boxSize = 64,
|
||||
.boxSpacing = 90,
|
||||
.buttonWidth = 356,
|
||||
.buttonHeight = 60,
|
||||
.buttonSpacing = 47
|
||||
};
|
||||
|
||||
this->Button = {
|
||||
.cornerRadius = 5.0f,
|
||||
|
||||
.highlightInset = 2,
|
||||
|
||||
.shadowWidth = 2.0f,
|
||||
.shadowFeather = 10.0f,
|
||||
.shadowOpacity = 63.75f,
|
||||
.shadowOffset = 10.0f,
|
||||
|
||||
.borderedBorderThickness = 2,
|
||||
.regularBorderThickness = 2
|
||||
};
|
||||
|
||||
this->TableRow = {
|
||||
.headerHeight = 60,
|
||||
.headerTextSize = 22,
|
||||
|
||||
.bodyHeight = 38,
|
||||
.bodyIndent = 40,
|
||||
.bodyTextSize = 18,
|
||||
|
||||
.padding = 15
|
||||
};
|
||||
|
||||
this->Dropdown = {
|
||||
.listWidth = 720,
|
||||
.listPadding = 40,
|
||||
|
||||
.listItemHeight = 60,
|
||||
.listItemTextSize = 20,
|
||||
|
||||
.headerHeight = 71,
|
||||
.headerFontSize = 24,
|
||||
.headerPadding = 70
|
||||
};
|
||||
|
||||
this->PopupFrame = {
|
||||
.edgePadding = 120,
|
||||
.separatorSpacing = 30,
|
||||
.footerHeight = 73,
|
||||
.imageLeftPadding = 60,
|
||||
.imageTopPadding = 17,
|
||||
.imageSize = 100,
|
||||
.contentWidth = 1040,
|
||||
.contentHeight = 518,
|
||||
|
||||
.headerTextLeftPadding = 180,
|
||||
.headerTextTopPadding = 64,
|
||||
|
||||
.subTitleLeftPadding = 182,
|
||||
.subTitleTopPadding = 95,
|
||||
.subTitleSpacing = 20,
|
||||
|
||||
.subTitleSeparatorLeftPadding = 280,
|
||||
.subTitleSeparatorTopPadding = 92,
|
||||
.subTitleSeparatorHeight = 20,
|
||||
|
||||
.headerFontSize = 28,
|
||||
.subTitleFontSize = 16
|
||||
};
|
||||
|
||||
this->StagedAppletFrame = {
|
||||
.progressIndicatorSpacing = 4,
|
||||
.progressIndicatorRadiusUnselected = 5 - 1, // minus half of border width
|
||||
.progressIndicatorRadiusSelected = 8,
|
||||
.progressIndicatorBorderWidth = 2
|
||||
};
|
||||
|
||||
this->ProgressSpinner = {
|
||||
.centerGapMultiplier = 0.2f,
|
||||
.barWidthMultiplier = 0.06f
|
||||
};
|
||||
|
||||
this->ProgressDisplay = {
|
||||
.percentageLabelWidth = 70
|
||||
};
|
||||
|
||||
this->Header = {
|
||||
.height = 44,
|
||||
.padding = 11,
|
||||
|
||||
.rectangleWidth = 5,
|
||||
|
||||
.fontSize = 18
|
||||
};
|
||||
|
||||
this->FramerateCounter = {
|
||||
.width = 125,
|
||||
.height = 26
|
||||
};
|
||||
|
||||
this->ThumbnailSidebar = {
|
||||
.marginLeftRight = 109, // used for the image only = (410 - 192) / 2, image size is 192*192 with a 410px wide sidebar
|
||||
.marginTopBottom = 47,
|
||||
|
||||
.buttonHeight = 70,
|
||||
.buttonMargin = 60
|
||||
};
|
||||
|
||||
this->AnimationDuration = {
|
||||
.showSlide = 125,
|
||||
|
||||
.highlight = 100,
|
||||
.shake = 15,
|
||||
|
||||
.collapse = 100,
|
||||
|
||||
.progress = 1000,
|
||||
|
||||
.notificationTimeout = 4000
|
||||
};
|
||||
|
||||
this->Notification = {
|
||||
.width = 280,
|
||||
.padding = 16,
|
||||
|
||||
.slideAnimation = 40
|
||||
};
|
||||
|
||||
this->Dialog = {
|
||||
.width = 770,
|
||||
.height = 220,
|
||||
|
||||
.paddingTopBottom = 65,
|
||||
.paddingLeftRight = 115,
|
||||
|
||||
.cornerRadius = 5.0f,
|
||||
|
||||
.buttonHeight = 72,
|
||||
.buttonSeparatorHeight = 2,
|
||||
|
||||
.shadowWidth = 2.0f,
|
||||
.shadowFeather = 10.0f,
|
||||
.shadowOpacity = 63.75f,
|
||||
.shadowOffset = 10.0f
|
||||
};
|
||||
}
|
||||
*/
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <borealis/core/task.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
RepeatingTask::RepeatingTask(Time period)
|
||||
{
|
||||
this->setPeriod(period);
|
||||
|
||||
this->setCallback([this]() {
|
||||
this->run();
|
||||
});
|
||||
}
|
||||
|
||||
void RepeatingTask::start()
|
||||
{
|
||||
RepeatingTimer::start();
|
||||
}
|
||||
|
||||
void RepeatingTask::stop()
|
||||
{
|
||||
RepeatingTimer::stop();
|
||||
}
|
||||
|
||||
} // namespace brls
|
||||
163
Source/Benchmark-Toolbox/lib/borealis/library/lib/core/theme.cpp
Normal file
163
Source/Benchmark-Toolbox/lib/borealis/library/lib/core/theme.cpp
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
Copyright 2019 natinusala
|
||||
Copyright 2019 p-sam
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <borealis/core/theme.hpp>
|
||||
#include <borealis/core/util.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
static ThemeValues lightThemeValues = {
|
||||
// Generic values
|
||||
{ "brls/background", nvgRGB(235, 235, 235) },
|
||||
{ "brls/text", nvgRGB(45, 45, 45) },
|
||||
{ "brls/backdrop", nvgRGBA(0, 0, 0, 178) },
|
||||
{ "brls/click_pulse", nvgRGBA(13, 182, 213, 38) }, // same as highlight color1 with different opacity
|
||||
|
||||
// Highlight
|
||||
{ "brls/highlight/background", nvgRGB(252, 255, 248) },
|
||||
{ "brls/highlight/color1", nvgRGB(13, 182, 213) },
|
||||
{ "brls/highlight/color2", nvgRGB(80, 239, 217) },
|
||||
|
||||
// AppletFrame
|
||||
{ "brls/applet_frame/separator", nvgRGB(45, 45, 45) },
|
||||
|
||||
// Sidebar
|
||||
{ "brls/sidebar/background", nvgRGB(240, 240, 240) },
|
||||
{ "brls/sidebar/active_item", nvgRGB(49, 79, 235) },
|
||||
{ "brls/sidebar/separator", nvgRGB(208, 208, 208) },
|
||||
|
||||
// Header
|
||||
{ "brls/header/border", nvgRGB(207, 207, 207) },
|
||||
{ "brls/header/rectangle", nvgRGB(127, 127, 127) },
|
||||
{ "brls/header/subtitle", nvgRGB(140, 140, 140) },
|
||||
|
||||
// Button
|
||||
{ "brls/button/primary_enabled_background", nvgRGB(50, 79, 241) },
|
||||
{ "brls/button/primary_disabled_background", nvgRGB(201, 201, 209) },
|
||||
{ "brls/button/primary_enabled_text", nvgRGB(255, 255, 255) },
|
||||
{ "brls/button/primary_disabled_text", nvgRGB(220, 220, 228) },
|
||||
|
||||
{ "brls/button/default_enabled_background", nvgRGB(255, 255, 255) },
|
||||
{ "brls/button/default_disabled_background", nvgRGB(255, 255, 255) },
|
||||
{ "brls/button/default_enabled_text", nvgRGB(45, 45, 45) },
|
||||
{ "brls/button/default_disabled_text", nvgRGB(45, 45, 45) },
|
||||
|
||||
{ "brls/button/highlight_enabled_text", nvgRGB(49, 79, 235) },
|
||||
{ "brls/button/highlight_disabled_text", nvgRGB(49, 79, 235) },
|
||||
|
||||
{ "brls/button/enabled_border_color", nvgRGB(45, 45, 45) },
|
||||
{ "brls/button/disabled_border_color", nvgRGB(45, 45, 45) },
|
||||
};
|
||||
|
||||
static ThemeValues darkThemeValues = {
|
||||
// Generic values
|
||||
{ "brls/background", nvgRGB(45, 45, 45) },
|
||||
{ "brls/text", nvgRGB(255, 255, 255) },
|
||||
{ "brls/backdrop", nvgRGBA(0, 0, 0, 178) },
|
||||
{ "brls/click_pulse", nvgRGBA(25, 138, 198, 38) }, // same as highlight color1 with different opacity
|
||||
|
||||
// Highlight
|
||||
{ "brls/highlight/background", nvgRGB(31, 34, 39) },
|
||||
{ "brls/highlight/color1", nvgRGB(25, 138, 198) },
|
||||
{ "brls/highlight/color2", nvgRGB(137, 241, 242) },
|
||||
|
||||
// AppletFrame
|
||||
{ "brls/applet_frame/separator", nvgRGB(255, 255, 255) },
|
||||
|
||||
// Sidebar
|
||||
{ "brls/sidebar/background", nvgRGB(50, 50, 50) },
|
||||
{ "brls/sidebar/active_item", nvgRGB(0, 255, 204) },
|
||||
{ "brls/sidebar/separator", nvgRGB(81, 81, 81) },
|
||||
|
||||
// Header
|
||||
{ "brls/header/border", nvgRGB(78, 78, 78) },
|
||||
{ "brls/header/rectangle", nvgRGB(160, 160, 160) },
|
||||
{ "brls/header/subtitle", nvgRGB(163, 163, 163) },
|
||||
|
||||
// Button
|
||||
{ "brls/button/primary_enabled_background", nvgRGB(1, 255, 201) },
|
||||
{ "brls/button/primary_disabled_background", nvgRGB(83, 87, 86) },
|
||||
{ "brls/button/primary_enabled_text", nvgRGB(52, 41, 55) },
|
||||
{ "brls/button/primary_disabled_text", nvgRGB(71, 75, 74) },
|
||||
|
||||
{ "brls/button/default_enabled_background", nvgRGB(80, 80, 80) },
|
||||
{ "brls/button/default_disabled_background", nvgRGB(80, 80, 80) },
|
||||
{ "brls/button/default_enabled_text", nvgRGB(255, 255, 255) },
|
||||
{ "brls/button/default_disabled_text", nvgRGB(255, 255, 255) },
|
||||
|
||||
{ "brls/button/highlight_enabled_text", nvgRGB(7, 247, 198) },
|
||||
{ "brls/button/highlight_disabled_text", nvgRGB(7, 247, 198) },
|
||||
|
||||
{ "brls/button/enabled_border_color", nvgRGB(255, 255, 255) },
|
||||
{ "brls/button/disabled_border_color", nvgRGB(255, 255, 255) },
|
||||
};
|
||||
|
||||
static Theme lightTheme(&lightThemeValues);
|
||||
static Theme darkTheme(&darkThemeValues);
|
||||
|
||||
ThemeValues::ThemeValues(std::initializer_list<std::pair<std::string, NVGcolor>> list)
|
||||
{
|
||||
for (std::pair<std::string, NVGcolor> color : list)
|
||||
this->values.insert(color);
|
||||
}
|
||||
|
||||
void ThemeValues::addColor(std::string name, NVGcolor color)
|
||||
{
|
||||
this->values.insert(std::make_pair(name, color));
|
||||
}
|
||||
|
||||
NVGcolor ThemeValues::getColor(std::string name)
|
||||
{
|
||||
if (this->values.count(name) == 0)
|
||||
fatal("Unknown theme value \"" + name + "\"");
|
||||
|
||||
return this->values[name];
|
||||
}
|
||||
|
||||
Theme::Theme(ThemeValues* values)
|
||||
: values(values)
|
||||
{
|
||||
}
|
||||
|
||||
NVGcolor Theme::getColor(std::string name)
|
||||
{
|
||||
return this->values->getColor(name);
|
||||
}
|
||||
|
||||
void Theme::addColor(std::string name, NVGcolor color)
|
||||
{
|
||||
return this->values->addColor(name, color);
|
||||
}
|
||||
|
||||
NVGcolor Theme::operator[](std::string name)
|
||||
{
|
||||
return this->getColor(name);
|
||||
}
|
||||
|
||||
Theme getLightTheme()
|
||||
{
|
||||
return lightTheme;
|
||||
}
|
||||
|
||||
Theme getDarkTheme()
|
||||
{
|
||||
return darkTheme;
|
||||
}
|
||||
|
||||
} // namespace brls
|
||||
117
Source/Benchmark-Toolbox/lib/borealis/library/lib/core/time.cpp
Normal file
117
Source/Benchmark-Toolbox/lib/borealis/library/lib/core/time.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <borealis/core/time.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
void Ticking::updateTickings()
|
||||
{
|
||||
// Update time
|
||||
static Time previousTime = 0;
|
||||
|
||||
Time currentTime = getCPUTimeUsec() / 1000;
|
||||
Time delta = previousTime == 0 ? 0 : currentTime - previousTime;
|
||||
|
||||
previousTime = currentTime;
|
||||
|
||||
// Update every running ticking, kill them and execute cb if they are finished
|
||||
// We have to clone the running tickings list to avoid altering it while
|
||||
// in the for loop (so if another ticking is started in a callback or during onUpdate())
|
||||
std::vector<Ticking*> tickings(Ticking::runningTickings);
|
||||
|
||||
for (Ticking* ticking : tickings)
|
||||
{
|
||||
bool run = ticking->onUpdate(delta);
|
||||
|
||||
ticking->tickCallback();
|
||||
|
||||
if (!run)
|
||||
ticking->stop(true); // will remove the ticking from Ticking::runningTickings
|
||||
}
|
||||
}
|
||||
|
||||
void Ticking::start()
|
||||
{
|
||||
if (this->running)
|
||||
return;
|
||||
|
||||
Ticking::runningTickings.push_back(this);
|
||||
|
||||
this->running = true;
|
||||
|
||||
this->onStart();
|
||||
}
|
||||
|
||||
void Ticking::stop()
|
||||
{
|
||||
this->stop(false);
|
||||
}
|
||||
|
||||
void Ticking::stop(bool finished)
|
||||
{
|
||||
if (!this->running)
|
||||
return;
|
||||
|
||||
for (size_t i = 0; i < Ticking::runningTickings.size(); i++)
|
||||
{
|
||||
if (Ticking::runningTickings[i] == this)
|
||||
{
|
||||
Ticking::runningTickings.erase(Ticking::runningTickings.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this->running = false;
|
||||
|
||||
this->endCallback(finished);
|
||||
|
||||
this->onStop();
|
||||
}
|
||||
|
||||
void Ticking::setEndCallback(TickingEndCallback endCallback)
|
||||
{
|
||||
this->endCallback = endCallback;
|
||||
}
|
||||
|
||||
void Ticking::setTickCallback(TickingTickCallback tickCallback)
|
||||
{
|
||||
this->tickCallback = tickCallback;
|
||||
}
|
||||
|
||||
bool Ticking::isRunning()
|
||||
{
|
||||
return this->running;
|
||||
}
|
||||
|
||||
Ticking::~Ticking()
|
||||
{
|
||||
this->stop();
|
||||
}
|
||||
|
||||
void FiniteTicking::rewind()
|
||||
{
|
||||
this->onRewind();
|
||||
}
|
||||
|
||||
void FiniteTicking::reset()
|
||||
{
|
||||
this->stop();
|
||||
this->onReset();
|
||||
}
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <borealis/core/timer.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
void Timer::start(Time duration)
|
||||
{
|
||||
this->duration = duration;
|
||||
this->start();
|
||||
}
|
||||
|
||||
void Timer::start()
|
||||
{
|
||||
Ticking::start();
|
||||
}
|
||||
|
||||
void Timer::setDuration(Time duration)
|
||||
{
|
||||
this->duration = duration;
|
||||
}
|
||||
|
||||
void Timer::onStart()
|
||||
{
|
||||
this->progress = 0;
|
||||
}
|
||||
|
||||
bool Timer::onUpdate(Time delta)
|
||||
{
|
||||
this->progress += delta;
|
||||
return this->progress < this->duration;
|
||||
}
|
||||
|
||||
void Timer::onReset()
|
||||
{
|
||||
this->progress = 0;
|
||||
this->duration = 0;
|
||||
}
|
||||
|
||||
void Timer::onRewind()
|
||||
{
|
||||
this->progress = 0;
|
||||
}
|
||||
|
||||
void RepeatingTimer::start(Time period)
|
||||
{
|
||||
this->period = period;
|
||||
this->start();
|
||||
}
|
||||
|
||||
void RepeatingTimer::start()
|
||||
{
|
||||
Ticking::start();
|
||||
}
|
||||
|
||||
void RepeatingTimer::setPeriod(Time period)
|
||||
{
|
||||
this->period = period;
|
||||
}
|
||||
|
||||
void RepeatingTimer::setCallback(TickingGenericCallback callback)
|
||||
{
|
||||
this->callback = callback;
|
||||
}
|
||||
|
||||
void RepeatingTimer::onStart()
|
||||
{
|
||||
this->progress = 0;
|
||||
}
|
||||
|
||||
bool RepeatingTimer::onUpdate(Time delta)
|
||||
{
|
||||
this->progress += delta;
|
||||
|
||||
if (this->progress >= this->period)
|
||||
{
|
||||
this->callback();
|
||||
this->progress = 0;
|
||||
}
|
||||
|
||||
return true; // never stop
|
||||
}
|
||||
|
||||
} // namespace brls
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright 2021 natinusala
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <borealis/core/util.hpp>
|
||||
|
||||
namespace brls
|
||||
{
|
||||
|
||||
[[noreturn]] void fatal(std::string message)
|
||||
{
|
||||
brls::Logger::error("Fatal error: {}", message);
|
||||
throw std::logic_error(message);
|
||||
}
|
||||
|
||||
} // namespace brls
|
||||
2035
Source/Benchmark-Toolbox/lib/borealis/library/lib/core/view.cpp
Normal file
2035
Source/Benchmark-Toolbox/lib/borealis/library/lib/core/view.cpp
Normal file
File diff suppressed because it is too large
Load Diff
8
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/.clang-format
vendored
Normal file
8
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/.clang-format
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Run manually to reformat a file:
|
||||
# clang-format -i --style=file <file>
|
||||
Language: Cpp
|
||||
BasedOnStyle: Google
|
||||
IndentPPDirectives: AfterHash
|
||||
IndentCaseLabels: false
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
DerivePointerAlignment: false
|
||||
36
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/.gitignore
vendored
Normal file
36
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/.gitignore
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
.vscode/
|
||||
.vs/
|
||||
|
||||
*.iml
|
||||
.idea/
|
||||
.externalNativeBuild/
|
||||
.gradle/
|
||||
gradle/
|
||||
gradlew*
|
||||
local.properties
|
||||
build/
|
||||
|
||||
bin/
|
||||
/_CPack_Packages
|
||||
/CMakeScripts
|
||||
/doc/doxyxml
|
||||
/doc/html
|
||||
/doc/node_modules
|
||||
virtualenv
|
||||
/Testing
|
||||
/install_manifest.txt
|
||||
*~
|
||||
*.a
|
||||
*.so*
|
||||
*.xcodeproj
|
||||
*.zip
|
||||
cmake_install.cmake
|
||||
CPack*.cmake
|
||||
fmt-*.cmake
|
||||
CTestTestfile.cmake
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
FMT.build
|
||||
Makefile
|
||||
run-msbuild.bat
|
||||
fmt.pc
|
||||
12
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/.gitrepo
vendored
Normal file
12
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/.gitrepo
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
; DO NOT EDIT (unless you know what you are doing)
|
||||
;
|
||||
; This subdirectory is a git "subrepo", and this file is maintained by the
|
||||
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
|
||||
;
|
||||
[subrepo]
|
||||
remote = https://github.com/fmtlib/fmt
|
||||
branch = master
|
||||
commit = e1bfb59619a43a6351434ef3b68ee5b7169a0ba5
|
||||
parent = 4a05453004314b85e5c6597cee16f37b02a7f6ab
|
||||
method = merge
|
||||
cmdver = 0.4.0
|
||||
101
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/.travis.yml
vendored
Normal file
101
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/.travis.yml
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
language: cpp
|
||||
dist: trusty
|
||||
sudo: false
|
||||
|
||||
os: linux
|
||||
|
||||
git:
|
||||
depth: 1
|
||||
|
||||
env:
|
||||
global:
|
||||
- secure: |-
|
||||
a1eovNn4uol9won7ghr67eD3/59oeESN+G9bWE+ecI1V6yRseG9whniGhIpC/YfMW/Qz5I
|
||||
5sxSmFjaw9bxCISNwUIrL1O5x2AmRYTnFcXk4dFsUvlZg+WeF/aKyBYCNRM8C2ndbBmtAO
|
||||
o1F2EwFbiso0EmtzhAPs19ujiVxkLn4=
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# Documentation
|
||||
- env: BUILD=Doc
|
||||
sudo: required
|
||||
# g++ 6 on Linux with C++14
|
||||
- env: COMPILER=g++-6 BUILD=Debug STANDARD=14
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-6
|
||||
- env: COMPILER=g++-6 BUILD=Release STANDARD=14
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-6
|
||||
# g++ 8 on Linux with C++17
|
||||
- env: COMPILER=g++-8 BUILD=Debug STANDARD=17
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-8
|
||||
- env: COMPILER=g++-8 BUILD=Release STANDARD=17
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-8
|
||||
|
||||
# Apple clang on OS X with C++14
|
||||
- env: BUILD=Debug STANDARD=14
|
||||
compiler: clang
|
||||
os: osx
|
||||
- env: BUILD=Release STANDARD=14
|
||||
compiler: clang
|
||||
os: osx
|
||||
# clang 6.0 on Linux with C++14 (builds the fuzzers as well)
|
||||
- env: COMPILER=clang++-6.0 BUILD=Debug STANDARD=14 ENABLE_FUZZING=1
|
||||
compiler: clang
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
packages:
|
||||
- clang-6.0
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty
|
||||
- llvm-toolchain-trusty-6.0
|
||||
# clang 4.0 on Linux with C++14
|
||||
- env: COMPILER=clang++-4.0 BUILD=Debug STANDARD=11
|
||||
compiler: clang
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
packages:
|
||||
- clang-4.0
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty
|
||||
- llvm-toolchain-trusty-4.0
|
||||
# g++ 4.8 on Linux with C++11
|
||||
- env: COMPILER=g++-4.8 BUILD=Debug STANDARD=11
|
||||
compiler: gcc
|
||||
|
||||
before_script:
|
||||
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then export CXX=${COMPILER}; fi
|
||||
- if [[ "${BUILD}" != "Doc" ]]; then ${CXX} --version; fi
|
||||
|
||||
script:
|
||||
- support/travis-build.py
|
||||
343
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/CMakeLists.txt
vendored
Normal file
343
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,343 @@
|
||||
cmake_minimum_required(VERSION 3.1.0)
|
||||
|
||||
# Use newer policies if available, up to most recent tested version of CMake.
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.11)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
else()
|
||||
cmake_policy(VERSION 3.11)
|
||||
endif()
|
||||
|
||||
# Determine if fmt is built as a subproject (using add_subdirectory)
|
||||
# or if it is the master project.
|
||||
set(MASTER_PROJECT OFF)
|
||||
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
set(MASTER_PROJECT ON)
|
||||
message(STATUS "CMake version: ${CMAKE_VERSION}")
|
||||
endif ()
|
||||
|
||||
# Joins arguments and places the results in ${result_var}.
|
||||
function(join result_var)
|
||||
set(result )
|
||||
foreach (arg ${ARGN})
|
||||
set(result "${result}${arg}")
|
||||
endforeach ()
|
||||
set(${result_var} "${result}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Sets a cache variable with a docstring joined from multiple arguments:
|
||||
# set(<variable> <value>... CACHE <type> <docstring>...)
|
||||
# This allows splitting a long docstring for readability.
|
||||
function(set_verbose)
|
||||
cmake_parse_arguments(SET_VERBOSE "" "" "CACHE" ${ARGN})
|
||||
list(GET SET_VERBOSE_CACHE 0 type)
|
||||
list(REMOVE_AT SET_VERBOSE_CACHE 0)
|
||||
join(doc ${SET_VERBOSE_CACHE})
|
||||
set(${SET_VERBOSE_UNPARSED_ARGUMENTS} CACHE ${type} ${doc})
|
||||
endfunction()
|
||||
|
||||
# Set the default CMAKE_BUILD_TYPE to Release.
|
||||
# This should be done before the project command since the latter can set
|
||||
# CMAKE_BUILD_TYPE itself (it does so for nmake).
|
||||
if (MASTER_PROJECT AND NOT CMAKE_BUILD_TYPE)
|
||||
set_verbose(CMAKE_BUILD_TYPE Release CACHE STRING
|
||||
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or "
|
||||
"CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
endif ()
|
||||
|
||||
project(FMT CXX)
|
||||
include(GNUInstallDirs)
|
||||
set_verbose(FMT_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE STRING
|
||||
"Installation directory for include files, a relative path "
|
||||
"that will be joined to ${CMAKE_INSTALL_PREFIX}, or an arbitrary absolute path.")
|
||||
|
||||
option(FMT_PEDANTIC "Enable extra warnings and expensive tests." OFF)
|
||||
option(FMT_WERROR "Halt the compilation with an error on compiler warnings."
|
||||
OFF)
|
||||
|
||||
# Options that control generation of various targets.
|
||||
option(FMT_DOC "Generate the doc target." ${MASTER_PROJECT})
|
||||
option(FMT_INSTALL "Generate the install target." ${MASTER_PROJECT})
|
||||
option(FMT_TEST "Generate the test target." ${MASTER_PROJECT})
|
||||
option(FMT_FUZZ "Generate the fuzz target." OFF)
|
||||
option(FMT_CUDA_TEST "Generate the cuda-test target." OFF)
|
||||
option(FMT_OS "Include core requiring OS (Windows/Posix) " ON)
|
||||
|
||||
# Get version from core.h
|
||||
file(READ include/fmt/core.h core_h)
|
||||
if (NOT core_h MATCHES "FMT_VERSION ([0-9]+)([0-9][0-9])([0-9][0-9])")
|
||||
message(FATAL_ERROR "Cannot get FMT_VERSION from core.h.")
|
||||
endif ()
|
||||
# Use math to skip leading zeros if any.
|
||||
math(EXPR CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
math(EXPR CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2})
|
||||
math(EXPR CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||
join(FMT_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.
|
||||
${CPACK_PACKAGE_VERSION_PATCH})
|
||||
message(STATUS "Version: ${FMT_VERSION}")
|
||||
|
||||
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
endif ()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/support/cmake")
|
||||
|
||||
include(cxx14)
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(JoinPaths)
|
||||
|
||||
list(FIND CMAKE_CXX_COMPILE_FEATURES "cxx_variadic_templates" index)
|
||||
if (${index} GREATER -1)
|
||||
# Use cxx_variadic_templates instead of more appropriate cxx_std_11 for
|
||||
# compatibility with older CMake versions.
|
||||
set(FMT_REQUIRED_FEATURES cxx_variadic_templates)
|
||||
endif ()
|
||||
message(STATUS "Required features: ${FMT_REQUIRED_FEATURES}")
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
set(PEDANTIC_COMPILE_FLAGS -pedantic-errors -Wall -Wextra -pedantic
|
||||
-Wold-style-cast -Wundef
|
||||
-Wredundant-decls -Wwrite-strings -Wpointer-arith
|
||||
-Wcast-qual -Wformat=2 -Wmissing-include-dirs
|
||||
-Wcast-align
|
||||
-Wctor-dtor-privacy -Wdisabled-optimization
|
||||
-Winvalid-pch -Woverloaded-virtual
|
||||
-Wconversion -Wswitch-enum
|
||||
-Wno-ctor-dtor-privacy -Wno-format-nonliteral -Wno-shadow)
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
|
||||
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wnoexcept
|
||||
-Wno-dangling-else -Wno-unused-local-typedefs)
|
||||
endif ()
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wdouble-promotion
|
||||
-Wtrampolines -Wzero-as-null-pointer-constant -Wuseless-cast
|
||||
-Wvector-operation-performance -Wsized-deallocation)
|
||||
endif ()
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
|
||||
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wshift-overflow=2
|
||||
-Wnull-dereference -Wduplicated-cond)
|
||||
endif ()
|
||||
set(WERROR_FLAG -Werror)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -pedantic -Wconversion
|
||||
-Wno-sign-conversion -Wdeprecated -Wweak-vtables)
|
||||
check_cxx_compiler_flag(-Wzero-as-null-pointer-constant HAS_NULLPTR_WARNING)
|
||||
if (HAS_NULLPTR_WARNING)
|
||||
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS}
|
||||
-Wzero-as-null-pointer-constant)
|
||||
endif ()
|
||||
set(WERROR_FLAG -Werror)
|
||||
endif ()
|
||||
|
||||
if (MSVC)
|
||||
set(PEDANTIC_COMPILE_FLAGS /W3)
|
||||
set(WERROR_FLAG /WX)
|
||||
endif ()
|
||||
|
||||
if (MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
# If Microsoft SDK is installed create script run-msbuild.bat that
|
||||
# calls SetEnv.cmd to set up build environment and runs msbuild.
|
||||
# It is useful when building Visual Studio projects with the SDK
|
||||
# toolchain rather than Visual Studio.
|
||||
include(FindSetEnv)
|
||||
if (WINSDK_SETENV)
|
||||
set(MSBUILD_SETUP "call \"${WINSDK_SETENV}\"")
|
||||
endif ()
|
||||
# Set FrameworkPathOverride to get rid of MSB3644 warnings.
|
||||
join(netfxpath
|
||||
"C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\"
|
||||
".NETFramework\\v4.0")
|
||||
file(WRITE run-msbuild.bat "
|
||||
${MSBUILD_SETUP}
|
||||
${CMAKE_MAKE_PROGRAM} -p:FrameworkPathOverride=\"${netfxpath}\" %*")
|
||||
endif ()
|
||||
|
||||
set(strtod_l_headers stdlib.h)
|
||||
if (APPLE)
|
||||
set(strtod_l_headers ${strtod_l_headers} xlocale.h)
|
||||
endif ()
|
||||
|
||||
include(CheckSymbolExists)
|
||||
if (WIN32)
|
||||
check_symbol_exists(_strtod_l "${strtod_l_headers}" HAVE_STRTOD_L)
|
||||
else ()
|
||||
check_symbol_exists(strtod_l "${strtod_l_headers}" HAVE_STRTOD_L)
|
||||
endif ()
|
||||
|
||||
function(add_headers VAR)
|
||||
set(headers ${${VAR}})
|
||||
foreach (header ${ARGN})
|
||||
set(headers ${headers} include/fmt/${header})
|
||||
endforeach()
|
||||
set(${VAR} ${headers} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Define the fmt library, its includes and the needed defines.
|
||||
add_headers(FMT_HEADERS chrono.h color.h compile.h core.h format.h format-inl.h
|
||||
locale.h os.h ostream.h posix.h printf.h ranges.h)
|
||||
if (FMT_OS)
|
||||
set(FMT_SOURCES src/format.cc src/os.cc)
|
||||
else()
|
||||
set(FMT_SOURCES src/format.cc)
|
||||
endif ()
|
||||
|
||||
add_library(fmt ${FMT_SOURCES} ${FMT_HEADERS} README.rst ChangeLog.rst)
|
||||
add_library(fmt::fmt ALIAS fmt)
|
||||
|
||||
if (HAVE_STRTOD_L)
|
||||
target_compile_definitions(fmt PUBLIC FMT_LOCALE)
|
||||
endif ()
|
||||
|
||||
if (MINGW)
|
||||
target_compile_options(fmt PUBLIC "-Wa,-mbig-obj")
|
||||
endif ()
|
||||
|
||||
if (FMT_WERROR)
|
||||
target_compile_options(fmt PRIVATE ${WERROR_FLAG})
|
||||
endif ()
|
||||
if (FMT_PEDANTIC)
|
||||
target_compile_options(fmt PRIVATE ${PEDANTIC_COMPILE_FLAGS})
|
||||
endif ()
|
||||
|
||||
target_compile_features(fmt INTERFACE ${FMT_REQUIRED_FEATURES})
|
||||
|
||||
target_include_directories(fmt PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${FMT_INC_DIR}>)
|
||||
|
||||
set(FMT_DEBUG_POSTFIX d CACHE STRING "Debug library postfix.")
|
||||
|
||||
set_target_properties(fmt PROPERTIES
|
||||
VERSION ${FMT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}
|
||||
DEBUG_POSTFIX "${FMT_DEBUG_POSTFIX}")
|
||||
|
||||
# Set FMT_LIB_NAME for pkg-config fmt.pc. We cannot use the OUTPUT_NAME target
|
||||
# property because it's not set by default.
|
||||
set(FMT_LIB_NAME fmt)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(FMT_LIB_NAME ${FMT_LIB_NAME}${FMT_DEBUG_POSTFIX})
|
||||
endif ()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND NOT EMSCRIPTEN)
|
||||
# Fix rpmlint warning:
|
||||
# unused-direct-shlib-dependency /usr/lib/libformat.so.1.1.0 /lib/libm.so.6.
|
||||
target_link_libraries(fmt -Wl,--as-needed)
|
||||
endif ()
|
||||
target_compile_definitions(fmt PRIVATE FMT_EXPORT INTERFACE FMT_SHARED)
|
||||
endif ()
|
||||
if (FMT_SAFE_DURATION_CAST)
|
||||
target_compile_definitions(fmt PUBLIC FMT_SAFE_DURATION_CAST)
|
||||
endif()
|
||||
|
||||
add_library(fmt-header-only INTERFACE)
|
||||
add_library(fmt::fmt-header-only ALIAS fmt-header-only)
|
||||
|
||||
target_compile_definitions(fmt-header-only INTERFACE FMT_HEADER_ONLY=1)
|
||||
target_compile_features(fmt-header-only INTERFACE ${FMT_REQUIRED_FEATURES})
|
||||
|
||||
target_include_directories(fmt-header-only INTERFACE
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${FMT_INC_DIR}>)
|
||||
|
||||
# Install targets.
|
||||
if (FMT_INSTALL)
|
||||
include(CMakePackageConfigHelpers)
|
||||
set_verbose(FMT_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/fmt CACHE STRING
|
||||
"Installation directory for cmake files, a relative path "
|
||||
"that will be joined to ${CMAKE_INSTALL_PREFIX}, or an arbitrary absolute path.")
|
||||
set(version_config ${PROJECT_BINARY_DIR}/fmt-config-version.cmake)
|
||||
set(project_config ${PROJECT_BINARY_DIR}/fmt-config.cmake)
|
||||
set(pkgconfig ${PROJECT_BINARY_DIR}/fmt.pc)
|
||||
set(targets_export_name fmt-targets)
|
||||
|
||||
set_verbose(FMT_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING
|
||||
"Installation directory for libraries, a relative path "
|
||||
"that will be joined to ${CMAKE_INSTALL_PREFIX}, or an arbitrary absolute path.")
|
||||
|
||||
set_verbose(FMT_PKGCONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig CACHE PATH
|
||||
"Installation directory for pkgconfig (.pc) files, a relative path "
|
||||
"that will be joined to ${CMAKE_INSTALL_PREFIX}, or an arbitrary absolute path.")
|
||||
|
||||
# Generate the version, config and target files into the build directory.
|
||||
write_basic_package_version_file(
|
||||
${version_config}
|
||||
VERSION ${FMT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion)
|
||||
|
||||
join_paths(libdir_for_pc_file "\${exec_prefix}" "${FMT_LIB_DIR}")
|
||||
join_paths(includedir_for_pc_file "\${prefix}" "${FMT_INC_DIR}")
|
||||
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/support/cmake/fmt.pc.in"
|
||||
"${pkgconfig}"
|
||||
@ONLY)
|
||||
configure_package_config_file(
|
||||
${PROJECT_SOURCE_DIR}/support/cmake/fmt-config.cmake.in
|
||||
${project_config}
|
||||
INSTALL_DESTINATION ${FMT_CMAKE_DIR})
|
||||
|
||||
set(INSTALL_TARGETS fmt fmt-header-only)
|
||||
# Use a namespace because CMake provides better diagnostics for namespaced
|
||||
# imported targets.
|
||||
export(TARGETS ${INSTALL_TARGETS} NAMESPACE fmt::
|
||||
FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake)
|
||||
|
||||
# Install version, config and target files.
|
||||
install(
|
||||
FILES ${project_config} ${version_config}
|
||||
DESTINATION ${FMT_CMAKE_DIR})
|
||||
install(EXPORT ${targets_export_name} DESTINATION ${FMT_CMAKE_DIR}
|
||||
NAMESPACE fmt::)
|
||||
|
||||
# Install the library and headers.
|
||||
install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name}
|
||||
LIBRARY DESTINATION ${FMT_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${FMT_LIB_DIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
install(FILES $<TARGET_PDB_FILE:${INSTALL_TARGETS}>
|
||||
DESTINATION ${FMT_LIB_DIR} OPTIONAL)
|
||||
install(FILES ${FMT_HEADERS} DESTINATION "${FMT_INC_DIR}/fmt")
|
||||
install(FILES "${pkgconfig}" DESTINATION "${FMT_PKGCONFIG_DIR}")
|
||||
endif ()
|
||||
|
||||
if (FMT_DOC)
|
||||
add_subdirectory(doc)
|
||||
endif ()
|
||||
|
||||
if (FMT_TEST)
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
endif ()
|
||||
|
||||
# Control fuzzing independent of the unit tests.
|
||||
if (FMT_FUZZ)
|
||||
add_subdirectory(test/fuzzing)
|
||||
target_compile_definitions(fmt PUBLIC FMT_FUZZ)
|
||||
endif ()
|
||||
|
||||
set(gitignore ${PROJECT_SOURCE_DIR}/.gitignore)
|
||||
if (MASTER_PROJECT AND EXISTS ${gitignore})
|
||||
# Get the list of ignored files from .gitignore.
|
||||
file (STRINGS ${gitignore} lines)
|
||||
list(REMOVE_ITEM lines /doc/html)
|
||||
foreach (line ${lines})
|
||||
string(REPLACE "." "[.]" line "${line}")
|
||||
string(REPLACE "*" ".*" line "${line}")
|
||||
set(ignored_files ${ignored_files} "${line}$" "${line}/")
|
||||
endforeach ()
|
||||
set(ignored_files ${ignored_files}
|
||||
/.git /breathe /format-benchmark sphinx/ .buildinfo .doctrees)
|
||||
|
||||
set(CPACK_SOURCE_GENERATOR ZIP)
|
||||
set(CPACK_SOURCE_IGNORE_FILES ${ignored_files})
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME fmt-${FMT_VERSION})
|
||||
set(CPACK_PACKAGE_NAME fmt)
|
||||
set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.rst)
|
||||
include(CPack)
|
||||
endif ()
|
||||
17
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/CONTRIBUTING.md
vendored
Normal file
17
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
Contributing to {fmt}
|
||||
=====================
|
||||
|
||||
By submitting a pull request or a patch, you represent that you have the right
|
||||
to license your contribution to the {fmt} project owners and the community,
|
||||
agree that your contributions are licensed under the {fmt} license, and agree
|
||||
to future changes to the licensing.
|
||||
|
||||
All C++ code must adhere to [Google C++ Style Guide](
|
||||
https://google.github.io/styleguide/cppguide.html) with the following
|
||||
exceptions:
|
||||
|
||||
* Exceptions are permitted
|
||||
* snake_case should be used instead of UpperCamelCase for function and type
|
||||
names
|
||||
|
||||
Thanks for contributing!
|
||||
3211
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/ChangeLog.rst
vendored
Normal file
3211
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/ChangeLog.rst
vendored
Normal file
File diff suppressed because it is too large
Load Diff
27
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/LICENSE.rst
vendored
Normal file
27
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/LICENSE.rst
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
Copyright (c) 2012 - present, Victor Zverovich
|
||||
|
||||
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.
|
||||
|
||||
--- Optional exception to the license ---
|
||||
|
||||
As an exception, if, as a result of your compiling your source code, portions
|
||||
of this Software are embedded into a machine-executable object form of such
|
||||
source code, you may redistribute such embedded portions in such object form
|
||||
without including the above copyright and permission notices.
|
||||
479
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/README.rst
vendored
Normal file
479
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/README.rst
vendored
Normal file
@@ -0,0 +1,479 @@
|
||||
{fmt}
|
||||
=====
|
||||
|
||||
.. image:: https://travis-ci.org/fmtlib/fmt.png?branch=master
|
||||
:target: https://travis-ci.org/fmtlib/fmt
|
||||
|
||||
.. image:: https://ci.appveyor.com/api/projects/status/ehjkiefde6gucy1v
|
||||
:target: https://ci.appveyor.com/project/vitaut/fmt
|
||||
|
||||
.. image:: https://oss-fuzz-build-logs.storage.googleapis.com/badges/libfmt.svg
|
||||
:alt: fmt is continuously fuzzed at oss-fuzz
|
||||
:target: https://bugs.chromium.org/p/oss-fuzz/issues/list?\
|
||||
colspec=ID%20Type%20Component%20Status%20Proj%20Reported%20Owner%20\
|
||||
Summary&q=proj%3Dlibfmt&can=1
|
||||
|
||||
.. image:: https://img.shields.io/badge/stackoverflow-fmt-blue.svg
|
||||
:alt: Ask questions at StackOverflow with the tag fmt
|
||||
:target: https://stackoverflow.com/questions/tagged/fmt
|
||||
|
||||
**{fmt}** is an open-source formatting library for C++.
|
||||
It can be used as a safe and fast alternative to (s)printf and iostreams.
|
||||
|
||||
`Documentation <https://fmt.dev>`__
|
||||
|
||||
Q&A: ask questions on `StackOverflow with the tag fmt
|
||||
<https://stackoverflow.com/questions/tagged/fmt>`_.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* Simple `format API <https://fmt.dev/dev/api.html>`_ with positional arguments
|
||||
for localization
|
||||
* Implementation of `C++20 std::format
|
||||
<https://en.cppreference.com/w/cpp/utility/format>`__
|
||||
* `Format string syntax <https://fmt.dev/dev/syntax.html>`_ similar to Python's
|
||||
`format <https://docs.python.org/3/library/stdtypes.html#str.format>`_
|
||||
* Safe `printf implementation
|
||||
<https://fmt.dev/latest/api.html#printf-formatting>`_ including the POSIX
|
||||
extension for positional arguments
|
||||
* Extensibility: `support for user-defined types
|
||||
<https://fmt.dev/latest/api.html#formatting-user-defined-types>`_
|
||||
* High performance: faster than common standard library implementations of
|
||||
``(s)printf``, iostreams, ``to_string`` and ``to_chars``, see `Speed tests`_
|
||||
and `Converting a hundred million integers to strings per second
|
||||
<http://www.zverovich.net/2020/06/13/fast-int-to-string-revisited.html>`_
|
||||
* Small code size both in terms of source code with the minimum configuration
|
||||
consisting of just three files, ``core.h``, ``format.h`` and ``format-inl.h``,
|
||||
and compiled code; see `Compile time and code bloat`_
|
||||
* Reliability: the library has an extensive set of `unit tests
|
||||
<https://github.com/fmtlib/fmt/tree/master/test>`_ and is continuously fuzzed
|
||||
* Safety: the library is fully type safe, errors in format strings can be
|
||||
reported at compile time, automatic memory management prevents buffer overflow
|
||||
errors
|
||||
* Ease of use: small self-contained code base, no external dependencies,
|
||||
permissive MIT `license
|
||||
<https://github.com/fmtlib/fmt/blob/master/LICENSE.rst>`_
|
||||
* `Portability <https://fmt.dev/latest/index.html#portability>`_ with
|
||||
consistent output across platforms and support for older compilers
|
||||
* Clean warning-free codebase even on high warning levels such as
|
||||
``-Wall -Wextra -pedantic``
|
||||
* Locale-independence by default
|
||||
* Optional header-only configuration enabled with the ``FMT_HEADER_ONLY`` macro
|
||||
|
||||
See the `documentation <https://fmt.dev>`_ for more details.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
Print ``Hello, world!`` to ``stdout``:
|
||||
|
||||
.. code:: c++
|
||||
|
||||
#include <fmt/core.h>
|
||||
|
||||
int main() {
|
||||
fmt::print("Hello, world!\n");
|
||||
}
|
||||
|
||||
Format a string:
|
||||
|
||||
.. code:: c++
|
||||
|
||||
std::string s = fmt::format("The answer is {}.", 42);
|
||||
// s == "The answer is 42."
|
||||
|
||||
Format a string using positional arguments:
|
||||
|
||||
.. code:: c++
|
||||
|
||||
std::string s = fmt::format("I'd rather be {1} than {0}.", "right", "happy");
|
||||
// s == "I'd rather be happy than right."
|
||||
|
||||
Print chrono durations:
|
||||
|
||||
.. code:: c++
|
||||
|
||||
#include <fmt/chrono.h>
|
||||
|
||||
int main() {
|
||||
using namespace std::literals::chrono_literals;
|
||||
fmt::print("Default format: {} {}\n", 42s, 100ms);
|
||||
fmt::print("strftime-like format: {:%H:%M:%S}\n", 3h + 15min + 30s);
|
||||
}
|
||||
|
||||
Output::
|
||||
|
||||
Default format: 42s 100ms
|
||||
strftime-like format: 03:15:30
|
||||
|
||||
Print a container:
|
||||
|
||||
.. code:: c++
|
||||
|
||||
#include <vector>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
int main() {
|
||||
std::vector<int> v = {1, 2, 3};
|
||||
fmt::print("{}\n", v);
|
||||
}
|
||||
|
||||
Output::
|
||||
|
||||
{1, 2, 3}
|
||||
|
||||
Check a format string at compile time:
|
||||
|
||||
.. code:: c++
|
||||
|
||||
std::string s = fmt::format(FMT_STRING("{:d}"), "don't panic");
|
||||
|
||||
This gives a compile-time error because ``d`` is an invalid format specifier for
|
||||
a string.
|
||||
|
||||
Create your own functions similar to `format
|
||||
<https://fmt.dev/latest/api.html#format>`_ and
|
||||
`print <https://fmt.dev/latest/api.html#print>`_
|
||||
which take arbitrary arguments (`godbolt <https://godbolt.org/g/MHjHVf>`_):
|
||||
|
||||
.. code:: c++
|
||||
|
||||
// Prints formatted error message.
|
||||
void vreport_error(const char* format, fmt::format_args args) {
|
||||
fmt::print("Error: ");
|
||||
fmt::vprint(format, args);
|
||||
}
|
||||
template <typename... Args>
|
||||
void report_error(const char* format, const Args & ... args) {
|
||||
vreport_error(format, fmt::make_format_args(args...));
|
||||
}
|
||||
|
||||
report_error("file not found: {}", path);
|
||||
|
||||
Note that ``vreport_error`` is not parameterized on argument types which can
|
||||
improve compile times and reduce code size compared to a fully parameterized
|
||||
version.
|
||||
|
||||
Benchmarks
|
||||
----------
|
||||
|
||||
Speed tests
|
||||
~~~~~~~~~~~
|
||||
|
||||
================= ============= ===========
|
||||
Library Method Run Time, s
|
||||
================= ============= ===========
|
||||
libc printf 1.04
|
||||
libc++ std::ostream 3.05
|
||||
{fmt} 6.1.1 fmt::print 0.75
|
||||
Boost Format 1.67 boost::format 7.24
|
||||
Folly Format folly::format 2.23
|
||||
================= ============= ===========
|
||||
|
||||
{fmt} is the fastest of the benchmarked methods, ~35% faster than ``printf``.
|
||||
|
||||
The above results were generated by building ``tinyformat_test.cpp`` on macOS
|
||||
10.14.6 with ``clang++ -O3 -DNDEBUG -DSPEED_TEST -DHAVE_FORMAT``, and taking the
|
||||
best of three runs. In the test, the format string ``"%0.10f:%04d:%+g:%s:%p:%c:%%\n"``
|
||||
or equivalent is filled 2,000,000 times with output sent to ``/dev/null``; for
|
||||
further details refer to the `source
|
||||
<https://github.com/fmtlib/format-benchmark/blob/master/tinyformat_test.cpp>`_.
|
||||
|
||||
{fmt} is up to 10x faster than ``std::ostringstream`` and ``sprintf`` on
|
||||
floating-point formatting (`dtoa-benchmark <https://github.com/fmtlib/dtoa-benchmark>`_)
|
||||
and faster than `double-conversion <https://github.com/google/double-conversion>`_:
|
||||
|
||||
.. image:: https://user-images.githubusercontent.com/576385/
|
||||
69767160-cdaca400-112f-11ea-9fc5-347c9f83caad.png
|
||||
:target: https://fmt.dev/unknown_mac64_clang10.0.html
|
||||
|
||||
Compile time and code bloat
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The script `bloat-test.py
|
||||
<https://github.com/fmtlib/format-benchmark/blob/master/bloat-test.py>`_
|
||||
from `format-benchmark <https://github.com/fmtlib/format-benchmark>`_
|
||||
tests compile time and code bloat for nontrivial projects.
|
||||
It generates 100 translation units and uses ``printf()`` or its alternative
|
||||
five times in each to simulate a medium sized project. The resulting
|
||||
executable size and compile time (Apple LLVM version 8.1.0 (clang-802.0.42),
|
||||
macOS Sierra, best of three) is shown in the following tables.
|
||||
|
||||
**Optimized build (-O3)**
|
||||
|
||||
============= =============== ==================== ==================
|
||||
Method Compile Time, s Executable size, KiB Stripped size, KiB
|
||||
============= =============== ==================== ==================
|
||||
printf 2.6 29 26
|
||||
printf+string 16.4 29 26
|
||||
iostreams 31.1 59 55
|
||||
{fmt} 19.0 37 34
|
||||
Boost Format 91.9 226 203
|
||||
Folly Format 115.7 101 88
|
||||
============= =============== ==================== ==================
|
||||
|
||||
As you can see, {fmt} has 60% less overhead in terms of resulting binary code
|
||||
size compared to iostreams and comes pretty close to ``printf``. Boost Format
|
||||
and Folly Format have the largest overheads.
|
||||
|
||||
``printf+string`` is the same as ``printf`` but with extra ``<string>``
|
||||
include to measure the overhead of the latter.
|
||||
|
||||
**Non-optimized build**
|
||||
|
||||
============= =============== ==================== ==================
|
||||
Method Compile Time, s Executable size, KiB Stripped size, KiB
|
||||
============= =============== ==================== ==================
|
||||
printf 2.2 33 30
|
||||
printf+string 16.0 33 30
|
||||
iostreams 28.3 56 52
|
||||
{fmt} 18.2 59 50
|
||||
Boost Format 54.1 365 303
|
||||
Folly Format 79.9 445 430
|
||||
============= =============== ==================== ==================
|
||||
|
||||
``libc``, ``lib(std)c++`` and ``libfmt`` are all linked as shared libraries to
|
||||
compare formatting function overhead only. Boost Format is a
|
||||
header-only library so it doesn't provide any linkage options.
|
||||
|
||||
Running the tests
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Please refer to `Building the library`__ for the instructions on how to build
|
||||
the library and run the unit tests.
|
||||
|
||||
__ https://fmt.dev/latest/usage.html#building-the-library
|
||||
|
||||
Benchmarks reside in a separate repository,
|
||||
`format-benchmarks <https://github.com/fmtlib/format-benchmark>`_,
|
||||
so to run the benchmarks you first need to clone this repository and
|
||||
generate Makefiles with CMake::
|
||||
|
||||
$ git clone --recursive https://github.com/fmtlib/format-benchmark.git
|
||||
$ cd format-benchmark
|
||||
$ cmake .
|
||||
|
||||
Then you can run the speed test::
|
||||
|
||||
$ make speed-test
|
||||
|
||||
or the bloat test::
|
||||
|
||||
$ make bloat-test
|
||||
|
||||
Projects using this library
|
||||
---------------------------
|
||||
|
||||
* `0 A.D. <https://play0ad.com/>`_: A free, open-source, cross-platform
|
||||
real-time strategy game
|
||||
|
||||
* `AMPL/MP <https://github.com/ampl/mp>`_:
|
||||
An open-source library for mathematical programming
|
||||
|
||||
* `Aseprite <https://github.com/aseprite/aseprite>`_:
|
||||
Animated sprite editor & pixel art tool
|
||||
|
||||
* `AvioBook <https://www.aviobook.aero/en>`_: A comprehensive aircraft
|
||||
operations suite
|
||||
|
||||
* `Celestia <https://celestia.space/>`_: Real-time 3D visualization of space
|
||||
|
||||
* `Ceph <https://ceph.com/>`_: A scalable distributed storage system
|
||||
|
||||
* `ccache <https://ccache.dev/>`_: A compiler cache
|
||||
|
||||
* `ClickHouse <https://github.com/ClickHouse/ClickHouse>`_: analytical database
|
||||
management system
|
||||
|
||||
* `CUAUV <http://cuauv.org/>`_: Cornell University's autonomous underwater
|
||||
vehicle
|
||||
|
||||
* `Drake <https://drake.mit.edu/>`_: A planning, control, and analysis toolbox
|
||||
for nonlinear dynamical systems (MIT)
|
||||
|
||||
* `Envoy <https://lyft.github.io/envoy/>`_: C++ L7 proxy and communication bus
|
||||
(Lyft)
|
||||
|
||||
* `FiveM <https://fivem.net/>`_: a modification framework for GTA V
|
||||
|
||||
* `Folly <https://github.com/facebook/folly>`_: Facebook open-source library
|
||||
|
||||
* `HarpyWar/pvpgn <https://github.com/pvpgn/pvpgn-server>`_:
|
||||
Player vs Player Gaming Network with tweaks
|
||||
|
||||
* `KBEngine <https://github.com/kbengine/kbengine>`_: An open-source MMOG server
|
||||
engine
|
||||
|
||||
* `Keypirinha <https://keypirinha.com/>`_: A semantic launcher for Windows
|
||||
|
||||
* `Kodi <https://kodi.tv/>`_ (formerly xbmc): Home theater software
|
||||
|
||||
* `Knuth <https://kth.cash/>`_: High-performance Bitcoin full-node
|
||||
|
||||
* `Microsoft Verona <https://github.com/microsoft/verona>`_:
|
||||
Research programming language for concurrent ownership
|
||||
|
||||
* `MongoDB <https://mongodb.com/>`_: Distributed document database
|
||||
|
||||
* `MongoDB Smasher <https://github.com/duckie/mongo_smasher>`_: A small tool to
|
||||
generate randomized datasets
|
||||
|
||||
* `OpenSpace <https://openspaceproject.com/>`_: An open-source
|
||||
astrovisualization framework
|
||||
|
||||
* `PenUltima Online (POL) <https://www.polserver.com/>`_:
|
||||
An MMO server, compatible with most Ultima Online clients
|
||||
|
||||
* `PyTorch <https://github.com/pytorch/pytorch>`_: An open-source machine
|
||||
learning library
|
||||
|
||||
* `quasardb <https://www.quasardb.net/>`_: A distributed, high-performance,
|
||||
associative database
|
||||
|
||||
* `readpe <https://bitbucket.org/sys_dev/readpe>`_: Read Portable Executable
|
||||
|
||||
* `redis-cerberus <https://github.com/HunanTV/redis-cerberus>`_: A Redis cluster
|
||||
proxy
|
||||
|
||||
* `redpanda <https://vectorized.io/redpanda>`_: A 10x faster Kafka® replacement
|
||||
for mission critical systems written in C++
|
||||
|
||||
* `rpclib <http://rpclib.net/>`_: A modern C++ msgpack-RPC server and client
|
||||
library
|
||||
|
||||
* `Salesforce Analytics Cloud
|
||||
<https://www.salesforce.com/analytics-cloud/overview/>`_:
|
||||
Business intelligence software
|
||||
|
||||
* `Scylla <https://www.scylladb.com/>`_: A Cassandra-compatible NoSQL data store
|
||||
that can handle 1 million transactions per second on a single server
|
||||
|
||||
* `Seastar <http://www.seastar-project.org/>`_: An advanced, open-source C++
|
||||
framework for high-performance server applications on modern hardware
|
||||
|
||||
* `spdlog <https://github.com/gabime/spdlog>`_: Super fast C++ logging library
|
||||
|
||||
* `Stellar <https://www.stellar.org/>`_: Financial platform
|
||||
|
||||
* `Touch Surgery <https://www.touchsurgery.com/>`_: Surgery simulator
|
||||
|
||||
* `TrinityCore <https://github.com/TrinityCore/TrinityCore>`_: Open-source
|
||||
MMORPG framework
|
||||
|
||||
* `Windows Terminal <https://github.com/microsoft/terminal>`_: The new Windows
|
||||
Terminal
|
||||
|
||||
`More... <https://github.com/search?q=fmtlib&type=Code>`_
|
||||
|
||||
If you are aware of other projects using this library, please let me know
|
||||
by `email <mailto:victor.zverovich@gmail.com>`_ or by submitting an
|
||||
`issue <https://github.com/fmtlib/fmt/issues>`_.
|
||||
|
||||
Motivation
|
||||
----------
|
||||
|
||||
So why yet another formatting library?
|
||||
|
||||
There are plenty of methods for doing this task, from standard ones like
|
||||
the printf family of function and iostreams to Boost Format and FastFormat
|
||||
libraries. The reason for creating a new library is that every existing
|
||||
solution that I found either had serious issues or didn't provide
|
||||
all the features I needed.
|
||||
|
||||
printf
|
||||
~~~~~~
|
||||
|
||||
The good thing about ``printf`` is that it is pretty fast and readily available
|
||||
being a part of the C standard library. The main drawback is that it
|
||||
doesn't support user-defined types. ``printf`` also has safety issues although
|
||||
they are somewhat mitigated with `__attribute__ ((format (printf, ...))
|
||||
<https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html>`_ in GCC.
|
||||
There is a POSIX extension that adds positional arguments required for
|
||||
`i18n <https://en.wikipedia.org/wiki/Internationalization_and_localization>`_
|
||||
to ``printf`` but it is not a part of C99 and may not be available on some
|
||||
platforms.
|
||||
|
||||
iostreams
|
||||
~~~~~~~~~
|
||||
|
||||
The main issue with iostreams is best illustrated with an example:
|
||||
|
||||
.. code:: c++
|
||||
|
||||
std::cout << std::setprecision(2) << std::fixed << 1.23456 << "\n";
|
||||
|
||||
which is a lot of typing compared to printf:
|
||||
|
||||
.. code:: c++
|
||||
|
||||
printf("%.2f\n", 1.23456);
|
||||
|
||||
Matthew Wilson, the author of FastFormat, called this "chevron hell". iostreams
|
||||
don't support positional arguments by design.
|
||||
|
||||
The good part is that iostreams support user-defined types and are safe although
|
||||
error handling is awkward.
|
||||
|
||||
Boost Format
|
||||
~~~~~~~~~~~~
|
||||
|
||||
This is a very powerful library which supports both ``printf``-like format
|
||||
strings and positional arguments. Its main drawback is performance. According to
|
||||
various, benchmarks it is much slower than other methods considered here. Boost
|
||||
Format also has excessive build times and severe code bloat issues (see
|
||||
`Benchmarks`_).
|
||||
|
||||
FastFormat
|
||||
~~~~~~~~~~
|
||||
|
||||
This is an interesting library which is fast, safe and has positional arguments.
|
||||
However, it has significant limitations, citing its author:
|
||||
|
||||
Three features that have no hope of being accommodated within the
|
||||
current design are:
|
||||
|
||||
* Leading zeros (or any other non-space padding)
|
||||
* Octal/hexadecimal encoding
|
||||
* Runtime width/alignment specification
|
||||
|
||||
It is also quite big and has a heavy dependency, STLSoft, which might be too
|
||||
restrictive for using it in some projects.
|
||||
|
||||
Boost Spirit.Karma
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This is not really a formatting library but I decided to include it here for
|
||||
completeness. As iostreams, it suffers from the problem of mixing verbatim text
|
||||
with arguments. The library is pretty fast, but slower on integer formatting
|
||||
than ``fmt::format_to`` with format string compilation on Karma's own benchmark,
|
||||
see `Converting a hundred million integers to strings per second
|
||||
<http://www.zverovich.net/2020/06/13/fast-int-to-string-revisited.html>`_.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
{fmt} is distributed under the MIT `license
|
||||
<https://github.com/fmtlib/fmt/blob/master/LICENSE.rst>`_.
|
||||
|
||||
Documentation License
|
||||
---------------------
|
||||
|
||||
The `Format String Syntax <https://fmt.dev/latest/syntax.html>`_
|
||||
section in the documentation is based on the one from Python `string module
|
||||
documentation <https://docs.python.org/3/library/string.html#module-string>`_.
|
||||
For this reason the documentation is distributed under the Python Software
|
||||
Foundation license available in `doc/python-license.txt
|
||||
<https://raw.github.com/fmtlib/fmt/master/doc/python-license.txt>`_.
|
||||
It only applies if you distribute the documentation of {fmt}.
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
The {fmt} library is maintained by Victor Zverovich (`vitaut
|
||||
<https://github.com/vitaut>`_) and Jonathan Müller (`foonathan
|
||||
<https://github.com/foonathan>`_) with contributions from many other people.
|
||||
See `Contributors <https://github.com/fmtlib/fmt/graphs/contributors>`_ and
|
||||
`Releases <https://github.com/fmtlib/fmt/releases>`_ for some of the names.
|
||||
Let us know if your contribution is not listed or mentioned incorrectly and
|
||||
we'll make it right.
|
||||
18
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/doc/CMakeLists.txt
vendored
Normal file
18
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/doc/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
find_program(DOXYGEN doxygen)
|
||||
if (NOT DOXYGEN)
|
||||
message(STATUS "Target 'doc' disabled (requires doxygen)")
|
||||
return ()
|
||||
endif ()
|
||||
|
||||
find_package(PythonInterp QUIET REQUIRED)
|
||||
find_program(SPHINX_EXECUTABLE NAMES sphinx-build sphinx-build-3)
|
||||
|
||||
add_custom_target(doc
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/build.py
|
||||
${SPHINX_EXECUTABLE} ${FMT_VERSION}
|
||||
SOURCES api.rst syntax.rst usage.rst build.py conf.py _templates/layout.html)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/fmt OPTIONAL
|
||||
PATTERN ".doctrees" EXCLUDE)
|
||||
7
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/doc/_static/bootstrap.min.js
vendored
Normal file
7
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/doc/_static/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
28
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/doc/_static/breathe.css
vendored
Normal file
28
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/doc/_static/breathe.css
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
/* -- breathe specific styles ----------------------------------------------- */
|
||||
|
||||
/* So enum value descriptions are displayed inline to the item */
|
||||
.breatheenumvalues li tt + p {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* So parameter descriptions are displayed inline to the item */
|
||||
.breatheparameterlist li tt + p {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.container .breathe-sectiondef {
|
||||
width: inherit;
|
||||
}
|
||||
|
||||
.github-btn {
|
||||
border: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.jumbotron {
|
||||
background-size: 100% 4px;
|
||||
background-repeat: repeat-y;
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,229 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata></metadata>
|
||||
<defs>
|
||||
<font id="glyphicons_halflingsregular" horiz-adv-x="1200" >
|
||||
<font-face units-per-em="1200" ascent="960" descent="-240" />
|
||||
<missing-glyph horiz-adv-x="500" />
|
||||
<glyph />
|
||||
<glyph />
|
||||
<glyph unicode="
" />
|
||||
<glyph unicode=" " />
|
||||
<glyph unicode="*" d="M100 500v200h259l-183 183l141 141l183 -183v259h200v-259l183 183l141 -141l-183 -183h259v-200h-259l183 -183l-141 -141l-183 183v-259h-200v259l-183 -183l-141 141l183 183h-259z" />
|
||||
<glyph unicode="+" d="M0 400v300h400v400h300v-400h400v-300h-400v-400h-300v400h-400z" />
|
||||
<glyph unicode=" " />
|
||||
<glyph unicode=" " horiz-adv-x="652" />
|
||||
<glyph unicode=" " horiz-adv-x="1304" />
|
||||
<glyph unicode=" " horiz-adv-x="652" />
|
||||
<glyph unicode=" " horiz-adv-x="1304" />
|
||||
<glyph unicode=" " horiz-adv-x="434" />
|
||||
<glyph unicode=" " horiz-adv-x="326" />
|
||||
<glyph unicode=" " horiz-adv-x="217" />
|
||||
<glyph unicode=" " horiz-adv-x="217" />
|
||||
<glyph unicode=" " horiz-adv-x="163" />
|
||||
<glyph unicode=" " horiz-adv-x="260" />
|
||||
<glyph unicode=" " horiz-adv-x="72" />
|
||||
<glyph unicode=" " horiz-adv-x="260" />
|
||||
<glyph unicode=" " horiz-adv-x="326" />
|
||||
<glyph unicode="€" d="M100 500l100 100h113q0 47 5 100h-218l100 100h135q37 167 112 257q117 141 297 141q242 0 354 -189q60 -103 66 -209h-181q0 55 -25.5 99t-63.5 68t-75 36.5t-67 12.5q-24 0 -52.5 -10t-62.5 -32t-65.5 -67t-50.5 -107h379l-100 -100h-300q-6 -46 -6 -100h406l-100 -100 h-300q9 -74 33 -132t52.5 -91t62 -54.5t59 -29t46.5 -7.5q29 0 66 13t75 37t63.5 67.5t25.5 96.5h174q-31 -172 -128 -278q-107 -117 -274 -117q-205 0 -324 158q-36 46 -69 131.5t-45 205.5h-217z" />
|
||||
<glyph unicode="−" d="M200 400h900v300h-900v-300z" />
|
||||
<glyph unicode="◼" horiz-adv-x="500" d="M0 0z" />
|
||||
<glyph unicode="☁" d="M-14 494q0 -80 56.5 -137t135.5 -57h750q120 0 205 86.5t85 207.5t-85 207t-205 86q-46 0 -90 -14q-44 97 -134.5 156.5t-200.5 59.5q-152 0 -260 -107.5t-108 -260.5q0 -25 2 -37q-66 -14 -108.5 -67.5t-42.5 -122.5z" />
|
||||
<glyph unicode="✉" d="M0 100l400 400l200 -200l200 200l400 -400h-1200zM0 300v600l300 -300zM0 1100l600 -603l600 603h-1200zM900 600l300 300v-600z" />
|
||||
<glyph unicode="✏" d="M-13 -13l333 112l-223 223zM187 403l214 -214l614 614l-214 214zM887 1103l214 -214l99 92q13 13 13 32.5t-13 33.5l-153 153q-15 13 -33 13t-33 -13z" />
|
||||
<glyph unicode="" d="M0 1200h1200l-500 -550v-550h300v-100h-800v100h300v550z" />
|
||||
<glyph unicode="" d="M14 84q18 -55 86 -75.5t147 5.5q65 21 109 69t44 90v606l600 155v-521q-64 16 -138 -7q-79 -26 -122.5 -83t-25.5 -111q18 -55 86 -75.5t147 4.5q70 23 111.5 63.5t41.5 95.5v881q0 10 -7 15.5t-17 2.5l-752 -193q-10 -3 -17 -12.5t-7 -19.5v-689q-64 17 -138 -7 q-79 -25 -122.5 -82t-25.5 -112z" />
|
||||
<glyph unicode="" d="M23 693q0 200 142 342t342 142t342 -142t142 -342q0 -142 -78 -261l300 -300q7 -8 7 -18t-7 -18l-109 -109q-8 -7 -18 -7t-18 7l-300 300q-119 -78 -261 -78q-200 0 -342 142t-142 342zM176 693q0 -136 97 -233t234 -97t233.5 96.5t96.5 233.5t-96.5 233.5t-233.5 96.5 t-234 -97t-97 -233z" />
|
||||
<glyph unicode="" d="M100 784q0 64 28 123t73 100.5t104.5 64t119 20.5t120 -38.5t104.5 -104.5q48 69 109.5 105t121.5 38t118.5 -20.5t102.5 -64t71 -100.5t27 -123q0 -57 -33.5 -117.5t-94 -124.5t-126.5 -127.5t-150 -152.5t-146 -174q-62 85 -145.5 174t-149.5 152.5t-126.5 127.5 t-94 124.5t-33.5 117.5z" />
|
||||
<glyph unicode="" d="M-72 800h479l146 400h2l146 -400h472l-382 -278l145 -449l-384 275l-382 -275l146 447zM168 71l2 1z" />
|
||||
<glyph unicode="" d="M-72 800h479l146 400h2l146 -400h472l-382 -278l145 -449l-384 275l-382 -275l146 447zM168 71l2 1zM237 700l196 -142l-73 -226l192 140l195 -141l-74 229l193 140h-235l-77 211l-78 -211h-239z" />
|
||||
<glyph unicode="" d="M0 0v143l400 257v100q-37 0 -68.5 74.5t-31.5 125.5v200q0 124 88 212t212 88t212 -88t88 -212v-200q0 -51 -31.5 -125.5t-68.5 -74.5v-100l400 -257v-143h-1200z" />
|
||||
<glyph unicode="" d="M0 0v1100h1200v-1100h-1200zM100 100h100v100h-100v-100zM100 300h100v100h-100v-100zM100 500h100v100h-100v-100zM100 700h100v100h-100v-100zM100 900h100v100h-100v-100zM300 100h600v400h-600v-400zM300 600h600v400h-600v-400zM1000 100h100v100h-100v-100z M1000 300h100v100h-100v-100zM1000 500h100v100h-100v-100zM1000 700h100v100h-100v-100zM1000 900h100v100h-100v-100z" />
|
||||
<glyph unicode="" d="M0 50v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5zM0 650v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5zM600 50v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5zM600 650v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-400 q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5z" />
|
||||
<glyph unicode="" d="M0 50v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM0 450v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200 q-21 0 -35.5 14.5t-14.5 35.5zM0 850v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM400 50v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5 t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM400 450v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM400 850v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5 v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM800 50v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM800 450v200q0 21 14.5 35.5t35.5 14.5h200 q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM800 850v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5z" />
|
||||
<glyph unicode="" d="M0 50v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM0 450q0 -21 14.5 -35.5t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5v200q0 21 -14.5 35.5t-35.5 14.5h-200q-21 0 -35.5 -14.5 t-14.5 -35.5v-200zM0 850v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM400 50v200q0 21 14.5 35.5t35.5 14.5h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5 t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5zM400 450v200q0 21 14.5 35.5t35.5 14.5h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5zM400 850v200q0 21 14.5 35.5t35.5 14.5h700q21 0 35.5 -14.5t14.5 -35.5 v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5z" />
|
||||
<glyph unicode="" d="M29 454l419 -420l818 820l-212 212l-607 -607l-206 207z" />
|
||||
<glyph unicode="" d="M106 318l282 282l-282 282l212 212l282 -282l282 282l212 -212l-282 -282l282 -282l-212 -212l-282 282l-282 -282z" />
|
||||
<glyph unicode="" d="M23 693q0 200 142 342t342 142t342 -142t142 -342q0 -142 -78 -261l300 -300q7 -8 7 -18t-7 -18l-109 -109q-8 -7 -18 -7t-18 7l-300 300q-119 -78 -261 -78q-200 0 -342 142t-142 342zM176 693q0 -136 97 -233t234 -97t233.5 96.5t96.5 233.5t-96.5 233.5t-233.5 96.5 t-234 -97t-97 -233zM300 600v200h100v100h200v-100h100v-200h-100v-100h-200v100h-100z" />
|
||||
<glyph unicode="" d="M23 694q0 200 142 342t342 142t342 -142t142 -342q0 -141 -78 -262l300 -299q7 -7 7 -18t-7 -18l-109 -109q-8 -8 -18 -8t-18 8l-300 300q-119 -78 -261 -78q-200 0 -342 142t-142 342zM176 694q0 -136 97 -233t234 -97t233.5 97t96.5 233t-96.5 233t-233.5 97t-234 -97 t-97 -233zM300 601h400v200h-400v-200z" />
|
||||
<glyph unicode="" d="M23 600q0 183 105 331t272 210v-166q-103 -55 -165 -155t-62 -220q0 -177 125 -302t302 -125t302 125t125 302q0 120 -62 220t-165 155v166q167 -62 272 -210t105 -331q0 -118 -45.5 -224.5t-123 -184t-184 -123t-224.5 -45.5t-224.5 45.5t-184 123t-123 184t-45.5 224.5 zM500 750q0 -21 14.5 -35.5t35.5 -14.5h100q21 0 35.5 14.5t14.5 35.5v400q0 21 -14.5 35.5t-35.5 14.5h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-400z" />
|
||||
<glyph unicode="" d="M100 1h200v300h-200v-300zM400 1v500h200v-500h-200zM700 1v800h200v-800h-200zM1000 1v1200h200v-1200h-200z" />
|
||||
<glyph unicode="" d="M26 601q0 -33 6 -74l151 -38l2 -6q14 -49 38 -93l3 -5l-80 -134q45 -59 105 -105l133 81l5 -3q45 -26 94 -39l5 -2l38 -151q40 -5 74 -5q27 0 74 5l38 151l6 2q46 13 93 39l5 3l134 -81q56 44 104 105l-80 134l3 5q24 44 39 93l1 6l152 38q5 40 5 74q0 28 -5 73l-152 38 l-1 6q-16 51 -39 93l-3 5l80 134q-44 58 -104 105l-134 -81l-5 3q-45 25 -93 39l-6 1l-38 152q-40 5 -74 5q-27 0 -74 -5l-38 -152l-5 -1q-50 -14 -94 -39l-5 -3l-133 81q-59 -47 -105 -105l80 -134l-3 -5q-25 -47 -38 -93l-2 -6l-151 -38q-6 -48 -6 -73zM385 601 q0 88 63 151t152 63t152 -63t63 -151q0 -89 -63 -152t-152 -63t-152 63t-63 152z" />
|
||||
<glyph unicode="" d="M100 1025v50q0 10 7.5 17.5t17.5 7.5h275v100q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5v-100h275q10 0 17.5 -7.5t7.5 -17.5v-50q0 -11 -7 -18t-18 -7h-1050q-11 0 -18 7t-7 18zM200 100v800h900v-800q0 -41 -29.5 -71t-70.5 -30h-700q-41 0 -70.5 30 t-29.5 71zM300 100h100v700h-100v-700zM500 100h100v700h-100v-700zM500 1100h300v100h-300v-100zM700 100h100v700h-100v-700zM900 100h100v700h-100v-700z" />
|
||||
<glyph unicode="" d="M1 601l656 644l644 -644h-200v-600h-300v400h-300v-400h-300v600h-200z" />
|
||||
<glyph unicode="" d="M100 25v1150q0 11 7 18t18 7h475v-500h400v-675q0 -11 -7 -18t-18 -7h-850q-11 0 -18 7t-7 18zM700 800v300l300 -300h-300z" />
|
||||
<glyph unicode="" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM500 500v400h100 v-300h200v-100h-300z" />
|
||||
<glyph unicode="" d="M-100 0l431 1200h209l-21 -300h162l-20 300h208l431 -1200h-538l-41 400h-242l-40 -400h-539zM488 500h224l-27 300h-170z" />
|
||||
<glyph unicode="" d="M0 0v400h490l-290 300h200v500h300v-500h200l-290 -300h490v-400h-1100zM813 200h175v100h-175v-100z" />
|
||||
<glyph unicode="" d="M1 600q0 122 47.5 233t127.5 191t191 127.5t233 47.5t233 -47.5t191 -127.5t127.5 -191t47.5 -233t-47.5 -233t-127.5 -191t-191 -127.5t-233 -47.5t-233 47.5t-191 127.5t-127.5 191t-47.5 233zM188 600q0 -170 121 -291t291 -121t291 121t121 291t-121 291t-291 121 t-291 -121t-121 -291zM350 600h150v300h200v-300h150l-250 -300z" />
|
||||
<glyph unicode="" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM350 600l250 300 l250 -300h-150v-300h-200v300h-150z" />
|
||||
<glyph unicode="" d="M0 25v475l200 700h800l199 -700l1 -475q0 -11 -7 -18t-18 -7h-1150q-11 0 -18 7t-7 18zM200 500h200l50 -200h300l50 200h200l-97 500h-606z" />
|
||||
<glyph unicode="" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -172 121.5 -293t292.5 -121t292.5 121t121.5 293q0 171 -121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM500 397v401 l297 -200z" />
|
||||
<glyph unicode="" d="M23 600q0 -118 45.5 -224.5t123 -184t184 -123t224.5 -45.5t224.5 45.5t184 123t123 184t45.5 224.5h-150q0 -177 -125 -302t-302 -125t-302 125t-125 302t125 302t302 125q136 0 246 -81l-146 -146h400v400l-145 -145q-157 122 -355 122q-118 0 -224.5 -45.5t-184 -123 t-123 -184t-45.5 -224.5z" />
|
||||
<glyph unicode="" d="M23 600q0 118 45.5 224.5t123 184t184 123t224.5 45.5q198 0 355 -122l145 145v-400h-400l147 147q-112 80 -247 80q-177 0 -302 -125t-125 -302h-150zM100 0v400h400l-147 -147q112 -80 247 -80q177 0 302 125t125 302h150q0 -118 -45.5 -224.5t-123 -184t-184 -123 t-224.5 -45.5q-198 0 -355 122z" />
|
||||
<glyph unicode="" d="M100 0h1100v1200h-1100v-1200zM200 100v900h900v-900h-900zM300 200v100h100v-100h-100zM300 400v100h100v-100h-100zM300 600v100h100v-100h-100zM300 800v100h100v-100h-100zM500 200h500v100h-500v-100zM500 400v100h500v-100h-500zM500 600v100h500v-100h-500z M500 800v100h500v-100h-500z" />
|
||||
<glyph unicode="" d="M0 100v600q0 41 29.5 70.5t70.5 29.5h100v200q0 82 59 141t141 59h300q82 0 141 -59t59 -141v-200h100q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-900q-41 0 -70.5 29.5t-29.5 70.5zM400 800h300v150q0 21 -14.5 35.5t-35.5 14.5h-200 q-21 0 -35.5 -14.5t-14.5 -35.5v-150z" />
|
||||
<glyph unicode="" d="M100 0v1100h100v-1100h-100zM300 400q60 60 127.5 84t127.5 17.5t122 -23t119 -30t110 -11t103 42t91 120.5v500q-40 -81 -101.5 -115.5t-127.5 -29.5t-138 25t-139.5 40t-125.5 25t-103 -29.5t-65 -115.5v-500z" />
|
||||
<glyph unicode="" d="M0 275q0 -11 7 -18t18 -7h50q11 0 18 7t7 18v300q0 127 70.5 231.5t184.5 161.5t245 57t245 -57t184.5 -161.5t70.5 -231.5v-300q0 -11 7 -18t18 -7h50q11 0 18 7t7 18v300q0 116 -49.5 227t-131 192.5t-192.5 131t-227 49.5t-227 -49.5t-192.5 -131t-131 -192.5 t-49.5 -227v-300zM200 20v460q0 8 6 14t14 6h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14zM800 20v460q0 8 6 14t14 6h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14z" />
|
||||
<glyph unicode="" d="M0 400h300l300 -200v800l-300 -200h-300v-400zM688 459l141 141l-141 141l71 71l141 -141l141 141l71 -71l-141 -141l141 -141l-71 -71l-141 141l-141 -141z" />
|
||||
<glyph unicode="" d="M0 400h300l300 -200v800l-300 -200h-300v-400zM700 857l69 53q111 -135 111 -310q0 -169 -106 -302l-67 54q86 110 86 248q0 146 -93 257z" />
|
||||
<glyph unicode="" d="M0 401v400h300l300 200v-800l-300 200h-300zM702 858l69 53q111 -135 111 -310q0 -170 -106 -303l-67 55q86 110 86 248q0 145 -93 257zM889 951l7 -8q123 -151 123 -344q0 -189 -119 -339l-7 -8l81 -66l6 8q142 178 142 405q0 230 -144 408l-6 8z" />
|
||||
<glyph unicode="" d="M0 0h500v500h-200v100h-100v-100h-200v-500zM0 600h100v100h400v100h100v100h-100v300h-500v-600zM100 100v300h300v-300h-300zM100 800v300h300v-300h-300zM200 200v100h100v-100h-100zM200 900h100v100h-100v-100zM500 500v100h300v-300h200v-100h-100v-100h-200v100 h-100v100h100v200h-200zM600 0v100h100v-100h-100zM600 1000h100v-300h200v-300h300v200h-200v100h200v500h-600v-200zM800 800v300h300v-300h-300zM900 0v100h300v-100h-300zM900 900v100h100v-100h-100zM1100 200v100h100v-100h-100z" />
|
||||
<glyph unicode="" d="M0 200h100v1000h-100v-1000zM100 0v100h300v-100h-300zM200 200v1000h100v-1000h-100zM500 0v91h100v-91h-100zM500 200v1000h200v-1000h-200zM700 0v91h100v-91h-100zM800 200v1000h100v-1000h-100zM900 0v91h200v-91h-200zM1000 200v1000h200v-1000h-200z" />
|
||||
<glyph unicode="" d="M0 700l1 475q0 10 7.5 17.5t17.5 7.5h474l700 -700l-500 -500zM148 953q0 -42 29 -71q30 -30 71.5 -30t71.5 30q29 29 29 71t-29 71q-30 30 -71.5 30t-71.5 -30q-29 -29 -29 -71z" />
|
||||
<glyph unicode="" d="M1 700l1 475q0 11 7 18t18 7h474l700 -700l-500 -500zM148 953q0 -42 30 -71q29 -30 71 -30t71 30q30 29 30 71t-30 71q-29 30 -71 30t-71 -30q-30 -29 -30 -71zM701 1200h100l700 -700l-500 -500l-50 50l450 450z" />
|
||||
<glyph unicode="" d="M100 0v1025l175 175h925v-1000l-100 -100v1000h-750l-100 -100h750v-1000h-900z" />
|
||||
<glyph unicode="" d="M200 0l450 444l450 -443v1150q0 20 -14.5 35t-35.5 15h-800q-21 0 -35.5 -15t-14.5 -35v-1151z" />
|
||||
<glyph unicode="" d="M0 100v700h200l100 -200h600l100 200h200v-700h-200v200h-800v-200h-200zM253 829l40 -124h592l62 124l-94 346q-2 11 -10 18t-18 7h-450q-10 0 -18 -7t-10 -18zM281 24l38 152q2 10 11.5 17t19.5 7h500q10 0 19.5 -7t11.5 -17l38 -152q2 -10 -3.5 -17t-15.5 -7h-600 q-10 0 -15.5 7t-3.5 17z" />
|
||||
<glyph unicode="" d="M0 200q0 -41 29.5 -70.5t70.5 -29.5h1000q41 0 70.5 29.5t29.5 70.5v600q0 41 -29.5 70.5t-70.5 29.5h-150q-4 8 -11.5 21.5t-33 48t-53 61t-69 48t-83.5 21.5h-200q-41 0 -82 -20.5t-70 -50t-52 -59t-34 -50.5l-12 -20h-150q-41 0 -70.5 -29.5t-29.5 -70.5v-600z M356 500q0 100 72 172t172 72t172 -72t72 -172t-72 -172t-172 -72t-172 72t-72 172zM494 500q0 -44 31 -75t75 -31t75 31t31 75t-31 75t-75 31t-75 -31t-31 -75zM900 700v100h100v-100h-100z" />
|
||||
<glyph unicode="" d="M53 0h365v66q-41 0 -72 11t-49 38t1 71l92 234h391l82 -222q16 -45 -5.5 -88.5t-74.5 -43.5v-66h417v66q-34 1 -74 43q-18 19 -33 42t-21 37l-6 13l-385 998h-93l-399 -1006q-24 -48 -52 -75q-12 -12 -33 -25t-36 -20l-15 -7v-66zM416 521l178 457l46 -140l116 -317h-340 z" />
|
||||
<glyph unicode="" d="M100 0v89q41 7 70.5 32.5t29.5 65.5v827q0 28 -1 39.5t-5.5 26t-15.5 21t-29 14t-49 14.5v71l471 -1q120 0 213 -88t93 -228q0 -55 -11.5 -101.5t-28 -74t-33.5 -47.5t-28 -28l-12 -7q8 -3 21.5 -9t48 -31.5t60.5 -58t47.5 -91.5t21.5 -129q0 -84 -59 -156.5t-142 -111 t-162 -38.5h-500zM400 200h161q89 0 153 48.5t64 132.5q0 90 -62.5 154.5t-156.5 64.5h-159v-400zM400 700h139q76 0 130 61.5t54 138.5q0 82 -84 130.5t-239 48.5v-379z" />
|
||||
<glyph unicode="" d="M200 0v57q77 7 134.5 40.5t65.5 80.5l173 849q10 56 -10 74t-91 37q-6 1 -10.5 2.5t-9.5 2.5v57h425l2 -57q-33 -8 -62 -25.5t-46 -37t-29.5 -38t-17.5 -30.5l-5 -12l-128 -825q-10 -52 14 -82t95 -36v-57h-500z" />
|
||||
<glyph unicode="" d="M-75 200h75v800h-75l125 167l125 -167h-75v-800h75l-125 -167zM300 900v300h150h700h150v-300h-50q0 29 -8 48.5t-18.5 30t-33.5 15t-39.5 5.5t-50.5 1h-200v-850l100 -50v-100h-400v100l100 50v850h-200q-34 0 -50.5 -1t-40 -5.5t-33.5 -15t-18.5 -30t-8.5 -48.5h-49z " />
|
||||
<glyph unicode="" d="M33 51l167 125v-75h800v75l167 -125l-167 -125v75h-800v-75zM100 901v300h150h700h150v-300h-50q0 29 -8 48.5t-18 30t-33.5 15t-40 5.5t-50.5 1h-200v-650l100 -50v-100h-400v100l100 50v650h-200q-34 0 -50.5 -1t-39.5 -5.5t-33.5 -15t-18.5 -30t-8 -48.5h-50z" />
|
||||
<glyph unicode="" d="M0 50q0 -20 14.5 -35t35.5 -15h1100q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM0 350q0 -20 14.5 -35t35.5 -15h800q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-800q-21 0 -35.5 -14.5t-14.5 -35.5 v-100zM0 650q0 -20 14.5 -35t35.5 -15h1000q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-1000q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM0 950q0 -20 14.5 -35t35.5 -15h600q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-600q-21 0 -35.5 -14.5 t-14.5 -35.5v-100z" />
|
||||
<glyph unicode="" d="M0 50q0 -20 14.5 -35t35.5 -15h1100q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM0 650q0 -20 14.5 -35t35.5 -15h1100q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5 v-100zM200 350q0 -20 14.5 -35t35.5 -15h700q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-700q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM200 950q0 -20 14.5 -35t35.5 -15h700q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-700q-21 0 -35.5 -14.5 t-14.5 -35.5v-100z" />
|
||||
<glyph unicode="" d="M0 50v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15t-14.5 35zM100 650v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1000q-21 0 -35.5 15 t-14.5 35zM300 350v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800q-21 0 -35.5 15t-14.5 35zM500 950v100q0 21 14.5 35.5t35.5 14.5h600q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-600 q-21 0 -35.5 15t-14.5 35z" />
|
||||
<glyph unicode="" d="M0 50v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15t-14.5 35zM0 350v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15 t-14.5 35zM0 650v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15t-14.5 35zM0 950v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100 q-21 0 -35.5 15t-14.5 35z" />
|
||||
<glyph unicode="" d="M0 50v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35zM0 350v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15 t-14.5 35zM0 650v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35zM0 950v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15 t-14.5 35zM300 50v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800q-21 0 -35.5 15t-14.5 35zM300 350v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800 q-21 0 -35.5 15t-14.5 35zM300 650v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800q-21 0 -35.5 15t-14.5 35zM300 950v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15 h-800q-21 0 -35.5 15t-14.5 35z" />
|
||||
<glyph unicode="" d="M-101 500v100h201v75l166 -125l-166 -125v75h-201zM300 0h100v1100h-100v-1100zM500 50q0 -20 14.5 -35t35.5 -15h600q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-600q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM500 350q0 -20 14.5 -35t35.5 -15h300q20 0 35 15t15 35 v100q0 21 -15 35.5t-35 14.5h-300q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM500 650q0 -20 14.5 -35t35.5 -15h500q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM500 950q0 -20 14.5 -35t35.5 -15h100q20 0 35 15t15 35v100 q0 21 -15 35.5t-35 14.5h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-100z" />
|
||||
<glyph unicode="" d="M1 50q0 -20 14.5 -35t35.5 -15h600q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-600q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM1 350q0 -20 14.5 -35t35.5 -15h300q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-300q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM1 650 q0 -20 14.5 -35t35.5 -15h500q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM1 950q0 -20 14.5 -35t35.5 -15h100q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM801 0v1100h100v-1100 h-100zM934 550l167 -125v75h200v100h-200v75z" />
|
||||
<glyph unicode="" d="M0 275v650q0 31 22 53t53 22h750q31 0 53 -22t22 -53v-650q0 -31 -22 -53t-53 -22h-750q-31 0 -53 22t-22 53zM900 600l300 300v-600z" />
|
||||
<glyph unicode="" d="M0 44v1012q0 18 13 31t31 13h1112q19 0 31.5 -13t12.5 -31v-1012q0 -18 -12.5 -31t-31.5 -13h-1112q-18 0 -31 13t-13 31zM100 263l247 182l298 -131l-74 156l293 318l236 -288v500h-1000v-737zM208 750q0 56 39 95t95 39t95 -39t39 -95t-39 -95t-95 -39t-95 39t-39 95z " />
|
||||
<glyph unicode="" d="M148 745q0 124 60.5 231.5t165 172t226.5 64.5q123 0 227 -63t164.5 -169.5t60.5 -229.5t-73 -272q-73 -114 -166.5 -237t-150.5 -189l-57 -66q-10 9 -27 26t-66.5 70.5t-96 109t-104 135.5t-100.5 155q-63 139 -63 262zM342 772q0 -107 75.5 -182.5t181.5 -75.5 q107 0 182.5 75.5t75.5 182.5t-75.5 182t-182.5 75t-182 -75.5t-75 -181.5z" />
|
||||
<glyph unicode="" d="M1 600q0 122 47.5 233t127.5 191t191 127.5t233 47.5t233 -47.5t191 -127.5t127.5 -191t47.5 -233t-47.5 -233t-127.5 -191t-191 -127.5t-233 -47.5t-233 47.5t-191 127.5t-127.5 191t-47.5 233zM173 600q0 -177 125.5 -302t301.5 -125v854q-176 0 -301.5 -125 t-125.5 -302z" />
|
||||
<glyph unicode="" d="M117 406q0 94 34 186t88.5 172.5t112 159t115 177t87.5 194.5q21 -71 57.5 -142.5t76 -130.5t83 -118.5t82 -117t70 -116t50 -125.5t18.5 -136q0 -89 -39 -165.5t-102 -126.5t-140 -79.5t-156 -33.5q-114 6 -211.5 53t-161.5 139t-64 210zM243 414q14 -82 59.5 -136 t136.5 -80l16 98q-7 6 -18 17t-34 48t-33 77q-15 73 -14 143.5t10 122.5l9 51q-92 -110 -119.5 -185t-12.5 -156z" />
|
||||
<glyph unicode="" d="M0 400v300q0 165 117.5 282.5t282.5 117.5q366 -6 397 -14l-186 -186h-311q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v125l200 200v-225q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5 t-117.5 282.5zM436 341l161 50l412 412l-114 113l-405 -405zM995 1015l113 -113l113 113l-21 85l-92 28z" />
|
||||
<glyph unicode="" d="M0 400v300q0 165 117.5 282.5t282.5 117.5h261l2 -80q-133 -32 -218 -120h-145q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5l200 153v-53q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5 zM423 524q30 38 81.5 64t103 35.5t99 14t77.5 3.5l29 -1v-209l360 324l-359 318v-216q-7 0 -19 -1t-48 -8t-69.5 -18.5t-76.5 -37t-76.5 -59t-62 -88t-39.5 -121.5z" />
|
||||
<glyph unicode="" d="M0 400v300q0 165 117.5 282.5t282.5 117.5h300q61 0 127 -23l-178 -177h-349q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v69l200 200v-169q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5 t-117.5 282.5zM342 632l283 -284l567 567l-137 137l-430 -431l-146 147z" />
|
||||
<glyph unicode="" d="M0 603l300 296v-198h200v200h-200l300 300l295 -300h-195v-200h200v198l300 -296l-300 -300v198h-200v-200h195l-295 -300l-300 300h200v200h-200v-198z" />
|
||||
<glyph unicode="" d="M200 50v1000q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-437l500 487v-1100l-500 488v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5z" />
|
||||
<glyph unicode="" d="M0 50v1000q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-437l500 487v-487l500 487v-1100l-500 488v-488l-500 488v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5z" />
|
||||
<glyph unicode="" d="M136 550l564 550v-487l500 487v-1100l-500 488v-488z" />
|
||||
<glyph unicode="" d="M200 0l900 550l-900 550v-1100z" />
|
||||
<glyph unicode="" d="M200 150q0 -21 14.5 -35.5t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5v800q0 21 -14.5 35.5t-35.5 14.5h-200q-21 0 -35.5 -14.5t-14.5 -35.5v-800zM600 150q0 -21 14.5 -35.5t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5v800q0 21 -14.5 35.5t-35.5 14.5h-200 q-21 0 -35.5 -14.5t-14.5 -35.5v-800z" />
|
||||
<glyph unicode="" d="M200 150q0 -20 14.5 -35t35.5 -15h800q21 0 35.5 15t14.5 35v800q0 21 -14.5 35.5t-35.5 14.5h-800q-21 0 -35.5 -14.5t-14.5 -35.5v-800z" />
|
||||
<glyph unicode="" d="M0 0v1100l500 -487v487l564 -550l-564 -550v488z" />
|
||||
<glyph unicode="" d="M0 0v1100l500 -487v487l500 -487v437q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-1000q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v438l-500 -488v488z" />
|
||||
<glyph unicode="" d="M300 0v1100l500 -487v437q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-1000q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v438z" />
|
||||
<glyph unicode="" d="M100 250v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5zM100 500h1100l-550 564z" />
|
||||
<glyph unicode="" d="M185 599l592 -592l240 240l-353 353l353 353l-240 240z" />
|
||||
<glyph unicode="" d="M272 194l353 353l-353 353l241 240l572 -571l21 -22l-1 -1v-1l-592 -591z" />
|
||||
<glyph unicode="" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5zM300 500h200v-200h200v200h200v200h-200v200h-200v-200h-200v-200z" />
|
||||
<glyph unicode="" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5zM300 500h600v200h-600v-200z" />
|
||||
<glyph unicode="" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5zM246 459l213 -213l141 142l141 -142l213 213l-142 141l142 141l-213 212l-141 -141l-141 142l-212 -213l141 -141 z" />
|
||||
<glyph unicode="" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5zM270 551l276 -277l411 411l-175 174l-236 -236l-102 102z" />
|
||||
<glyph unicode="" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5zM364 700h143q4 0 11.5 -1t11 -1t6.5 3t3 9t1 11t3.5 8.5t3.5 6t5.5 4t6.5 2.5t9 1.5t9 0.5h11.5h12.5 q19 0 30 -10t11 -26q0 -22 -4 -28t-27 -22q-5 -1 -12.5 -3t-27 -13.5t-34 -27t-26.5 -46t-11 -68.5h200q5 3 14 8t31.5 25.5t39.5 45.5t31 69t14 94q0 51 -17.5 89t-42 58t-58.5 32t-58.5 15t-51.5 3q-50 0 -90.5 -12t-75 -38.5t-53.5 -74.5t-19 -114zM500 300h200v100h-200 v-100z" />
|
||||
<glyph unicode="" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5zM400 300h400v100h-100v300h-300v-100h100v-200h-100v-100zM500 800h200v100h-200v-100z" />
|
||||
<glyph unicode="" d="M0 500v200h195q31 125 98.5 199.5t206.5 100.5v200h200v-200q54 -20 113 -60t112.5 -105.5t71.5 -134.5h203v-200h-203q-25 -102 -116.5 -186t-180.5 -117v-197h-200v197q-140 27 -208 102.5t-98 200.5h-194zM290 500q24 -73 79.5 -127.5t130.5 -78.5v206h200v-206 q149 48 201 206h-201v200h200q-25 74 -75.5 127t-124.5 77v-204h-200v203q-75 -23 -130 -77t-79 -126h209v-200h-210z" />
|
||||
<glyph unicode="" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM356 465l135 135 l-135 135l109 109l135 -135l135 135l109 -109l-135 -135l135 -135l-109 -109l-135 135l-135 -135z" />
|
||||
<glyph unicode="" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM322 537l141 141 l87 -87l204 205l142 -142l-346 -345z" />
|
||||
<glyph unicode="" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -115 62 -215l568 567q-100 62 -216 62q-171 0 -292.5 -121.5t-121.5 -292.5zM391 245q97 -59 209 -59q171 0 292.5 121.5t121.5 292.5 q0 112 -59 209z" />
|
||||
<glyph unicode="" d="M0 547l600 453v-300h600v-300h-600v-301z" />
|
||||
<glyph unicode="" d="M0 400v300h600v300l600 -453l-600 -448v301h-600z" />
|
||||
<glyph unicode="" d="M204 600l450 600l444 -600h-298v-600h-300v600h-296z" />
|
||||
<glyph unicode="" d="M104 600h296v600h300v-600h298l-449 -600z" />
|
||||
<glyph unicode="" d="M0 200q6 132 41 238.5t103.5 193t184 138t271.5 59.5v271l600 -453l-600 -448v301q-95 -2 -183 -20t-170 -52t-147 -92.5t-100 -135.5z" />
|
||||
<glyph unicode="" d="M0 0v400l129 -129l294 294l142 -142l-294 -294l129 -129h-400zM635 777l142 -142l294 294l129 -129v400h-400l129 -129z" />
|
||||
<glyph unicode="" d="M34 176l295 295l-129 129h400v-400l-129 130l-295 -295zM600 600v400l129 -129l295 295l142 -141l-295 -295l129 -130h-400z" />
|
||||
<glyph unicode="" d="M23 600q0 118 45.5 224.5t123 184t184 123t224.5 45.5t224.5 -45.5t184 -123t123 -184t45.5 -224.5t-45.5 -224.5t-123 -184t-184 -123t-224.5 -45.5t-224.5 45.5t-184 123t-123 184t-45.5 224.5zM456 851l58 -302q4 -20 21.5 -34.5t37.5 -14.5h54q20 0 37.5 14.5 t21.5 34.5l58 302q4 20 -8 34.5t-32 14.5h-207q-21 0 -33 -14.5t-8 -34.5zM500 300h200v100h-200v-100z" />
|
||||
<glyph unicode="" d="M0 800h100v-200h400v300h200v-300h400v200h100v100h-111q1 1 1 6.5t-1.5 15t-3.5 17.5l-34 172q-11 39 -41.5 63t-69.5 24q-32 0 -61 -17l-239 -144q-22 -13 -40 -35q-19 24 -40 36l-238 144q-33 18 -62 18q-39 0 -69.5 -23t-40.5 -61l-35 -177q-2 -8 -3 -18t-1 -15v-6 h-111v-100zM100 0h400v400h-400v-400zM200 900q-3 0 14 48t36 96l18 47l213 -191h-281zM700 0v400h400v-400h-400zM731 900l202 197q5 -12 12 -32.5t23 -64t25 -72t7 -28.5h-269z" />
|
||||
<glyph unicode="" d="M0 -22v143l216 193q-9 53 -13 83t-5.5 94t9 113t38.5 114t74 124q47 60 99.5 102.5t103 68t127.5 48t145.5 37.5t184.5 43.5t220 58.5q0 -189 -22 -343t-59 -258t-89 -181.5t-108.5 -120t-122 -68t-125.5 -30t-121.5 -1.5t-107.5 12.5t-87.5 17t-56.5 7.5l-99 -55z M238.5 300.5q19.5 -6.5 86.5 76.5q55 66 367 234q70 38 118.5 69.5t102 79t99 111.5t86.5 148q22 50 24 60t-6 19q-7 5 -17 5t-26.5 -14.5t-33.5 -39.5q-35 -51 -113.5 -108.5t-139.5 -89.5l-61 -32q-369 -197 -458 -401q-48 -111 -28.5 -117.5z" />
|
||||
<glyph unicode="" d="M111 408q0 -33 5 -63q9 -56 44 -119.5t105 -108.5q31 -21 64 -16t62 23.5t57 49.5t48 61.5t35 60.5q32 66 39 184.5t-13 157.5q79 -80 122 -164t26 -184q-5 -33 -20.5 -69.5t-37.5 -80.5q-10 -19 -14.5 -29t-12 -26t-9 -23.5t-3 -19t2.5 -15.5t11 -9.5t19.5 -5t30.5 2.5 t42 8q57 20 91 34t87.5 44.5t87 64t65.5 88.5t47 122q38 172 -44.5 341.5t-246.5 278.5q22 -44 43 -129q39 -159 -32 -154q-15 2 -33 9q-79 33 -120.5 100t-44 175.5t48.5 257.5q-13 -8 -34 -23.5t-72.5 -66.5t-88.5 -105.5t-60 -138t-8 -166.5q2 -12 8 -41.5t8 -43t6 -39.5 t3.5 -39.5t-1 -33.5t-6 -31.5t-13.5 -24t-21 -20.5t-31 -12q-38 -10 -67 13t-40.5 61.5t-15 81.5t10.5 75q-52 -46 -83.5 -101t-39 -107t-7.5 -85z" />
|
||||
<glyph unicode="" d="M-61 600l26 40q6 10 20 30t49 63.5t74.5 85.5t97 90t116.5 83.5t132.5 59t145.5 23.5t145.5 -23.5t132.5 -59t116.5 -83.5t97 -90t74.5 -85.5t49 -63.5t20 -30l26 -40l-26 -40q-6 -10 -20 -30t-49 -63.5t-74.5 -85.5t-97 -90t-116.5 -83.5t-132.5 -59t-145.5 -23.5 t-145.5 23.5t-132.5 59t-116.5 83.5t-97 90t-74.5 85.5t-49 63.5t-20 30zM120 600q7 -10 40.5 -58t56 -78.5t68 -77.5t87.5 -75t103 -49.5t125 -21.5t123.5 20t100.5 45.5t85.5 71.5t66.5 75.5t58 81.5t47 66q-1 1 -28.5 37.5t-42 55t-43.5 53t-57.5 63.5t-58.5 54 q49 -74 49 -163q0 -124 -88 -212t-212 -88t-212 88t-88 212q0 85 46 158q-102 -87 -226 -258zM377 656q49 -124 154 -191l105 105q-37 24 -75 72t-57 84l-20 36z" />
|
||||
<glyph unicode="" d="M-61 600l26 40q6 10 20 30t49 63.5t74.5 85.5t97 90t116.5 83.5t132.5 59t145.5 23.5q61 0 121 -17l37 142h148l-314 -1200h-148l37 143q-82 21 -165 71.5t-140 102t-109.5 112t-72 88.5t-29.5 43zM120 600q210 -282 393 -336l37 141q-107 18 -178.5 101.5t-71.5 193.5 q0 85 46 158q-102 -87 -226 -258zM377 656q49 -124 154 -191l47 47l23 87q-30 28 -59 69t-44 68l-14 26zM780 161l38 145q22 15 44.5 34t46 44t40.5 44t41 50.5t33.5 43.5t33 44t24.5 34q-97 127 -140 175l39 146q67 -54 131.5 -125.5t87.5 -103.5t36 -52l26 -40l-26 -40 q-7 -12 -25.5 -38t-63.5 -79.5t-95.5 -102.5t-124 -100t-146.5 -79z" />
|
||||
<glyph unicode="" d="M-97.5 34q13.5 -34 50.5 -34h1294q37 0 50.5 35.5t-7.5 67.5l-642 1056q-20 34 -48 36.5t-48 -29.5l-642 -1066q-21 -32 -7.5 -66zM155 200l445 723l445 -723h-345v100h-200v-100h-345zM500 600l100 -300l100 300v100h-200v-100z" />
|
||||
<glyph unicode="" d="M100 262v41q0 20 11 44.5t26 38.5l363 325v339q0 62 44 106t106 44t106 -44t44 -106v-339l363 -325q15 -14 26 -38.5t11 -44.5v-41q0 -20 -12 -26.5t-29 5.5l-359 249v-263q100 -91 100 -113v-64q0 -20 -13 -28.5t-32 0.5l-94 78h-222l-94 -78q-19 -9 -32 -0.5t-13 28.5 v64q0 22 100 113v263l-359 -249q-17 -12 -29 -5.5t-12 26.5z" />
|
||||
<glyph unicode="" d="M0 50q0 -20 14.5 -35t35.5 -15h1000q21 0 35.5 15t14.5 35v750h-1100v-750zM0 900h1100v150q0 21 -14.5 35.5t-35.5 14.5h-150v100h-100v-100h-500v100h-100v-100h-150q-21 0 -35.5 -14.5t-14.5 -35.5v-150zM100 100v100h100v-100h-100zM100 300v100h100v-100h-100z M100 500v100h100v-100h-100zM300 100v100h100v-100h-100zM300 300v100h100v-100h-100zM300 500v100h100v-100h-100zM500 100v100h100v-100h-100zM500 300v100h100v-100h-100zM500 500v100h100v-100h-100zM700 100v100h100v-100h-100zM700 300v100h100v-100h-100zM700 500 v100h100v-100h-100zM900 100v100h100v-100h-100zM900 300v100h100v-100h-100zM900 500v100h100v-100h-100z" />
|
||||
<glyph unicode="" d="M0 200v200h259l600 600h241v198l300 -295l-300 -300v197h-159l-600 -600h-341zM0 800h259l122 -122l141 142l-181 180h-341v-200zM678 381l141 142l122 -123h159v198l300 -295l-300 -300v197h-241z" />
|
||||
<glyph unicode="" d="M0 400v600q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-596l-304 -300v300h-100q-41 0 -70.5 29.5t-29.5 70.5z" />
|
||||
<glyph unicode="" d="M100 600v200h300v-250q0 -113 6 -145q17 -92 102 -117q39 -11 92 -11q37 0 66.5 5.5t50 15.5t36 24t24 31.5t14 37.5t7 42t2.5 45t0 47v25v250h300v-200q0 -42 -3 -83t-15 -104t-31.5 -116t-58 -109.5t-89 -96.5t-129 -65.5t-174.5 -25.5t-174.5 25.5t-129 65.5t-89 96.5 t-58 109.5t-31.5 116t-15 104t-3 83zM100 900v300h300v-300h-300zM800 900v300h300v-300h-300z" />
|
||||
<glyph unicode="" d="M-30 411l227 -227l352 353l353 -353l226 227l-578 579z" />
|
||||
<glyph unicode="" d="M70 797l580 -579l578 579l-226 227l-353 -353l-352 353z" />
|
||||
<glyph unicode="" d="M-198 700l299 283l300 -283h-203v-400h385l215 -200h-800v600h-196zM402 1000l215 -200h381v-400h-198l299 -283l299 283h-200v600h-796z" />
|
||||
<glyph unicode="" d="M18 939q-5 24 10 42q14 19 39 19h896l38 162q5 17 18.5 27.5t30.5 10.5h94q20 0 35 -14.5t15 -35.5t-15 -35.5t-35 -14.5h-54l-201 -961q-2 -4 -6 -10.5t-19 -17.5t-33 -11h-31v-50q0 -20 -14.5 -35t-35.5 -15t-35.5 15t-14.5 35v50h-300v-50q0 -20 -14.5 -35t-35.5 -15 t-35.5 15t-14.5 35v50h-50q-21 0 -35.5 15t-14.5 35q0 21 14.5 35.5t35.5 14.5h535l48 200h-633q-32 0 -54.5 21t-27.5 43z" />
|
||||
<glyph unicode="" d="M0 0v800h1200v-800h-1200zM0 900v100h200q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5h500v-100h-1200z" />
|
||||
<glyph unicode="" d="M1 0l300 700h1200l-300 -700h-1200zM1 400v600h200q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5h500v-200h-1000z" />
|
||||
<glyph unicode="" d="M302 300h198v600h-198l298 300l298 -300h-198v-600h198l-298 -300z" />
|
||||
<glyph unicode="" d="M0 600l300 298v-198h600v198l300 -298l-300 -297v197h-600v-197z" />
|
||||
<glyph unicode="" d="M0 100v100q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5zM31 400l172 739q5 22 23 41.5t38 19.5h672q19 0 37.5 -22.5t23.5 -45.5l172 -732h-1138zM800 100h100v100h-100v-100z M1000 100h100v100h-100v-100z" />
|
||||
<glyph unicode="" d="M-101 600v50q0 24 25 49t50 38l25 13v-250l-11 5.5t-24 14t-30 21.5t-24 27.5t-11 31.5zM100 500v250v8v8v7t0.5 7t1.5 5.5t2 5t3 4t4.5 3.5t6 1.5t7.5 0.5h200l675 250v-850l-675 200h-38l47 -276q2 -12 -3 -17.5t-11 -6t-21 -0.5h-8h-83q-20 0 -34.5 14t-18.5 35 q-55 337 -55 351zM1100 200v850q0 21 14.5 35.5t35.5 14.5q20 0 35 -14.5t15 -35.5v-850q0 -20 -15 -35t-35 -15q-21 0 -35.5 15t-14.5 35z" />
|
||||
<glyph unicode="" d="M74 350q0 21 13.5 35.5t33.5 14.5h18l117 173l63 327q15 77 76 140t144 83l-18 32q-6 19 3 32t29 13h94q20 0 29 -10.5t3 -29.5q-18 -36 -18 -37q83 -19 144 -82.5t76 -140.5l63 -327l118 -173h17q20 0 33.5 -14.5t13.5 -35.5q0 -20 -13 -40t-31 -27q-8 -3 -23 -8.5 t-65 -20t-103 -25t-132.5 -19.5t-158.5 -9q-125 0 -245.5 20.5t-178.5 40.5l-58 20q-18 7 -31 27.5t-13 40.5zM497 110q12 -49 40 -79.5t63 -30.5t63 30.5t39 79.5q-48 -6 -102 -6t-103 6z" />
|
||||
<glyph unicode="" d="M21 445l233 -45l-78 -224l224 78l45 -233l155 179l155 -179l45 233l224 -78l-78 224l234 45l-180 155l180 156l-234 44l78 225l-224 -78l-45 233l-155 -180l-155 180l-45 -233l-224 78l78 -225l-233 -44l179 -156z" />
|
||||
<glyph unicode="" d="M0 200h200v600h-200v-600zM300 275q0 -75 100 -75h61q124 -100 139 -100h250q46 0 83 57l238 344q29 31 29 74v100q0 44 -30.5 84.5t-69.5 40.5h-328q28 118 28 125v150q0 44 -30.5 84.5t-69.5 40.5h-50q-27 0 -51 -20t-38 -48l-96 -198l-145 -196q-20 -26 -20 -63v-400z M400 300v375l150 213l100 212h50v-175l-50 -225h450v-125l-250 -375h-214l-136 100h-100z" />
|
||||
<glyph unicode="" d="M0 400v600h200v-600h-200zM300 525v400q0 75 100 75h61q124 100 139 100h250q46 0 83 -57l238 -344q29 -31 29 -74v-100q0 -44 -30.5 -84.5t-69.5 -40.5h-328q28 -118 28 -125v-150q0 -44 -30.5 -84.5t-69.5 -40.5h-50q-27 0 -51 20t-38 48l-96 198l-145 196 q-20 26 -20 63zM400 525l150 -212l100 -213h50v175l-50 225h450v125l-250 375h-214l-136 -100h-100v-375z" />
|
||||
<glyph unicode="" d="M8 200v600h200v-600h-200zM308 275v525q0 17 14 35.5t28 28.5l14 9l362 230q14 6 25 6q17 0 29 -12l109 -112q14 -14 14 -34q0 -18 -11 -32l-85 -121h302q85 0 138.5 -38t53.5 -110t-54.5 -111t-138.5 -39h-107l-130 -339q-7 -22 -20.5 -41.5t-28.5 -19.5h-341 q-7 0 -90 81t-83 94zM408 289l100 -89h293l131 339q6 21 19.5 41t28.5 20h203q16 0 25 15t9 36q0 20 -9 34.5t-25 14.5h-457h-6.5h-7.5t-6.5 0.5t-6 1t-5 1.5t-5.5 2.5t-4 4t-4 5.5q-5 12 -5 20q0 14 10 27l147 183l-86 83l-339 -236v-503z" />
|
||||
<glyph unicode="" d="M-101 651q0 72 54 110t139 38l302 -1l-85 121q-11 16 -11 32q0 21 14 34l109 113q13 12 29 12q11 0 25 -6l365 -230q7 -4 17 -10.5t26.5 -26t16.5 -36.5v-526q0 -13 -86 -93.5t-94 -80.5h-341q-16 0 -29.5 20t-19.5 41l-130 339h-107q-84 0 -139 39t-55 111zM-1 601h222 q15 0 28.5 -20.5t19.5 -40.5l131 -339h293l107 89v502l-343 237l-87 -83l145 -184q10 -11 10 -26q0 -11 -5 -20q-1 -3 -3.5 -5.5l-4 -4t-5 -2.5t-5.5 -1.5t-6.5 -1t-6.5 -0.5h-7.5h-6.5h-476v-100zM1000 201v600h200v-600h-200z" />
|
||||
<glyph unicode="" d="M97 719l230 -363q4 -6 10.5 -15.5t26 -25t36.5 -15.5h525q13 0 94 83t81 90v342q0 15 -20 28.5t-41 19.5l-339 131v106q0 84 -39 139t-111 55t-110 -53.5t-38 -138.5v-302l-121 84q-15 12 -33.5 11.5t-32.5 -13.5l-112 -110q-22 -22 -6 -53zM172 739l83 86l183 -146 q22 -18 47 -5q3 1 5.5 3.5l4 4t2.5 5t1.5 5.5t1 6.5t0.5 6.5v7.5v6.5v456q0 22 25 31t50 -0.5t25 -30.5v-202q0 -16 20 -29.5t41 -19.5l339 -130v-294l-89 -100h-503zM400 0v200h600v-200h-600z" />
|
||||
<glyph unicode="" d="M2 585q-16 -31 6 -53l112 -110q13 -13 32 -13.5t34 10.5l121 85q0 -51 -0.5 -153.5t-0.5 -148.5q0 -84 38.5 -138t110.5 -54t111 55t39 139v106l339 131q20 6 40.5 19.5t20.5 28.5v342q0 7 -81 90t-94 83h-525q-17 0 -35.5 -14t-28.5 -28l-10 -15zM77 565l236 339h503 l89 -100v-294l-340 -130q-20 -6 -40 -20t-20 -29v-202q0 -22 -25 -31t-50 0t-25 31v456v14.5t-1.5 11.5t-5 12t-9.5 7q-24 13 -46 -5l-184 -146zM305 1104v200h600v-200h-600z" />
|
||||
<glyph unicode="" d="M5 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5q162 0 299.5 -80t217.5 -218t80 -300t-80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5zM298 701l2 -201h300l-2 -194l402 294l-402 298v-197h-300z" />
|
||||
<glyph unicode="" d="M0 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t231.5 47.5q122 0 232.5 -47.5t190.5 -127.5t127.5 -190.5t47.5 -232.5q0 -162 -80 -299.5t-218 -217.5t-300 -80t-299.5 80t-217.5 217.5t-80 299.5zM200 600l402 -294l-2 194h300l2 201h-300v197z" />
|
||||
<glyph unicode="" d="M5 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5q162 0 299.5 -80t217.5 -218t80 -300t-80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5zM300 600h200v-300h200v300h200l-300 400z" />
|
||||
<glyph unicode="" d="M5 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5q162 0 299.5 -80t217.5 -218t80 -300t-80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5zM300 600l300 -400l300 400h-200v300h-200v-300h-200z" />
|
||||
<glyph unicode="" d="M5 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5q121 0 231.5 -47.5t190.5 -127.5t127.5 -190.5t47.5 -232.5q0 -162 -80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5zM254 780q-8 -33 5.5 -92.5t7.5 -87.5q0 -9 17 -44t16 -60 q12 0 23 -5.5t23 -15t20 -13.5q24 -12 108 -42q22 -8 53 -31.5t59.5 -38.5t57.5 -11q8 -18 -15 -55t-20 -57q42 -71 87 -80q0 -6 -3 -15.5t-3.5 -14.5t4.5 -17q104 -3 221 112q30 29 47 47t34.5 49t20.5 62q-14 9 -37 9.5t-36 7.5q-14 7 -49 15t-52 19q-9 0 -39.5 -0.5 t-46.5 -1.5t-39 -6.5t-39 -16.5q-50 -35 -66 -12q-4 2 -3.5 25.5t0.5 25.5q-6 13 -26.5 17t-24.5 7q2 22 -2 41t-16.5 28t-38.5 -20q-23 -25 -42 4q-19 28 -8 58q6 16 22 22q6 -1 26 -1.5t33.5 -4t19.5 -13.5q12 -19 32 -37.5t34 -27.5l14 -8q0 3 9.5 39.5t5.5 57.5 q-4 23 14.5 44.5t22.5 31.5q5 14 10 35t8.5 31t15.5 22.5t34 21.5q-6 18 10 37q8 0 23.5 -1.5t24.5 -1.5t20.5 4.5t20.5 15.5q-10 23 -30.5 42.5t-38 30t-49 26.5t-43.5 23q11 39 2 44q31 -13 58 -14.5t39 3.5l11 4q7 36 -16.5 53.5t-64.5 28.5t-56 23q-19 -3 -37 0 q-15 -12 -36.5 -21t-34.5 -12t-44 -8t-39 -6q-15 -3 -45.5 0.5t-45.5 -2.5q-21 -7 -52 -26.5t-34 -34.5q-3 -11 6.5 -22.5t8.5 -18.5q-3 -34 -27.5 -90.5t-29.5 -79.5zM518 916q3 12 16 30t16 25q10 -10 18.5 -10t14 6t14.5 14.5t16 12.5q0 -24 17 -66.5t17 -43.5 q-9 2 -31 5t-36 5t-32 8t-30 14zM692 1003h1h-1z" />
|
||||
<glyph unicode="" d="M0 164.5q0 21.5 15 37.5l600 599q-33 101 6 201.5t135 154.5q164 92 306 -9l-259 -138l145 -232l251 126q13 -175 -151 -267q-123 -70 -253 -23l-596 -596q-15 -16 -36.5 -16t-36.5 16l-111 110q-15 15 -15 36.5z" />
|
||||
<glyph unicode="" horiz-adv-x="1220" d="M0 196v100q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5zM0 596v100q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000 q-41 0 -70.5 29.5t-29.5 70.5zM0 996v100q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5zM600 596h500v100h-500v-100zM800 196h300v100h-300v-100zM900 996h200v100h-200v-100z" />
|
||||
<glyph unicode="" d="M100 1100v100h1000v-100h-1000zM150 1000h900l-350 -500v-300l-200 -200v500z" />
|
||||
<glyph unicode="" d="M0 200v200h1200v-200q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5zM0 500v400q0 41 29.5 70.5t70.5 29.5h300v100q0 41 29.5 70.5t70.5 29.5h200q41 0 70.5 -29.5t29.5 -70.5v-100h300q41 0 70.5 -29.5t29.5 -70.5v-400h-500v100h-200v-100h-500z M500 1000h200v100h-200v-100z" />
|
||||
<glyph unicode="" d="M0 0v400l129 -129l200 200l142 -142l-200 -200l129 -129h-400zM0 800l129 129l200 -200l142 142l-200 200l129 129h-400v-400zM729 329l142 142l200 -200l129 129v-400h-400l129 129zM729 871l200 200l-129 129h400v-400l-129 129l-200 -200z" />
|
||||
<glyph unicode="" d="M0 596q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM182 596q0 -172 121.5 -293t292.5 -121t292.5 121t121.5 293q0 171 -121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM291 655 q0 23 15.5 38.5t38.5 15.5t39 -16t16 -38q0 -23 -16 -39t-39 -16q-22 0 -38 16t-16 39zM400 850q0 22 16 38.5t39 16.5q22 0 38 -16t16 -39t-16 -39t-38 -16q-23 0 -39 16.5t-16 38.5zM514 609q0 32 20.5 56.5t51.5 29.5l122 126l1 1q-9 14 -9 28q0 22 16 38.5t39 16.5 q22 0 38 -16t16 -39t-16 -39t-38 -16q-14 0 -29 10l-55 -145q17 -22 17 -51q0 -36 -25.5 -61.5t-61.5 -25.5t-61.5 25.5t-25.5 61.5zM800 655q0 22 16 38t39 16t38.5 -15.5t15.5 -38.5t-16 -39t-38 -16q-23 0 -39 16t-16 39z" />
|
||||
<glyph unicode="" d="M-40 375q-13 -95 35 -173q35 -57 94 -89t129 -32q63 0 119 28q33 16 65 40.5t52.5 45.5t59.5 64q40 44 57 61l394 394q35 35 47 84t-3 96q-27 87 -117 104q-20 2 -29 2q-46 0 -78.5 -16.5t-67.5 -51.5l-389 -396l-7 -7l69 -67l377 373q20 22 39 38q23 23 50 23 q38 0 53 -36q16 -39 -20 -75l-547 -547q-52 -52 -125 -52q-55 0 -100 33t-54 96q-5 35 2.5 66t31.5 63t42 50t56 54q24 21 44 41l348 348q52 52 82.5 79.5t84 54t107.5 26.5q25 0 48 -4q95 -17 154 -94.5t51 -175.5q-7 -101 -98 -192l-252 -249l-253 -256l7 -7l69 -60 l517 511q67 67 95 157t11 183q-16 87 -67 154t-130 103q-69 33 -152 33q-107 0 -197 -55q-40 -24 -111 -95l-512 -512q-68 -68 -81 -163z" />
|
||||
<glyph unicode="" d="M80 784q0 131 98.5 229.5t230.5 98.5q143 0 241 -129q103 129 246 129q129 0 226 -98.5t97 -229.5q0 -46 -17.5 -91t-61 -99t-77 -89.5t-104.5 -105.5q-197 -191 -293 -322l-17 -23l-16 23q-43 58 -100 122.5t-92 99.5t-101 100q-71 70 -104.5 105.5t-77 89.5t-61 99 t-17.5 91zM250 784q0 -27 30.5 -70t61.5 -75.5t95 -94.5l22 -22q93 -90 190 -201q82 92 195 203l12 12q64 62 97.5 97t64.5 79t31 72q0 71 -48 119.5t-105 48.5q-74 0 -132 -83l-118 -171l-114 174q-51 80 -123 80q-60 0 -109.5 -49.5t-49.5 -118.5z" />
|
||||
<glyph unicode="" d="M57 353q0 -95 66 -159l141 -142q68 -66 159 -66q93 0 159 66l283 283q66 66 66 159t-66 159l-141 141q-8 9 -19 17l-105 -105l212 -212l-389 -389l-247 248l95 95l-18 18q-46 45 -75 101l-55 -55q-66 -66 -66 -159zM269 706q0 -93 66 -159l141 -141q7 -7 19 -17l105 105 l-212 212l389 389l247 -247l-95 -96l18 -17q47 -49 77 -100l29 29q35 35 62.5 88t27.5 96q0 93 -66 159l-141 141q-66 66 -159 66q-95 0 -159 -66l-283 -283q-66 -64 -66 -159z" />
|
||||
<glyph unicode="" d="M200 100v953q0 21 30 46t81 48t129 38t163 15t162 -15t127 -38t79 -48t29 -46v-953q0 -41 -29.5 -70.5t-70.5 -29.5h-600q-41 0 -70.5 29.5t-29.5 70.5zM300 300h600v700h-600v-700zM496 150q0 -43 30.5 -73.5t73.5 -30.5t73.5 30.5t30.5 73.5t-30.5 73.5t-73.5 30.5 t-73.5 -30.5t-30.5 -73.5z" />
|
||||
<glyph unicode="" d="M0 0l303 380l207 208l-210 212h300l267 279l-35 36q-15 14 -15 35t15 35q14 15 35 15t35 -15l283 -282q15 -15 15 -36t-15 -35q-14 -15 -35 -15t-35 15l-36 35l-279 -267v-300l-212 210l-208 -207z" />
|
||||
<glyph unicode="" d="M295 433h139q5 -77 48.5 -126.5t117.5 -64.5v335q-6 1 -15.5 4t-11.5 3q-46 14 -79 26.5t-72 36t-62.5 52t-40 72.5t-16.5 99q0 92 44 159.5t109 101t144 40.5v78h100v-79q38 -4 72.5 -13.5t75.5 -31.5t71 -53.5t51.5 -84t24.5 -118.5h-159q-8 72 -35 109.5t-101 50.5 v-307l64 -14q34 -7 64 -16.5t70 -31.5t67.5 -52t47.5 -80.5t20 -112.5q0 -139 -89 -224t-244 -96v-77h-100v78q-152 17 -237 104q-40 40 -52.5 93.5t-15.5 139.5zM466 889q0 -29 8 -51t16.5 -34t29.5 -22.5t31 -13.5t38 -10q7 -2 11 -3v274q-61 -8 -97.5 -37.5t-36.5 -102.5 zM700 237q170 18 170 151q0 64 -44 99.5t-126 60.5v-311z" />
|
||||
<glyph unicode="" d="M100 600v100h166q-24 49 -44 104q-10 26 -14.5 55.5t-3 72.5t25 90t68.5 87q97 88 263 88q129 0 230 -89t101 -208h-153q0 52 -34 89.5t-74 51.5t-76 14q-37 0 -79 -14.5t-62 -35.5q-41 -44 -41 -101q0 -28 16.5 -69.5t28 -62.5t41.5 -72h241v-100h-197q8 -50 -2.5 -115 t-31.5 -94q-41 -59 -99 -113q35 11 84 18t70 7q33 1 103 -16t103 -17q76 0 136 30l50 -147q-41 -25 -80.5 -36.5t-59 -13t-61.5 -1.5q-23 0 -128 33t-155 29q-39 -4 -82 -17t-66 -25l-24 -11l-55 145l16.5 11t15.5 10t13.5 9.5t14.5 12t14.5 14t17.5 18.5q48 55 54 126.5 t-30 142.5h-221z" />
|
||||
<glyph unicode="" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM602 900l298 300l298 -300h-198v-900h-200v900h-198z" />
|
||||
<glyph unicode="" d="M2 300h198v900h200v-900h198l-298 -300zM700 0v200h100v-100h200v-100h-300zM700 400v100h300v-200h-99v-100h-100v100h99v100h-200zM700 700v500h300v-500h-100v100h-100v-100h-100zM801 900h100v200h-100v-200z" />
|
||||
<glyph unicode="" d="M2 300h198v900h200v-900h198l-298 -300zM700 0v500h300v-500h-100v100h-100v-100h-100zM700 700v200h100v-100h200v-100h-300zM700 1100v100h300v-200h-99v-100h-100v100h99v100h-200zM801 200h100v200h-100v-200z" />
|
||||
<glyph unicode="" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM800 100v400h300v-500h-100v100h-200zM800 1100v100h200v-500h-100v400h-100zM901 200h100v200h-100v-200z" />
|
||||
<glyph unicode="" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM800 400v100h200v-500h-100v400h-100zM800 800v400h300v-500h-100v100h-200zM901 900h100v200h-100v-200z" />
|
||||
<glyph unicode="" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM700 100v200h500v-200h-500zM700 400v200h400v-200h-400zM700 700v200h300v-200h-300zM700 1000v200h200v-200h-200z" />
|
||||
<glyph unicode="" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM700 100v200h200v-200h-200zM700 400v200h300v-200h-300zM700 700v200h400v-200h-400zM700 1000v200h500v-200h-500z" />
|
||||
<glyph unicode="" d="M0 400v300q0 165 117.5 282.5t282.5 117.5h300q162 0 281 -118.5t119 -281.5v-300q0 -165 -118.5 -282.5t-281.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5zM200 300q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5 h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500z" />
|
||||
<glyph unicode="" d="M0 400v300q0 163 119 281.5t281 118.5h300q165 0 282.5 -117.5t117.5 -282.5v-300q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-163 0 -281.5 117.5t-118.5 282.5zM200 300q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5 h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500zM400 300l333 250l-333 250v-500z" />
|
||||
<glyph unicode="" d="M0 400v300q0 163 117.5 281.5t282.5 118.5h300q163 0 281.5 -119t118.5 -281v-300q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5zM200 300q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5 h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500zM300 700l250 -333l250 333h-500z" />
|
||||
<glyph unicode="" d="M0 400v300q0 165 117.5 282.5t282.5 117.5h300q165 0 282.5 -117.5t117.5 -282.5v-300q0 -162 -118.5 -281t-281.5 -119h-300q-165 0 -282.5 118.5t-117.5 281.5zM200 300q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5 h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500zM300 400h500l-250 333z" />
|
||||
<glyph unicode="" d="M0 400v300h300v200l400 -350l-400 -350v200h-300zM500 0v200h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5h-500v200h400q165 0 282.5 -117.5t117.5 -282.5v-300q0 -165 -117.5 -282.5t-282.5 -117.5h-400z" />
|
||||
<glyph unicode="" d="M217 519q8 -19 31 -19h302q-155 -438 -160 -458q-5 -21 4 -32l9 -8h9q14 0 26 15q11 13 274.5 321.5t264.5 308.5q14 19 5 36q-8 17 -31 17l-301 -1q1 4 78 219.5t79 227.5q2 15 -5 27l-9 9h-9q-15 0 -25 -16q-4 -6 -98 -111.5t-228.5 -257t-209.5 -237.5q-16 -19 -6 -41 z" />
|
||||
<glyph unicode="" d="M0 400q0 -165 117.5 -282.5t282.5 -117.5h300q47 0 100 15v185h-500q-41 0 -70.5 29.5t-29.5 70.5v500q0 41 29.5 70.5t70.5 29.5h500v185q-14 4 -114 7.5t-193 5.5l-93 2q-165 0 -282.5 -117.5t-117.5 -282.5v-300zM600 400v300h300v200l400 -350l-400 -350v200h-300z " />
|
||||
<glyph unicode="" d="M0 400q0 -165 117.5 -282.5t282.5 -117.5h300q163 0 281.5 117.5t118.5 282.5v98l-78 73l-122 -123v-148q0 -41 -29.5 -70.5t-70.5 -29.5h-500q-41 0 -70.5 29.5t-29.5 70.5v500q0 41 29.5 70.5t70.5 29.5h156l118 122l-74 78h-100q-165 0 -282.5 -117.5t-117.5 -282.5 v-300zM496 709l353 342l-149 149h500v-500l-149 149l-342 -353z" />
|
||||
<glyph unicode="" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM406 600 q0 80 57 137t137 57t137 -57t57 -137t-57 -137t-137 -57t-137 57t-57 137z" />
|
||||
<glyph unicode="" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM100 800l445 -500l450 500h-295v400h-300v-400h-300zM900 150h100v50h-100v-50z" />
|
||||
<glyph unicode="" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM100 700h300v-300h300v300h295l-445 500zM900 150h100v50h-100v-50z" />
|
||||
<glyph unicode="" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM100 705l305 -305l596 596l-154 155l-442 -442l-150 151zM900 150h100v50h-100v-50z" />
|
||||
<glyph unicode="" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM100 988l97 -98l212 213l-97 97zM200 400l697 1l3 699l-250 -239l-149 149l-212 -212l149 -149zM900 150h100v50h-100v-50z" />
|
||||
<glyph unicode="" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM200 612l212 -212l98 97l-213 212zM300 1200l239 -250l-149 -149l212 -212l149 148l249 -237l-1 697zM900 150h100v50h-100v-50z" />
|
||||
<glyph unicode="" d="M23 415l1177 784v-1079l-475 272l-310 -393v416h-392zM494 210l672 938l-672 -712v-226z" />
|
||||
<glyph unicode="" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-850q0 -21 -15 -35.5t-35 -14.5h-150v400h-700v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM600 1000h100v200h-100v-200z" />
|
||||
<glyph unicode="" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-218l-276 -275l-120 120l-126 -127h-378v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM581 306l123 123l120 -120l353 352l123 -123l-475 -476zM600 1000h100v200h-100v-200z" />
|
||||
<glyph unicode="" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-269l-103 -103l-170 170l-298 -298h-329v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM600 1000h100v200h-100v-200zM700 133l170 170l-170 170l127 127l170 -170l170 170l127 -128l-170 -169l170 -170 l-127 -127l-170 170l-170 -170z" />
|
||||
<glyph unicode="" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-300h-400v-200h-500v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM600 300l300 -300l300 300h-200v300h-200v-300h-200zM600 1000v200h100v-200h-100z" />
|
||||
<glyph unicode="" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-402l-200 200l-298 -298h-402v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM600 300h200v-300h200v300h200l-300 300zM600 1000v200h100v-200h-100z" />
|
||||
<glyph unicode="" d="M0 250q0 -21 14.5 -35.5t35.5 -14.5h1100q21 0 35.5 14.5t14.5 35.5v550h-1200v-550zM0 900h1200v150q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5v-150zM100 300v200h400v-200h-400z" />
|
||||
<glyph unicode="" d="M0 400l300 298v-198h400v-200h-400v-198zM100 800v200h100v-200h-100zM300 800v200h100v-200h-100zM500 800v200h400v198l300 -298l-300 -298v198h-400zM800 300v200h100v-200h-100zM1000 300h100v200h-100v-200z" />
|
||||
<glyph unicode="" d="M100 700v400l50 100l50 -100v-300h100v300l50 100l50 -100v-300h100v300l50 100l50 -100v-400l-100 -203v-447q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v447zM800 597q0 -29 10.5 -55.5t25 -43t29 -28.5t25.5 -18l10 -5v-397q0 -21 14.5 -35.5 t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5v1106q0 31 -18 40.5t-44 -7.5l-276 -116q-25 -17 -43.5 -51.5t-18.5 -65.5v-359z" />
|
||||
<glyph unicode="" d="M100 0h400v56q-75 0 -87.5 6t-12.5 44v394h500v-394q0 -38 -12.5 -44t-87.5 -6v-56h400v56q-4 0 -11 0.5t-24 3t-30 7t-24 15t-11 24.5v888q0 22 25 34.5t50 13.5l25 2v56h-400v-56q75 0 87.5 -6t12.5 -44v-394h-500v394q0 38 12.5 44t87.5 6v56h-400v-56q4 0 11 -0.5 t24 -3t30 -7t24 -15t11 -24.5v-888q0 -22 -25 -34.5t-50 -13.5l-25 -2v-56z" />
|
||||
<glyph unicode="" d="M0 300q0 -41 29.5 -70.5t70.5 -29.5h300q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5h-300q-41 0 -70.5 -29.5t-29.5 -70.5v-500zM100 100h400l200 200h105l295 98v-298h-425l-100 -100h-375zM100 300v200h300v-200h-300zM100 600v200h300v-200h-300z M100 1000h400l200 -200v-98l295 98h105v200h-425l-100 100h-375zM700 402v163l400 133v-163z" />
|
||||
<glyph unicode="" d="M16.5 974.5q0.5 -21.5 16 -90t46.5 -140t104 -177.5t175 -208q103 -103 207.5 -176t180 -103.5t137 -47t92.5 -16.5l31 1l163 162q17 18 13.5 41t-22.5 37l-192 136q-19 14 -45 12t-42 -19l-118 -118q-142 101 -268 227t-227 268l118 118q17 17 20 41.5t-11 44.5 l-139 194q-14 19 -36.5 22t-40.5 -14l-162 -162q-1 -11 -0.5 -32.5z" />
|
||||
<glyph unicode="" d="M0 50v212q0 20 10.5 45.5t24.5 39.5l365 303v50q0 4 1 10.5t12 22.5t30 28.5t60 23t97 10.5t97 -10t60 -23.5t30 -27.5t12 -24l1 -10v-50l365 -303q14 -14 24.5 -39.5t10.5 -45.5v-212q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-20 0 -35 14.5t-15 35.5zM0 712 q0 -21 14.5 -33.5t34.5 -8.5l202 33q20 4 34.5 21t14.5 38v146q141 24 300 24t300 -24v-146q0 -21 14.5 -38t34.5 -21l202 -33q20 -4 34.5 8.5t14.5 33.5v200q-6 8 -19 20.5t-63 45t-112 57t-171 45t-235 20.5q-92 0 -175 -10.5t-141.5 -27t-108.5 -36.5t-81.5 -40 t-53.5 -36.5t-31 -27.5l-9 -10v-200z" />
|
||||
<glyph unicode="" d="M100 0v100h1100v-100h-1100zM175 200h950l-125 150v250l100 100v400h-100v-200h-100v200h-200v-200h-100v200h-200v-200h-100v200h-100v-400l100 -100v-250z" />
|
||||
<glyph unicode="" d="M100 0h300v400q0 41 -29.5 70.5t-70.5 29.5h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-400zM500 0v1000q0 41 29.5 70.5t70.5 29.5h100q41 0 70.5 -29.5t29.5 -70.5v-1000h-300zM900 0v700q0 41 29.5 70.5t70.5 29.5h100q41 0 70.5 -29.5t29.5 -70.5v-700h-300z" />
|
||||
<glyph unicode="" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h300v300h-200v100h200v100h-300v-300h200v-100h-200v-100zM600 300h200v100h100v300h-100v100h-200v-500 zM700 400v300h100v-300h-100z" />
|
||||
<glyph unicode="" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h100v200h100v-200h100v500h-100v-200h-100v200h-100v-500zM600 300h200v100h100v300h-100v100h-200v-500 zM700 400v300h100v-300h-100z" />
|
||||
<glyph unicode="" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h300v100h-200v300h200v100h-300v-500zM600 300h300v100h-200v300h200v100h-300v-500z" />
|
||||
<glyph unicode="" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 550l300 -150v300zM600 400l300 150l-300 150v-300z" />
|
||||
<glyph unicode="" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300v500h700v-500h-700zM300 400h130q41 0 68 42t27 107t-28.5 108t-66.5 43h-130v-300zM575 549 q0 -65 27 -107t68 -42h130v300h-130q-38 0 -66.5 -43t-28.5 -108z" />
|
||||
<glyph unicode="" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h300v300h-200v100h200v100h-300v-300h200v-100h-200v-100zM601 300h100v100h-100v-100zM700 700h100 v-400h100v500h-200v-100z" />
|
||||
<glyph unicode="" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h300v400h-200v100h-100v-500zM301 400v200h100v-200h-100zM601 300h100v100h-100v-100zM700 700h100 v-400h100v500h-200v-100z" />
|
||||
<glyph unicode="" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 700v100h300v-300h-99v-100h-100v100h99v200h-200zM201 300v100h100v-100h-100zM601 300v100h100v-100h-100z M700 700v100h200v-500h-100v400h-100z" />
|
||||
<glyph unicode="" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM400 500v200 l100 100h300v-100h-300v-200h300v-100h-300z" />
|
||||
<glyph unicode="" d="M0 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM182 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM400 400v400h300 l100 -100v-100h-100v100h-200v-100h200v-100h-200v-100h-100zM700 400v100h100v-100h-100z" />
|
||||
<glyph unicode="" d="M-14 494q0 -80 56.5 -137t135.5 -57h222v300h400v-300h128q120 0 205 86.5t85 207.5t-85 207t-205 86q-46 0 -90 -14q-44 97 -134.5 156.5t-200.5 59.5q-152 0 -260 -107.5t-108 -260.5q0 -25 2 -37q-66 -14 -108.5 -67.5t-42.5 -122.5zM300 200h200v300h200v-300h200 l-300 -300z" />
|
||||
<glyph unicode="" d="M-14 494q0 -80 56.5 -137t135.5 -57h8l414 414l403 -403q94 26 154.5 104.5t60.5 178.5q0 120 -85 206.5t-205 86.5q-46 0 -90 -14q-44 97 -134.5 156.5t-200.5 59.5q-152 0 -260 -107.5t-108 -260.5q0 -25 2 -37q-66 -14 -108.5 -67.5t-42.5 -122.5zM300 200l300 300 l300 -300h-200v-300h-200v300h-200z" />
|
||||
<glyph unicode="" d="M100 200h400v-155l-75 -45h350l-75 45v155h400l-270 300h170l-270 300h170l-300 333l-300 -333h170l-270 -300h170z" />
|
||||
<glyph unicode="" d="M121 700q0 -53 28.5 -97t75.5 -65q-4 -16 -4 -38q0 -74 52.5 -126.5t126.5 -52.5q56 0 100 30v-306l-75 -45h350l-75 45v306q46 -30 100 -30q74 0 126.5 52.5t52.5 126.5q0 24 -9 55q50 32 79.5 83t29.5 112q0 90 -61.5 155.5t-150.5 71.5q-26 89 -99.5 145.5 t-167.5 56.5q-116 0 -197.5 -81.5t-81.5 -197.5q0 -4 1 -11.5t1 -11.5q-14 2 -23 2q-74 0 -126.5 -52.5t-52.5 -126.5z" />
|
||||
</font>
|
||||
</defs></svg>
|
||||
|
After Width: | Height: | Size: 62 KiB |
Binary file not shown.
Binary file not shown.
148
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/doc/_templates/layout.html
vendored
Normal file
148
Source/Benchmark-Toolbox/lib/borealis/library/lib/extern/fmt/doc/_templates/layout.html
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
{% extends "!layout.html" %}
|
||||
|
||||
{% block extrahead %}
|
||||
<meta name="description" content="Small, safe and fast formatting library">
|
||||
<meta name="keywords" content="C++, formatting, printf, string, library">
|
||||
<meta name="author" content="Victor Zverovich">
|
||||
<link rel="stylesheet" href="_static/fmt.css">
|
||||
{# Google Analytics #}
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-20116650-4"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'UA-20116650-4');
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{%- macro searchform(classes, button) %}
|
||||
<form class="{{classes}}" role="search" action="{{ pathto('search') }}"
|
||||
method="get">
|
||||
<div class="form-group">
|
||||
<input type="text" name="q" class="form-control"
|
||||
{{ 'placeholder="Search"' if not button }} >
|
||||
</div>
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
{% if button %}
|
||||
<input type="submit" class="btn btn-default" value="search">
|
||||
{% endif %}
|
||||
</form>
|
||||
{%- endmacro %}
|
||||
|
||||
{% block header %}
|
||||
<nav class="navbar navbar-inverse">
|
||||
<div class="tb-container">
|
||||
<div class="row">
|
||||
<div class="navbar-content">
|
||||
{# Brand and toggle get grouped for better mobile display #}
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed"
|
||||
data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="index.html">{fmt}</a>
|
||||
</div>
|
||||
|
||||
{# Collect the nav links, forms, and other content for toggling #}
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
|
||||
role="button" aria-expanded="false">{{ version }}
|
||||
<span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
{% for v in versions.split(',') %}
|
||||
<li><a href="https://fmt.dev/{{v}}">{{v}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% for name in ['Contents', 'Usage', 'API', 'Syntax'] %}
|
||||
{% if pagename == name.lower() %}
|
||||
<li class="active"><a href="{{name.lower()}}.html">{{name}}
|
||||
<span class="sr-only">(current)</span></a></li>
|
||||
{%else%}
|
||||
<li><a href="{{name.lower()}}.html">{{name}}</a></li>
|
||||
{%endif%}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if pagename != 'search' %}
|
||||
{{ searchform('navbar-form navbar-right', False) }}
|
||||
{%endif%}
|
||||
</div> {# /.navbar-collapse #}
|
||||
</div> {# /.col-md-offset-2 #}
|
||||
</div> {# /.row #}
|
||||
</div> {# /.tb-container #}
|
||||
</nav>
|
||||
{% if pagename == "index" %}
|
||||
{% set download_url = 'https://github.com/fmtlib/fmt/releases/download' %}
|
||||
<div class="jumbotron">
|
||||
<div class="tb-container">
|
||||
<h1>{fmt}</h1>
|
||||
<p class="lead">A modern formatting library</p>
|
||||
<div class="btn-group" role="group">
|
||||
{% set name = 'fmt' if version.split('.')[0]|int >= 3 else 'cppformat' %}
|
||||
<a class="btn btn-success"
|
||||
href="{{download_url}}/{{version}}/{{name}}-{{version}}.zip">
|
||||
<span class="glyphicon glyphicon-download"></span> Download
|
||||
</a>
|
||||
<button type="button" class="btn btn-success dropdown-toggle"
|
||||
data-toggle="dropdown"><span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
{% for v in versions.split(',') %}
|
||||
{% set name = 'fmt' if v.split('.')[0]|int >= 3 else 'cppformat' %}
|
||||
<li><a href="{{download_url}}/{{v}}/{{name}}-{{v}}.zip">Version {{v}}
|
||||
</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{# Disable relbars. #}
|
||||
{% block relbar1 %}
|
||||
{% endblock %}
|
||||
{% block relbar2 %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="tb-container">
|
||||
<div class="row">
|
||||
{# Sidebar is currently disabled.
|
||||
<div class="bs-sidebar">
|
||||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
{%- block sidebarlogo %}
|
||||
{%- if logo %}
|
||||
<p class="logo"><a href="{{ pathto(master_doc) }}">
|
||||
<img class="logo" src="{{ pathto('_static/' + logo, 1) }}"
|
||||
alt="Logo"/>
|
||||
</a></p>
|
||||
{%- endif %}
|
||||
{%- endblock %}
|
||||
{%- for sidebartemplate in sidebars %}
|
||||
{%- include sidebartemplate %}
|
||||
{%- endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
#}
|
||||
|
||||
<div class="content">
|
||||
{% block body %} {% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
{{ super() }}
|
||||
{# Placed at the end of the document so the pages load faster. #}
|
||||
<script src="_static/bootstrap.min.js"></script>
|
||||
{% endblock %}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user