Giter Club home page Giter Club logo

Comments (2)

emilk avatar emilk commented on May 14, 2024

Hello!

As far as I know, nobody has made an SDL2 backend for Egui yet, so you can be the first!

How difficult this is depends on one things: are you using an OpenGL renderer with SDL2?

If yes, you can follow this short guide: https://github.com/emilk/egui#writing-your-own-egui-backend

However, if all your working with is sdl2::render::Canvas then you are going to have a harder time. In particular, the current structure of Egui expects you to be able to quickly paint textured triangles, which the SDL2 Canvas API does no support.

I have some plans for exposing egui::PaintCmd as the output of Egui. This would allow backends that work on higher level primitives such as rectangles, lines and text instead of just triangles. But writing a painter for egui::PaintCmd will probably be more work than a standard triangles based one.

from egui.

gamecubate avatar gamecubate commented on May 14, 2024

Hi @emilk . Thanks.

I am using the SDL2 canvas for content creation (drawing to Surface buffers).

let sdl = sdl2::init().unwrap();
let video_subsystem = sdl.video().unwrap();
let win = video_subsystem
     .window(title, SCREEN_WIDTH, SCREEN_HEIGHT)
     .position_centered()
     .build()
     .unwrap();
let mut canvas: WindowCanvas = win.into_canvas().build().unwrap();
...

EDIT
Decided to hop over to the OpenGL side.

from egui.

Related Issues (20)

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.