Giter Club home page Giter Club logo

ouzel's Introduction

ouzel

Ouzel v0.40

Build Status Build Status Quality Gate Join the chat at https://gitter.im/ouzelengine/Lobby

Ouzel is a C++ game engine mainly targeted for development of 2D games.

Supported platforms:

  • Windows 7, 8, 10
  • macOS 10.8+
  • GNU/Linux
  • iOS 8+
  • tvOS 9+
  • Android 3.0+
  • Emscripten (sample)

Supported rendering backends:

  • Direct3D 11
  • OpenGL 2, OpenGL 3 and OpenGL 4
  • OpenGL ES 2 and OpenGL ES 3
  • Metal

Supported audio backends:

  • XAudio 2
  • CoreAudio
  • OpenAL
  • OpenSL ES
  • ALSA

Features

  • Cross-platform (Windows, macOS, iOS, tvOS, Android, Linux, and Emscripten targets supported)
  • Multi-threaded (separate threads for rendering, sound, and game)
  • 2D and 3D scene management
  • GUI helper classes and management
  • Bitmap and true-type font support
  • Multiple side-by-side viewport support
  • XInput, DirectInput, IOKit, Apple GameController, and Linux evdev gamepad support
  • Actor animation (including tweening) system
  • Particle systems
  • Resource caching system
  • Localization support via loading string translations and UTF-8 string support
  • Software audio mixer for sound effect playback
  • High DPI support on Windows, macOS, and iOS
  • Easy to install (just pull the repository and build it)

Example app

The following code will open create a scene with a sprite in the center of it:

#include "assets/Bundle.hpp"
#include "core/Engine.hpp"
#include "scene/Camera.hpp"
#include "scene/Layer.hpp"
#include "scene/Scene.hpp"
#include "scene/SpriteRenderer.hpp"

class Example: public ouzel::Application
{
public:
    Example():
        assets{ouzel::engine->getCache(), ouzel::engine->getFileSystem()}
    {
        assets.loadAsset(ouzel::assets::Loader::Image, "player", "player.png");
        ouzel::engine->getSceneManager().setScene(&scene);
        scene.addLayer(&layer);
        cameraActor.addComponent(&camera);
        layer.addChild(&cameraActor);
        playerSprite.init("player");
        player.addComponent(&playerSprite);
        layer.addChild(&player);
    }

private:
    ouzel::scene::Scene scene;
    ouzel::scene::Layer layer;
    ouzel::scene::Camera camera;
    ouzel::scene::Actor cameraActor;
    ouzel::scene::SpriteRenderer playerSprite;
    ouzel::scene::Actor player;
    ouzel::assets::Bundle assets;
};

std::unique_ptr<ouzel::Application> ouzel::main(const std::vector<std::string>& args)
{
    return std::make_unique<Example>();
}

Showcase

2D platformer Bearslayer is being developed using Ouzel engine.

Bearslayer

Compilation

GNU makefile, Xcode project, and Visual Studio project files are located in the "build" directory. Makefile and project files for sample project are located in the "samples" directory.

You will need to download OpenGL (e.g. Mesa), ALSA, and OpenAL drivers installed in order to build Ouzel on Linux. For x86 Linux also libx11, libxcursor, libxi, libxrandr, and libxss are required.

To build Ouzel with Emscripten, pass "PLATFORM=emscripten" to "make" command, but make sure that you have Emscripten SDK installed before doing so:

$ make PLATFORM=emscripten

You can build Android samples and run them on an Android device by executing the following commands in "samples/android" directory (Android SDK and NDK must be installed and added to PATH):

$ gradle assembleDebug
$ gradle installDebug
$ adb shell am start -n org.ouzel/org.ouzel.MainActivity

To build Ouzel on Raspberry Pi, you will have to install Raspberry Pi development library (libraspberrypi-dev) and kernel headers (raspberrypi-kernel-headers)

Because on Raspbian Stretch libEGL.so was renamed to libbrcmEGL.so and libGLESv2.so to libbrcmGLESv2.so you will have to run the following commands before building the samples on Raspbian 8 (Jessie) or older:

$ sudo ln -s /opt/vc/lib/libEGL.so /opt/vc/lib/libbrcmEGL.so 
$ sudo ln -s /opt/vc/lib/libGLESv2.so /opt/vc/lib/libbrcmGLESv2.so

