All Projects → BOT-Man-JL → EggAche-GL

BOT-Man-JL / EggAche-GL

Licence: MIT License
EggAche is a Lightweight, Cross-Platform C++ Graphics (GUI) Library

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to EggAche-GL

TrippyGL
A simple, lightweight yet highly versatile OpenGL graphics library
Stars: ✭ 71 (+294.44%)
Mutual labels:  graphics-library
nautilus
another graphics engine
Stars: ✭ 16 (-11.11%)
Mutual labels:  graphics-library
ElkEngine
Simple graphics engine used as submodule in many of my projects
Stars: ✭ 54 (+200%)
Mutual labels:  graphics-library
kinieta
A Fast Animation Engine with an Intuitive API
Stars: ✭ 44 (+144.44%)
Mutual labels:  graphics-library
cairo-cr
Cairo bindings for Crystal language.
Stars: ✭ 29 (+61.11%)
Mutual labels:  graphics-library
kcanvas
Yet another 2D API abstraction
Stars: ✭ 29 (+61.11%)
Mutual labels:  graphics-library
sdf-2d
A graphics library to enable the real-time rendering of 2D signed distance fields on the web.
Stars: ✭ 70 (+288.89%)
Mutual labels:  graphics-library
xfg-rs
eXtensible Framegraph
Stars: ✭ 34 (+88.89%)
Mutual labels:  graphics-library
gdx2d
A simple to use Java library for games and graphics, for desktop (PC, Linux and Mac) and Android.
Stars: ✭ 27 (+50%)
Mutual labels:  graphics-library
vtkbool
A new boolean operations filter for VTK
Stars: ✭ 77 (+327.78%)
Mutual labels:  graphics-library
cala
Cross-platform system interface for hardware IO
Stars: ✭ 46 (+155.56%)
Mutual labels:  graphics-library
graphicsvg
Graphics library authored by Chris Schankula and Dr. Christopher Anand
Stars: ✭ 42 (+133.33%)
Mutual labels:  graphics-library
Wasabi
Wasabi Vulkan Game Engine
Stars: ✭ 34 (+88.89%)
Mutual labels:  graphics-library
microgl
High-quality, no-compromise graphics library for embedded systems; currently under development.
Stars: ✭ 28 (+55.56%)
Mutual labels:  graphics-library
DiligentFX
High-level rendering components
Stars: ✭ 116 (+544.44%)
Mutual labels:  graphics-library
gfxprim
Open-source modular 2D bitmap graphics library with emphasis on speed and correctness.
Stars: ✭ 32 (+77.78%)
Mutual labels:  graphics-library
lime
A library for drawing graphics on the console screen
Stars: ✭ 32 (+77.78%)
Mutual labels:  graphics-library
Goulib
library of useful Python code for scientific + technical applications
Stars: ✭ 38 (+111.11%)
Mutual labels:  graphics-library
bgracontrols
🆗 BGRA Controls is a set of graphical UI elements that you can use with Lazarus LCL applications.
Stars: ✭ 113 (+527.78%)
Mutual labels:  graphics-library
Nabla
OpenGL/OpenGL ES/Vulkan/CUDA/OptiX Modular Rendering Framework for PC/Linux/Android
Stars: ✭ 235 (+1205.56%)
Mutual labels:  graphics-library

EggAche-GL

EggAche is a Lightweight, Cross-Platform C++ Graphics Library

  • You can easily embed the code WHEREVER there needs a GUI
  • You can take Snapshot of the Window (if there should be a Graphical Log)

Welcome to Join 😉

EggAche

Setup

Microsoft Windows

Requirements:

  • MSVC and Windows SDK (installed with Visual Studio)
  • g++ and MinGW

Steps:

  1. Download this Project's zip
  2. Add the EggAche.h, EggAche.cpp, EggAche_Impl.h and Windows_Impl.cpp in src directory to your project
  3. #include "EggAche.h" where you want to use EggAche Library
  4. Add #define EGGACHE_WINDOWS in EggAche.h to specify that you are on Windows

UNIX / X Window System

Support Linux, Mac OSX and other Unix/Unix-Like Systems.

Still on the way 😇

Get Started

Basic Usage

  • Create Window and Canvas
  • Draw on Background Canvas
  • Refresh Window
  • Wait for User Closing the Window
