Here's an interesting one.
It seems that if i set up my font AFTER I load images and sprite-engine graphics, the sprites all display as white squares, its probably not a bug but it did keep me busy for a few hours trying to figure it out.
White square sprites :
Code:
Procedure Do_Setup;
Begin
// --- Screen ---
Screen := TPHXScreen.getInstance();
Screen.Open('Invaders',-1,-1,800,600,False);
// --- Setup Canvas ---
Canvas := TPHXCanvas.Create;
// --- Setup timer ---
Timer:= TPHXTimer.Create;
// --- Collisions --- //
ColEngine := TPHXCollisionEngine.Create;
// --- Load images from map --- //
AllImages := TPHXImageList.Create;
AllImages.LoadImage('1945.phximg');
SpriteEngine := TPHXSpriteEngine.Create;
SpriteEngine.ImageList:= AllImages;
// --- Create a new layer with our spriteset --- //
SpriteEngine.Layers.Add(TPHXSpriteLayer.Create( SpriteEngine, '1945.png' ) );
CreateSprites(SpriteEngine, AllImages);
{--- Input --- }
Input:= TPHXInput.Create;
Input.Keyboard.KeyBinding[isButton1]:= KeyBinding(VK_SPACE);
Input.Keyboard.KeyBinding[isButton2]:= KeyBinding( Ord('B'), Ord('2'));
Input.Keyboard.KeyBinding[isButton3]:= KeyBinding( Ord('C'), Ord('3'));
Input.Keyboard.KeyBinding[isButton4]:= KeyBinding( VK_DELETE);
// --- set up the font for text output ---
Font := TPHXFont.Create;
Font.LoadFont('Arial16.phxfnt');
End;
Sprites displaying correctly:
Code:
Procedure Do_Setup;
Begin
// --- Screen ---
Screen := TPHXScreen.getInstance();
Screen.Open('Invaders',-1,-1,800,600,False);
// --- set up the font for text output ---
Font := TPHXFont.Create;
Font.LoadFont('Arial16.phxfnt');
// --- Setup Canvas ---
Canvas := TPHXCanvas.Create;
// --- Setup timer ---
Timer:= TPHXTimer.Create;
// --- Collisions --- //
ColEngine := TPHXCollisionEngine.Create;
// --- Load images from map --- //
AllImages := TPHXImageList.Create;
AllImages.LoadImage('1945.phximg');
SpriteEngine := TPHXSpriteEngine.Create;
SpriteEngine.ImageList:= AllImages;
// --- Create a new layer with our spriteset --- //
SpriteEngine.Layers.Add(TPHXSpriteLayer.Create( SpriteEngine, '1945.png' ) );
CreateSprites(SpriteEngine, AllImages);
{--- Input --- }
Input:= TPHXInput.Create;
Input.Keyboard.KeyBinding[isButton1]:= KeyBinding(VK_SPACE);
Input.Keyboard.KeyBinding[isButton2]:= KeyBinding( Ord('B'), Ord('2'));
Input.Keyboard.KeyBinding[isButton3]:= KeyBinding( Ord('C'), Ord('3'));
Input.Keyboard.KeyBinding[isButton4]:= KeyBinding( VK_DELETE);
End;
//----------------------------------------------------------------------------------//
Bookmarks