Visage C++ Library Documentation

repository·main·Indexed 20 days ago

https://github.com/vitalaudio/visage

A GPU-accelerated, cross-platform C++ library for native UI frameworks and creative 2D graphics. Visage supports Direct3D11 on Windows, Metal on MacOS, Vulkan on Linux, and WebGL via Emscripten, featuring automatic shape batching and partial rendering for high-performance interfaces.

Tokens
400
Snippets
1
Records
3
Agent score
20%

What's inside Visage

  1. Overview of Visage features

    main
    Visage is a GPU-accelerated, cross-platform C++ library designed for both native UI and 2D creative graphics. It provides high-performance rendering through automatic shape batching and partial rendering (redrawing only dirty regions).
  2. Create a basic application with Visage

    main

    To create a native windowed application, use visage::ApplicationWindow. You can define custom drawing logic by assigning a lambda to the onDraw() callback, which provides a visage::Canvas object. The canvas object allows you to set colors and draw shapes like rectangles. Use app.show(width, height) to initialize the window dimensions and app.runEventLoop() to start processing window events. The loop will block until the window is closed.

    #include <visage/app.h>
    
    int main() {
      visage::ApplicationWindow app;
    
      app.onDraw() = [&app](visage::Canvas& canvas) {
        canvas.setColor(0xffff00ff);
        canvas.fill(0, 0, app.width(), app.height());
      };
    
      app.show(800, 600); // Opens as 800 x 600 pixel window
      app.runEventLoop(); // Runs window events. Returns when window is closed.
      return 0;
    }