FES 1.5.0 to RetroBlit 2.0.0 Porting Guide

There has been a number of changes in RetroBlit 2.0 from the previous version. If you plan on porting your project from an older version then this guide should help ease the porting work. Before doing any porting make sure you make a backup of your project, or use source control software (eg. git or svn). Follow these steps to get started:

  1. Create a new dummy project and get the RetroBlit asset for it from the Asset Store
  2. Go back to your original project and delete Assets/FES and replace with Assets/RetroBlit from the dummy project
  3. Replace:
  4. Search and Replace these strings in your entire project:
    • FESRB
    • Size2iVector2i
    • ColorRGBAColor32
  5. RetroBlit no longer supports indexed color mode. If your previous project was using indexed color mode then consider creating a color lookup table and using it in place of color indecies, for example:
using UnityEngine;

public class Pal
{
    // Color palette
    public static Color32[] C;

    // String representations of the color palette, for inline text coloring
    public static string[] S;

    // Call this once in your startup code
    public static void Initialize()
    {
        C = new Color32[256];

        C[0] = new Color32(000255);
        C[1] = new Color32(254255255255);
        C[2] = new Color32(464140255);
        C[3] = new Color32(22600255);
        C[4] = new Color32(2243334255);
        
        // Add more colors if needed

        S = new string[256];

        for (int i = 0; i < C.Length; i++)
        {
            S[i] = "@" + C[i].r.ToString("X2") + C[i].g.ToString("X2") + C[i].b.ToString("X2");
        }

        // Collect all the garbage generated by creating color strings!
        System.GC.Collect();
    }
}

Now you can use your color palette like this:

RB .DrawRect(new Rect2i(003232), Pal.C[2]);
RB.Print(new Vector2i(00), Pal.C[1], "Hit for " + Pal.S[3] + "10");