Стартовый пул

This commit is contained in:
2024-04-02 08:46:59 +03:00
parent fd57fffd3a
commit 3bb34d000b
5591 changed files with 3291734 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="2">
<Item1 Name="Release" Default="True"/>
<Item2 Name="Debug">
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="../../../bin/$(TargetCPU)-$(TargetOS)/demo08"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir);../../../headers"/>
<OtherUnitFiles Value="../../../headers;../../../extra;../../../src;../../../lib/jpeg/$(TargetCPU)-$(TargetOS);../../../lib/msvcrt/$(TargetCPU);../../../lib/ogg/$(TargetCPU)-$(TargetOS);../../../lib/theora/$(TargetCPU)-$(TargetOS);../../../lib/zlib/$(TargetCPU)-$(TargetOS);../../../lib/zip/$(TargetCPU)-$(TargetOS)"/>
<UnitOutputDirectory Value="../tmp/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
<Optimizations>
<OptimizationLevel Value="0"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<UseHeaptrc Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<Verbosity>
<ShowNotes Value="False"/>
<ShowHints Value="False"/>
<ShowGenInfo Value="False"/>
</Verbosity>
</Other>
</CompilerOptions>
</Item2>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="BGRABitmapPack4NoGUI"/>
</Item1>
</RequiredPackages>
<Units Count="1">
<Unit0>
<Filename Value="demo08.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="../../../bin/$(TargetCPU)-$(TargetOS)/demo08"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir);../../../headers"/>
<OtherUnitFiles Value="../../../headers;../../../extra;../../../src;../../../lib/jpeg/$(TargetCPU)-$(TargetOS);../../../lib/msvcrt/$(TargetCPU);../../../lib/ogg/$(TargetCPU)-$(TargetOS);../../../lib/theora/$(TargetCPU)-$(TargetOS);../../../lib/zlib/$(TargetCPU)-$(TargetOS);../../../lib/zip/$(TargetCPU)-$(TargetOS)"/>
<UnitOutputDirectory Value="../tmp/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<UseLineInfoUnit Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<Verbosity>
<ShowNotes Value="False"/>
<ShowHints Value="False"/>
<ShowGenInfo Value="False"/>
</Verbosity>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,210 @@
program demo08;
{$I zglCustomConfig.cfg}
{$IFDEF WINDOWS}
{$R *.res}
{$ENDIF}
uses
BGRAZenGL in '..\BGRAZenGL.pas',
BGRABitmapTypes,
{$IFDEF USE_ZENGL_STATIC}
zgl_main,
zgl_screen,
zgl_window,
zgl_timers,
zgl_keyboard,
zgl_render_2d,
zgl_primitives_2d,
zgl_utils
{$ELSE}
zglHeader
{$ENDIF}
;
type
{ TMikuSprite }
TMikuSprite = class(TBGLSprite)
Speed: TPointF;
procedure OnInit; override;
procedure OnTimer; override;
procedure OnDraw; override;
end;
var
dirRes : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
fntMain : IBGLFont;
texLogo : IBGLTexture;
texMiku : IBGLTexture;
time : Integer;
{ TMikuSprite }
procedure TMikuSprite.OnInit;
var ratio: single;
begin
X := 800 + random( 800 ) + W/2;
Y := random( 600 - round(H) ) + H/2;
HorizontalAlign:= taCenter;
VerticalAlign:= tlCenter;
// RU: Задаем скорость движения.
// EN: Set the moving speed.
Speed.X := -random( 10 ) / 5 - 0.5;
Speed.Y := ( random( 10 ) - 5 ) / 5;
ratio := (Layer+3)/(9+3);
W := W*ratio;
H := H*ratio;
Color := BGRA(round(255*ratio),round(255*ratio),round(255*ratio));
end;
procedure TMikuSprite.OnTimer;
begin
Location := Location + Speed;
Frame := Frame + ( abs( speed.X ) + abs( speed.Y ) ) / 25;
if Frame >= 8.49 Then
Frame := 0.51;
// RU: Если спрайт выходит за пределы по X, сразу же удаляем его.
// EN: Delete the sprite if it goes beyond X.
if X < -W/2 Then QueryDestroy;
// RU: Если спрайт выходит за пределы по Y, ставим его в очередь на удаление.
// EN: Add sprite to queue for delete if it goes beyond Y.
if Y < -H/2 Then QueryDestroy;
if Y > 600+H/2 Then QueryDestroy;
end;
procedure TMikuSprite.OnDraw;
begin
if Layer = 9 then
Texture.BlendMode := obmAdd
else
Texture.BlendMode := obmNormal;
inherited OnDraw;
end;
// RU: Добавить 100 спрайтов.
// EN: Add 100 sprites.
procedure AddMiku;
var
i : Integer;
begin
for i := 1 to 100 do
TMikuSprite.Create( texMiku, random( 91 ) div 10 );
end;
// RU: Удалить 100 спрайтов.
// EN: Delete 100 sprites.
procedure DelMiku;
var
i : Integer;
begin
// RU: Удалим 100 спрайтов со случайным ID.
// EN: Delete 100 sprites with random ID.
for i := 1 to 100 do
BGLSpriteEngine.Delete( random( BGLSpriteEngine.Count ));
end;
procedure Init;
var
i : Integer;
begin
texLogo := BGLTexture( dirRes + 'zengl.png' );
texMiku := BGLTexture( dirRes + 'miku.png' );
texMiku.SetFrameSize( 128, 128 );
// RU: Создадим 200 спрайтов Miku-chan :)
// EN: Create 200 sprites of Miku-chan :)
for i := 1 to 2 do
AddMiku();
fntMain := BGLZenFont( dirRes + 'font.zfi' );
end;
procedure Draw;
begin
batch2d_Begin();
// RU: Рисуем все спрайты находящиеся в текущем спрайтовом менеджере.
// EN: Render all sprites contained in current sprite engine.
if time > 255 Then
begin
BGLSpriteEngine.OnDraw;
BGLCanvas.BlendMode := obmAdd;
BGLCanvas.FillEllipse(400,300,100,100, BGRA(255,0,0,128),False);
BGLCanvas.BlendMode := obmNormal;
end;
if time <= 255 Then
texLogo.Draw( 400, 300, taCenter, tlCenter, time )
else
if time < 510 Then
begin
BGLCanvas.FillRect(RectF(0, 0, 800, 600), BGRA(0,0,0,510 - time));
texLogo.Draw( 400, 300, taCenter, tlCenter, 510 - time)
end;
if time > 255 Then
begin
BGLCanvas.FillRect(RectF(0, 0, fntMain.TextWidth('Up/Down - Add/Delete Miku :)')+4, 64), BGRA(0,0,0,200));
fntMain.TextOut( 0, 0, 'FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) ) );
fntMain.TextOut( 0, 20, 'Sprites: ' + u_IntToStr( BGLSpriteEngine.Count ) );
fntMain.TextOut( 0, 40, 'Up/Down - Add/Delete Miku :)' );
end;
batch2d_End();
end;
procedure Timer;
begin
INC( time, 2 );
// RU: Выполняем обработку всех спрайтов в текущем спрайтовом менеджере.
// EN: Process all sprites contained in current sprite engine.
BGLSpriteEngine.OnTimer;
// RU: По нажатию пробела очистить все спрайты.
// EN: Delete all sprites if space was pressed.
if key_Press( K_SPACE ) Then BGLSpriteEngine.Clear;
if key_Press( K_UP ) Then AddMiku();
if key_Press( K_DOWN ) Then DelMiku();
if key_Press( K_ESCAPE ) Then zgl_Exit();
key_ClearState();
end;
procedure Quit;
begin
// RU: Очищаем память от созданных спрайтов.
// EN: Free allocated memory for sprites.
BGLSpriteEngine.Clear;
end;
Begin
{$IFNDEF USE_ZENGL_STATIC}
if not zglLoad( libZenGL ) Then exit;
{$ENDIF}
randomize;
timer_Add( @Timer, 16 );
timer_Add( @AddMiku, 1000 );
zgl_Reg( SYS_LOAD, @Init );
zgl_Reg( SYS_DRAW, @Draw );
zgl_Reg( SYS_EXIT, @Quit );
wnd_SetCaption( '08 - Sprite Engine' );
wnd_ShowCursor( TRUE );
scr_SetOptions( 800, 600, REFRESH_MAXIMUM, FALSE, FALSE );
zgl_Init();
End.

View File

@@ -0,0 +1,163 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="2">
<Item1 Name="Release" Default="True"/>
<Item2 Name="Debug">
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="../../../bin/demo08"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir);../../../headers"/>
<OtherUnitFiles Value="../../../headers;../../../extra;../../../src;../../../lib/jpeg/$(TargetCPU)-$(TargetOS);../../../lib/msvcrt/$(TargetCPU);../../../lib/ogg/$(TargetCPU)-$(TargetOS);../../../lib/theora/$(TargetCPU)-$(TargetOS);../../../lib/zlib/$(TargetCPU)-$(TargetOS);../../../lib/zip/$(TargetCPU)-$(TargetOS)"/>
<UnitOutputDirectory Value="../tmp/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
<VerifyObjMethodCallValidity Value="True"/>
<Optimizations>
<OptimizationLevel Value="0"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<UseHeaptrc Value="True"/>
</Debugging>
<Options>
<PassLinkerOptions Value="True"/>
<LinkerOptions Value="-macosx_version_min 10.4"/>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<Verbosity>
<ShowNotes Value="False"/>
<ShowHints Value="False"/>
<ShowGenInfo Value="False"/>
</Verbosity>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
<ExecuteAfter>
<Command Value="sh macosx_postbuild.sh"/>
</ExecuteAfter>
</Other>
</CompilerOptions>
</Item2>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="demo08.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="demo08"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="../../../bin/demo08"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir);../../../headers"/>
<OtherUnitFiles Value="../../../headers;../../../extra;../../../src;../../../lib/jpeg/$(TargetCPU)-$(TargetOS);../../../lib/msvcrt/$(TargetCPU);../../../lib/ogg/$(TargetCPU)-$(TargetOS);../../../lib/theora/$(TargetCPU)-$(TargetOS);../../../lib/zlib/$(TargetCPU)-$(TargetOS);../../../lib/zip/$(TargetCPU)-$(TargetOS)"/>
<UnitOutputDirectory Value="../tmp/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<UseLineInfoUnit Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<PassLinkerOptions Value="True"/>
<LinkerOptions Value="-macosx_version_min 10.4"/>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<Verbosity>
<ShowNotes Value="False"/>
<ShowHints Value="False"/>
<ShowGenInfo Value="False"/>
</Verbosity>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
<ExecuteAfter>
<Command Value="sh macosx_postbuild.sh"/>
</ExecuteAfter>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>demo08</string>
<key>CFBundleIconFile</key>
<string>demo08</string>
<key>CFBundleName</key>
<string>demo08</string>
<key>CFBundleIdentifier</key>
<string>zengl.demo08</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>demo</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,10 @@
# copy resources
cp ../../../bin/data/zengl.png ../../../bin/demo08.app/Contents/Resources/
cp ../../../bin/data/miku.png ../../../bin/demo08.app/Contents/Resources/
cp ../../../bin/data/font* ../../../bin/demo08.app/Contents/Resources/
# copy binary into bundle
rm ../../../bin/demo08.app/Contents/MacOS/demo08
cp ../../../bin/demo08 ../../../bin/demo08.app/Contents/MacOS/demo08
# make Info.plist and copy icon
cp -f demo08_macosx.plist ../../../bin/demo08.app/Contents/Info.plist
cp ../../../bin/data/zengl.icns ../../../bin/demo08.app/Contents/Resources/demo08.icns