System requirements

  • Windows 7+ with Visual Studio 2017 or newer
  • macOS 10.10+ with Xcode 10+
  • Any reasonable new Linux distro (x86 and ARM are supported) with gcc 7+ or clang 5+

Getting help

You can ask question in the following locations:

License

Ouzel codebase is released to the Public Domain

ouzel's People

Contributors

archo5 avatar elnormous avatar gitter-badger avatar jorgenpt avatar princedeveloperof avatar taida957789 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ouzel's Issues

[Question] Scene events

Hi Elvis,

I was inspecting the samples project and I was wondering,
you have a single event handler for each type (keyboard, mouse, etc) per a scene - if you have 500 npcs of different types in 1 scene how do you manage their behavior (response) to each event that is sent in a organized and comfortable way?

I mean, how can you handle game logic easily this way?
if player attacks mob, where do you handle its response logic?
Or if a user clicks the right arrow button,
You do all the logic inside the scene’s handleKeyboardEvent method?

Shouldn’t the player input handling be encapsulated?

Thanks in advance

Ouzel samples don't run (Ubuntu 17.10, i3)

=> ./samples
Application directory: /home/acron/projects/personal/ouzel/samples
Failed to find file /home/acron/.org.ouzel/samples/settings.ini
Using OpenGL render driver
GLX OpenGL 3.2 context created
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  46
  Current serial number in output stream:  46

Compilation went fine, just won't make a window. Tried with and without i3, same result.

=> glxinfo | grep "OpenGL"                                                                                                                                                                                                                                   
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GT 730/PCIe/SSE2
OpenGL core profile version string: 4.5.0 NVIDIA 384.111
OpenGL core profile shading language version string: 4.50 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.5.0 NVIDIA 384.111
OpenGL shading language version string: 4.50 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)

=> glxgears -info
GL_RENDERER   = GeForce GT 730/PCIe/SSE2
GL_VERSION    = 4.5.0 NVIDIA 384.111
GL_VENDOR     = NVIDIA Corporation
GL_EXTENSIONS = ...

glxgears runs fine

cling based C++ as scripting language / hot code reload

