Search Unity

2D graphics programming API

Discussion in '2D' started by oliversb, Aug 23, 2014.

  1. oliversb

    oliversb

    Joined:
    Aug 23, 2014
    Posts:
    11
    Is there a standard 2D graphics API that is standard for a 2D game engine?

    Like this:
    http://www.createjs.com/Docs/EaselJS/classes/Graphics.html

    I want to be able to draw textures using this style of 2D graphics programming and use them textures in 3D and/or 2D games made in Unity.

    What should I look out to go about doing this?

    I need functions like:
    DrawRect
    DrawLine
    ForeColor

    The standard stuff.

    Thanks
     
  2. GarBenjamin

    GarBenjamin

    Joined:
    Dec 26, 2013
    Posts:
    7,441
    I'm not sure if you are completely new to Unity3D but overall it is a different approach. I mean like completely different. ;)

    Unity3D is a much more abstract and higher level way of doing things than drawing rectangles, lines or even blitting tiles or sprites to a buffer. It is a 3D engine... always even when making a 2D game. And the workflow is drastically different from what you would do with a Graphics API.

    Check out the official 2D platform game tutorial to see what I mean:
    http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-overview

    Maybe you already know all of that. So...

    There is support for drawing pixels on a texture:
    http://docs.unity3d.com/ScriptReference/Texture2D.html

    You should be able to use SetPixel to make your own line and rectangle drawing functions.
     
    omatase likes this.