PDA

View Full Version : Piro Game Toolkit



drezgames
25-11-2021, 07:17 PM
https://raw.githubusercontent.com/tinyBigGAMES/PiroGameToolkit/main/media/logo.png

Overview

Piro Game Toolkit™ is a 2D indie game library that allows you to do game development in Delphi (https://www.embarcadero.com/products/delphi) for desktop PC's running Microsoft Windows® and uses OpenGL® for hardware accelerated rendering.
It's robust, designed for easy use and suitable for making all types of 2D games and other graphic simulations, you access the features from a simple and intuitive API, to allow you to rapidly and efficiently develop your projects. There is support for bitmaps, audio samples, streaming music, video playback, loading resources directly from a compressed and encrypted archive, a thin object-oriented actor/scene system, entity state machine, sprite management, collision detection and much more. Piro Game Toolkit, easy, fast & fun! This new library combines my previous libraries into one coherent whole, more efficient and better crafted.

Features


Free for commercial use.
Written in Object Pascal
Support Windows 64-bit platform
Hardware accelerated with OpenGL
You interact with the toolkit via routines, class objects and a thin OOP framework
Archive (custom archive format, password protection, encryption)
Display (OpenGL, anti-aliasing, vsync, viewports, primitives, blending)
Input (keyboard, mouse and joystick)
Bitmap (color key transparency, scaling, rotation, flipped, titled, BMP, DDS, PCX, TGA, JPEG, PNG)
Video (play, pause, rewind, OGV format)
Sprite (pages, groups, animation, poly-point collision)
Entity (defined from a sprite, position, scale, rotation, collision)
Actor (list, scene, state machine)
Audio (samples, streams, WAV, OGG/Vorbis, FLAC formats)
Speech (multiple voices, play, pause)
Font (true type, scale, rotate)
Timing (time-based, frame elapsed, frame speed)
Shaders (vertex, pixel, GLSL)
Misc (collision, easing, screenshake, screenshot, starfield, colors, INI based config files, startup dialog, treeview menu)


Minimum System Requirements


Delphi Community Edition (https://www.embarcadero.com/products/delphi/starter)
Microsoft Windows 10, 64 bits
OpenGL 3


How to use in Delphi


Unzip the archive to a desired location.
Add installdir\libs, folder to Delphi's library path so the toolkit source files can be found for any project or for a specific project add to its search path.
See examples in the installdir\examples for more information about usage.
Use PiroArc utility to make .ARC files (custom archive format, support encryption and password protection). Running makearc.bat in installdir\examples\bin will build Data.arc that is used by the examples.
Build PiroExamples to showcase many of the features and capabilities of the toolkit.
You must include PGT.dll in addition to any dependencies such an .ARC files for example, in your project distribution.
NOTE: For your assurance, all official executables in the PGT distro are code signed by tinyBigGAMES LLC.


Known Issues


This project is in active development so changes will be frequent
Documentation is WIP. They will continue to evolve
More examples will continually be added over time


A Tour of Piro Game Toolkit

Game Object

You just have to derive a new class from the TCustomGame base class and override a few callback methods. You access the toolkit functionality from the PiroGameToolkit unit.

uses
PiroGameToolkit;

const
cArchiveFilename = 'Data.arc';

cDisplayTitle = 'MyGame';
cDisplayWidth = 800;
cDisplayHeight = 480;
cDisplayFullscreen = False;

type
{ TMyGame }
TMyGame = class(TCustomGame)
protected
FFont: TFont;
public
procedure OnLoad; override;
procedure OnExit; override;
procedure OnStartup; override;
procedure OnShutdown; override;
procedure OnUpdate(aDeltaTime: Double); override;
procedure OnClearDisplay; override;
procedure OnShowDisplay; override;
procedure OnRender; override;
procedure OnRenderHUD; override;
end;

How to use

A minimal implementation example:

uses
System.SysUtils;

{ TMyGame }
procedure TMyGame.OnLoad;
begin
// open archive file
Piro.Archive.Open(cArchiveFilename);
end;

procedure TMyGame.OnExit;
begin
// close archive file
Piro.Archive.Close(cArchiveFilename);
end;

procedure TMyGame.OnStartup;
begin
// open display
Piro.Display.Open(cDisplayWidth, cDisplayHeight, cDisplayFullscreen, cDisplayTitle);

// create font
Piro.Get(IFont, FFont);

// use default mono spaced font
FFont.Load(16)
end;

procedure TMyGame.OnShutdown;
begin
// free font
Piro.Release(FFont);

// close display
Piro.Display.Close;
end;

procedure TMyGame.OnUpdate(aDeltaTime: Double);
begin
// process input
if Piro.Input.KeyboardPressed(KEY_ESCAPE) then
Piro.SetTerminate(True);
end;

procedure TMyGame.OnClearDisplay;
begin
// clear display
Piro.Display.Clear(BLACK);
end;

procedure TMyGame.OnShowDisplay;
begin
// show display
Piro.Display.Show;
end;

procedure TMyGame.OnRender;
begin
// render any graphics here
end;

procedure TMyGame.OnRenderHUD;
var
Pos: TVector;
begin
// assign hud start pos
Pos.Assign(3, 3, 0);

// display hud text
FFont.Print(FFont, Pos.X, Pos.Y, Pos.Z, WHITE, alLeft, 'fps %d', [Piro.GetFrameRate]);
FFont.Print(FFont, Pos.X, Pos.Y, 0, GREEN, alLeft, 'Esc - Quit', []);
end;

To run your game, call

PiroRun(TMyGame);

NOTE: For Piro to work properly, execution MUST start with PiroRun(...). This call will property setup/shutdown the library and log and handle errors. Only one Piro app instance is allowed to run and will safely terminated if more than one is detected.

SilverWarior
26-11-2021, 04:23 PM
This seems impressive. Will have to check it out one day

drezgames
26-11-2021, 07:08 PM
This seems impressive. Will have to check it out one day
Thanks. Yes, give it try when you get a chance. I'm adding new features, enhancements and fixing any reported bugs regularly.

drezgames
27-11-2021, 07:05 PM
In the next Piro drop, you will be able to do in-app purchase direct from the desktop. It's powered by Stripe.com and very easy to setup and use. Just set your API key you get from your stripe account, the transaction, credit card and customer information. You then call the IIAP.Buy method to create a charge. It will return TRUE if successful. There are various methods to check for errors and status. You can use IAsync if you need to run it a non-blocking.

1575

drezgames
29-11-2021, 07:45 PM
Added support for importing sprite animation created by PixelOver.
https://deakcor.itch.io/pixelover


https://vimeo.com/651261840

drezgames
02-12-2021, 07:01 PM
Adding a IMGUI system for Piro. This is what I got working so far.


https://vimeo.com/652595228