cling based C++ as scripting language / hot code reload
Why? Able to run C++ script in runtime or compile it for max speed ( as in example https://github.com/derofim/cling-cmake )

HOT code reload
possible approaches:

store app state
fix cling undo for files
https://root-forum.cern.ch/t/loading-unloading-class-as-interpreted-macro-in-cling-multiple-times/32976/2

execute cling code to change callbacks & variables
nested cling::Interpreter with multiple cling::MetaProcessor
IDK how to do it, but you can create child cling::Interpreter

Memleak button eventhandler

Buttons' eventhandlers are added upon creation, rather than upon entering like Scenes.

sharedEngine->getEventDispatcher()->addEventHandler(&eventHandler);

This will leak. Maybe better put eventHandler adding/removing upon entering/leaving?

[Engine init] Exclusive full screen exception

if I set exclusive full screen setting to true in the Settings.ini file and start a new instance of the engine in Windows, the engine crashes in Window->init, as the window is initialized before the renderer.

I noticed the problem happens here:
File: NativeWindowWin.cpp
Method: switchFullscreen

Inside:
if (exclusiveFullscreen)
{
//uninitialized D3D renderer is called
// from the NativeWindowWin.
}

Am I doing anything wrong or is there a fix?

Thanks in advance

Missed CoInitializeEx before call CoCreateInstance.

In function handleDeviceConnect(const DIDEVICEINSTANCEW* didInstance) missed CoInitializeEx before call CoCreateInstance:

HRESULT hres = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
if (FAILED(hres))
{
	LOG_ERROR_F( "CoInitializeEx() failure:" , (unsigned long)hres );
	return;
}

Rasp pi 4 compilation error

Let me know if I'm missing make arguments. According to the docs, there should be a build directory but I am not seeing that. I tried running make anyway and get these errors:

 make
make -C engine DEBUG= PLATFORM= VC_DIR= 
make[1]: Entering directory '/home/pi/Code/ouzel/engine'
g++ -c -x c++  -std=c++17 -Wall -Wpedantic -Wextra -Wshadow -Wdouble-promotion -Woverloaded-virtual -Wold-style-cast -I"../shaders" -I"../external/khronos" -I"../external/smbPitchShift" -I"../external/stb" -O3 -include pch/cpp/Prefix.h -MMD -MP core/Window.cpp -o core/Window.o
In file included from core/Window.cpp:21:
core/linux/NativeWindowLinux.hpp:12:12: fatal error: bcm_host.h: No such file or directory

I have mesa, opengl, and dev lib packages installed already that are commonly used for pi development.

Ouzel reset shader uniform buffer offset at wrong place.

Code: master latest, sample project
Renderer: Metal

At RenderDeviceMetal.mm line 797, ouzel reset shaderConstantBuffer.offset = 0 if offset larger than it's size. But what if the shader buffer contains data which is committed yet.
I wrote a demo to draw 10k sprites with different uniforms, and only half of them are drawn correctly.

As shader buffer size is 1024 * 1024, and buffer alignment is 256, 1024 * 1024 = 256* (4*1024), it holds 4k uniforms at most.

Scale9Sprite

Buttons are better implemented using scale9 images (to allow for flexible resizing)

Run Sample crash by Android

Hello,guy:
when I run Android Sample application,click button then app crash,follow this:

2019-07-24 11:07:30.175 19782-19782/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-07-24 11:07:30.175 19782-19782/? A/DEBUG: Build fingerprint: 'OnePlus/OnePlus7Pro_CH/OnePlus7Pro:9/PKQ1.190110.001/1907122210:user/release-keys'
2019-07-24 11:07:30.175 19782-19782/? A/DEBUG: Revision: '0'
2019-07-24 11:07:30.175 19782-19782/? A/DEBUG: ABI: 'arm64'
2019-07-24 11:07:30.175 19782-19782/? A/DEBUG: pid: 19690, tid: 19738, name: Render >>> org.ouzel.samples <<<
2019-07-24 11:07:30.175 19782-19782/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
2019-07-24 11:07:30.175 19782-19782/? A/DEBUG: Abort message: '~/ouzel/samples/app/src/main/jni/../../../../../build/jni/../../ouzel/graphics/opengl/OGLRenderDevice.cpp:1132: virtual void ouzel::graphics::opengl::RenderDevice::process(): assertion "indexBuffer->getBufferId()" failed'
2019-07-24 11:07:30.175 19782-19782/? A/DEBUG: x0 0000000000000000 x1 0000000000004d1a x2 0000000000000006 x3 0000000000000008
2019-07-24 11:07:30.175 19782-19782/? A/DEBUG: x4 0000000000000000 x5 0000000000000000 x6 0000000000000000 x7 0000000000000030
2019-07-24 11:07:30.175 19782-19782/? A/DEBUG: x8 0000000000000083 x9 4cd220f5873fc22a x10 0000000000000000 x11 fffffffc7ffffbdf
2019-07-24 11:07:30.175 19782-19782/? A/DEBUG: x12 0000000000000001 x13 000000005d37cb72 x14 000180df9c14a7c1 x15 0000eac1dc13d4b5
2019-07-24 11:07:30.175 19782-19782/? A/DEBUG: x16 00000078fd5532a8 x17 00000078fd472be4 x18 00005505395ffbcb x19 0000000000004cea
2019-07-24 11:07:30.175 19782-19782/? A/DEBUG: x20 0000000000004d1a x21 000000785d9284f0 x22 000000786c783880 x23 000000785dfae520
2019-07-24 11:07:30.176 19782-19782/? A/DEBUG: x24 000000785d928570 x25 000000785d82b000 x26 00000078fe6595e0 x27 0000000000000002
2019-07-24 11:07:30.176 19782-19782/? A/DEBUG: x28 0000007ff29f8fed x29 000000785d926370
2019-07-24 11:07:30.176 19782-19782/? A/DEBUG: sp 000000785d926330 lr 00000078fd466314 pc 00000078fd46633c
2019-07-24 11:07:30.178 19782-19782/? A/DEBUG: backtrace:
2019-07-24 11:07:30.178 19782-19782/? A/DEBUG: #00 pc 000000000002233c /system/lib64/libc.so (abort+116)
2019-07-24 11:07:30.178 19782-19782/? A/DEBUG: #1 pc 00000000000226b4 /system/lib64/libc.so (__assert2+52)
2019-07-24 11:07:30.178 19782-19782/? A/DEBUG: #2 pc 00000000002f81f8 /data/app/org.ouzel.samples-yifDK61Md4cpZjgZN8V-tA==/lib/arm64/libmain.so (ouzel::graphics::opengl::RenderDevice::process()+8788)
2019-07-24 11:07:30.178 19782-19782/? A/DEBUG: #3 pc 00000000002df0e8 /data/app/org.ouzel.samples-yifDK61Md4cpZjgZN8V-tA==/lib/arm64/libmain.so (ouzel::graphics::opengl::RenderDeviceAndroid::renderMain()+488)
2019-07-24 11:07:30.178 19782-19782/? A/DEBUG: #4 pc 00000000002ee6dc /data/app/org.ouzel.samples-yifDK61Md4cpZjgZN8V-tA==/lib/arm64/libmain.so (ZNSt6__ndk114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEMN5ouzel8graphics6opengl19RenderDeviceAndroidEFvvEPSA_EEEEEPvSF+444)
2019-07-24 11:07:30.178 19782-19782/? A/DEBUG: #5 pc 00000000000901b4 /system/lib64/libc.so (__pthread_start(void*)+36)
2019-07-24 11:07:30.178 19782-19782/? A/DEBUG: #6 pc 0000000000023bf8 /system/lib64/libc.so (__start_thread+68)

Thanks . @elnormous

A lot of reallocations in vector assign a data.

In function

 bool FileSystem::readFile(const std::string& filename, std::vector<uint8_t>& data, bool searchResources) const;

... is a lot of reallocations in a vector:

     data.assign(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>());

Need append a code resize before assign.

For example:
std::streampos fileSize = file.tellg();
file.seekg(0, std::ios::end);
fileSize = file.tellg() - fileSize;
data.resize(fileSize);
file.seekg(0, std::ios_base::beg);

A vector resize will speed up file uploading in 10 times in the debug mode.

Extension string check is broken

Code below doesn't work for the OGLES extension string supplied.

                std::string extensions(reinterpret_cast<const char*>(extensionPtr));

                std::istringstream extensionStringStream(extensions);

                for (std::string extension; extensionStringStream >> extensions;)
                {
                    if (extension == "GL_OES_texture_npot")
                    {
                        npotTexturesSupported = true;
                    }

                    Log(Log::Level::INFO) << "npotTexturesSupported: " << npotTexturesSupported;

                }

GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_sync GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_EXT_sRGB GL_EXT_sRGB_write_c

macOS game controller problem

Getting Unknown axis runtime error with PS3 and PS4 V2 controllers. With the PS3 controller axis = 1 (kHIDUsage_GD_Pointer?) in getAxisIndex.

For PS4 V2 axis = 57 (0x39) which is kHIDUsage_GD_Hatswitch. The type is kIOHIDElementTypeInput_Misc and the usagePage is kHIDPage_GenericDesktop. This then calls getAxisIndex at line 106 of GamepadDeviceIOKit.cpp.

Running on macOS 11.2 using Xcode 12.4

kda direct buffer support

Does this engine have or plan to have KDA Direct buffer support like SDL2 has? KDA support would allow our games to be ported to embedded systems that lack window system support (like X window system support in ubuntu)

Add a buildsystem

I Like to build my projects in ninja, and for that and other further persons who'd like others than make, vs or xcode

integrate imgui or nuklear

hello, i want to integrate imgui or nuklear with ouzel, but don't know how to start, is there anyone has free time to do this.

How to communicate with ObjC and Java?

Hi,

How to communicate with ObjC and Java?

I want talk with platform libraries like payment, facebook and firebase.

There is something with callback to support it?

Thanks.

when is Camera.contentPosition used?

I can see that in SHOW_ALL mode of the camera, contentSize is scaled and contentPosition is set. However upon drawing, is contentPosition taken into account?

Say I have a screen (portrait) of 1200x1920, I set targetContentSize to be (600x400), the content is scaled to 1200x800. When drawing, this 1200x800 rectangle should be centered vertically,shouldn't it? I fail to see where in the engine that process this step.

Engine update thread

Hi Elnormous, Great work on your multi-platform support!

I have a question tho regarding Engine::run (). Won't it be hogging the CPU as it is not event-triggered (blocking mode) nor has it sleep ()?

[Question] Dynamic scenes

Hi, I notice that for each scene you actually create a source file (hpp and cpp).
Is it possible to have scene loading dynamically, let's say, from file:
for example, I have 1 text file containing all the scenes for example. Scenes.txt:

level_1,
level_2,
level_3

and to load them dynamically from the engine.

Would be more than happy to hear from you

Erroneous declaration of functions in the class SoundData

This is an incorrect function declaration:

    class SoundData
    {
    public:
        virtual bool init(const std::string& filename);
        virtual bool init(const std::vector<uint8_t>& newData);
    };

    class SoundDataWave: public SoundData
    {
    public:
        virtual bool init(const std::vector<uint8_t>& newData) override;
    };

Because some compilers accept std::string for std::vector<uint8_t>. As a result, "virtual bool init (const std::string& filename);" not visible in the classes of the heirs. I suggest changing the name of the function "virtual bool init(const std::vector<uint8_t>& newData);" on "virtual bool initData(const std::vector <uint8_t>& newData);".

For example:

string path = "24-bit.wav";

    // compile error:
SoundDataWave* pSoundDataWave = new SoundDataWave();
pSoundDataWave->init( path );

    // compile ok:
SoundData* pSoundDataWave = new SoundDataWave();
pSoundDataWave->init( path );

syntax error : "constant"

When building in Visual Studio 2017 (Windows) , i get Error Code : C2059 -- Syntax Error : "Constant" .
in line : 109 , in file : audiodevicexa2.cpp
const UINT XAUDIO2_DEBUG_ENGINE = 0x0001;

No script VM support?

Hi, I was just inspecting the engine, great work!
Just a tiny question, why haven't you included a built in script support (a VM) inside the engine for languages like Lua or Python?

Would love to hear your thoughts about this feature possibility in the engine.

Keep up the great job,
Ron

Samples crash with exception

Visual Studio 2017, Windows 10 SDK 10.0.18362.0
    msvcp140.dll!00007ff9c96b2e70()	Unknown

[Inline Frame] samples.exe!std::_Mtx_lockX(_Mtx_internal_imp_t *) Line 72 C++
[Inline Frame] samples.exe!std::_Mutex_base::lock() Line 49 C++
[Inline Frame] samples.exe!std::unique_lockstd::mutex::{ctor}(std::mutex &) Line 150 C++
samples.exe!ouzel::graphics::Graphics::handleEvent(const ouzel::graphics::RenderDevice::Event & event) Line 161 C++
[Inline Frame] samples.exe!std::_Func_class<void,ouzel::graphics::RenderDevice::Event const &>::operator()(const ouzel::graphics::RenderDevice::Event &) Line 43 C++
samples.exe!ouzel::graphics::RenderDevice::process() Line 45 C++
samples.exe!ouzel::graphics::d3d11::RenderDevice::process() Line 322 C++
samples.exe!ouzel::graphics::d3d11::RenderDevice::renderMain() Line 1114 C++
[External Code]

SetCursorPosition not working properly (?)

Was just inspecting the GUI sample and noticed that the SetCursorPosition is not working properly in Windows environment :

engine->getInputManager()->setCursorPosition(Vector2(10, 10));

I though it is because I have two monitors, at first, but that doesn't seem to work either.
Do you encounter this issue as well?

problem with lua binding

hi, i am trying to export lua binding with ouzel, using https://github.com/satoren/kaguya library.
and i have big step, 80% completed.
but there is problem i can't solve, becouse kaguya can't recognized member function and static member function when they have same name.
for example, Vector2::add and static Vector2::add
so i came to get your help. if you can change the static api name or some other way to solve this problem.

thanks for your attention.

Problem with handleKeyEvent(UINT msg, WPARAM wParam, LPARAM lParam)

This function don't catch LeftAlt, RightAlt and LeftGUI (VK_LWIN) keys:

void handleKeyEvent(UINT msg, WPARAM wParam, LPARAM lParam);

For LeftGUI (VK_LWIN) key need append:

	case VK_LWIN:
		if ((lParam & 0x1000000) == 0)
			vKey = VK_LWIN;
		else
			vKey = VK_RWIN;
		break;

For LeftAlt, RightAlt keys need append:

case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
case WM_KEYDOWN:
case WM_KEYUP:
    {
        handleKeyEvent(msg, wParam, lParam);
        break;
    }

Improvement: Friendly Colorname (ColorInfo)

Hi again
Please check my suggestion about having a friendly colorname.
I'm new to c++ and don't follow any convention/protocol so feel 100% free to adapt as you know best if you like this.
This was inspired by C# and MagikCore and overload of Color creation to add just the colorname instead of RGBA.

ColorInfo » Colornames to RGBA (outside Color to reduce memory footprint)
Color » overload to allow an easy Color("black"), Add a cache if too much called and an Exception if the color doesn't exist.

Thanks
Ricardo

ouzel.graphics.ColorInfo.zip
samples.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.