RetroBlit 2.x to 3.0 Porting Guide
The main difference betwen RetroBlit 2.x and 3.0 is the new asset loading and management system. 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).
To convert from the old to the new asset system follow the example below
RetroBlit 2.x Example
const int SPRITESHEET_MAIN = 0;
const int SPRITEPACK_HERO = 1;
const int SOUND_BLEEPBLOOP = 0;
const int SOUND_EXPLOSION = 1;
const int MUSIC_TITLE = 0;
const int SHADER_WATER = 0;
const int SHADER_FOG = 1;
const int SHADER_FIRE = 1;
public void Initialize()
{
RB.SpriteSheetSetup(SPRITESHEET_MAIN, "main_sprites", new Vector2i(16, 16));
RB.SpriteSheetSetup(SPRITEPACK_HERO, "hero_spritepack", new Vector2i(16, 16));
RB.SpriteSheetSet(SPRITESHEET_MAIN);
RB.SoundSetup(SOUND_BLEEPBLOOP, "bleepbloop");
RB.SoundSetup(SOUND_EXPLOSION, "explosion");
RB.MusicSetup(MUSIC_TITLE, "title_music");
RB.ShaderSetup(SHADER_WATER, "water_shader");
RB.ShaderSetup(SHADER_FOG, "fog_shader");
RB.ShaderSetup(SHADER_FIRE, "fire_shader");
}
public void Render()
{
RB.SpriteSheetSet(SPRITESHEET_MAIN);
RB.DrawSprite(0, new Vector2i(100, 100));
} |
RetroBlit 3.0 Converted Example
Asynchronous Asset Loading
The above example is a 1:1 conversion from 2.x asset system to the new 3.0 system. However the new system brings new asset loading features that you may also want to explore.
The main purpose of the asset system redesign was to allow for new asset sources and asynchronous loading,
see Asynchronous Asset Loading for more information.
|