HOWTO draw circles, arcs and vector graphics in SDL?

前端 未结 4 2049
一个人的身影
一个人的身影 2021-02-02 15:43

(I\'m using SDL2)

SDL is a relatively small library for \"low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D\" It\'s us

4条回答
  •  太阳男子
    2021-02-02 15:59

    If you want to write your own circle drawing function, then I'd suggest adapting the midpoint algorithm to SDL2 by drawing pixels.

    Curves would be done similarly, but would use more of an ellipses drawing algorithm.

    Actual vector graphics start to get much more complicated, and you'd probably have to find something that renders SVG files, which I'm not sure there are many options for SDL2.

    However, if you would rather simply have functions that you can work with I'd suggest going straight to SDL2_gfx instead. It has many more functions already implemented for you to work with.

提交回复
热议问题