Window window (640, 480);               // Create a new Window
Canvas bgCanvas (640, 480);             // Create a new Canvas
window.SetBackground (&bgCanvas);       // Set Background Canvas of this Window

bgCanvas.DrawTxt (0, 0, "Hello EggAche");    // Draw Text at (0, 0)
bgCanvas.DrawLine (0, 30, 100, 30);          // Draw Line From (0, 30) to (100, 30)
bgCanvas.DrawImg ("Assets/Egg.bmp", 20, 50); // Draw Canvas at (20, 50)

window.Refresh ();                      // Refresh the Window to View Changes

while (!window.IsClosed ())             // Not Quit until the Window is closed
    std::this_thread::sleep_for (
        std::chrono::milliseconds (50));// Sleep just 50ms

Basic

Handling Click Event

  • Bind Event Handler to a Window
  • Associate an Canvas to another one
  • Take a Snapshot of the Window
Canvas lineCanvas (640, 480);           // Create a New Canvas
bgCanvas += &lineCanvas;                // Associate this new Canvas with Background Canvas

window.OnClick ([&]
(Window *, int x, int y)                // Register OnClick Event
{
    lineCanvas.Clear ();                // Clear Previous Content
    lineCanvas.DrawLine (0, 0, x, y);   // Draw Line from (0, 0) to the Point you Clicked
    window.Refresh ();                  // Refresh the Window to View Changes

    bgCanvas.SaveAsBmp ("Snapshot.bmp");// Take a Snapshot :-)
});

Click

And you will notice that Snapshot.bmp has been saved 😉

Simple Animation

  • Add Draw Lock into your Code 😉
  • Draw BMP File with a Color Mask
  • Add Animation into the Game Loop
std::mutex mtx;                         // Mutex for Draw Lock
// ...
window.OnClick ([&]
(Window *, int x, int y)
{
    // Lock for Draw
    std::lock_guard<std::mutex> lg (mtx);
    // ...
}
// ...
Canvas aniCanvas (73, 75,               // Create a New Canvas
                  100, 100);            // at (100, 100) initially
bgCanvas += &aniCanvas;                 // Associate this new Canvas with Background Canvas
aniCanvas.DrawImgMask ("Assets/EggMask.bmp",
                       "Assets/EggMask.bmp",
                       73, 75, 0, 0,
                       0, 0, 73, 0);
// Draw Image EggMask.bmp with a Mask in EggMask.bmp, of size 73 * 75, at (0, 0)
// And the left-top of Src Image is (0, 0), left-top of Mask Image is (74, 0)

auto offset = 0;
while (!window.IsClosed ())             // Rewrite this Part
{
    {
        // Lock for Draw
        std::lock_guard<std::mutex> lg (mtx);

        if (offset < 10) offset++;          // Update offset
        else offset = -10;
        aniCanvas.MoveTo (100 + offset * 10,// Move aniCanvas
                          100 + offset * 10);
        window.Refresh ();                  // Refresh Window
    }

    std::this_thread::sleep_for (
        std::chrono::milliseconds (50));    // Sleep just 50ms
}

Animation

More Samples

Update History

  • v1.0
    • This version is written in C
    • There's No Classes and Objects
    • There's only GDI Wrappers...
  • v2.0
    • This version is written in C++
    • Everything is encapsulated in Classes
  • v3.0
    • Decoupling Platform Dependency
    • Introducing C++ 11 Features (concept, lambda, stl...)
    • Using Bridge Pattern to Separate the Common Interface (EggAche_Impl.h) from Platform-specific Implementations (*_Impl.h)
    • Using Abstract Factory to Produce Platform-specific Implementation Objects for diverse Platforms (EggAche.cpp)
    • Using Composite Pattern to Define the Layout of Canvases (EggAche.h)
    • Using Adapter Pattern to Convert the interface of WindowImpl Events into Window Events (EggAche.cpp)
    • Using Observer Pattern to Notify Window Events and Auto Redraw (*_Impl.h)
    • Using Dependency Injection in Window Event System and Saving Images (EggAche.h, EggAche.cpp, *_Impl.cpp)
    • Using RAII Singleton Pattern to Maintain the Global Resource Manager (*_Impl.h)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].