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

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

View File

@@ -0,0 +1,187 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="test_bcgamegrid"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<BuildModes Count="3">
<Item1 Name="Debug" Default="True"/>
<Item2 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="test_bcgamegrid"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="3"/>
<VariablesInRegisters Value="True"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item2>
<Item3 Name="Debug macOS 64">
<MacroValues Count="1">
<Macro1 Name="LCLWidgetType" Value="cocoa"/>
</MacroValues>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="test_bcgamegrid"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
<TargetCPU Value="x86_64"/>
<TargetOS Value="darwin"/>
<Optimizations>
<VariablesInRegisters Value="True"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
<UseHeaptrc Value="True"/>
<StripSymbols Value="True"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item3>
<SharedMatrixOptions Count="1">
<Item1 ID="347006526914" Modes="Debug macOS 64" Type="IDEMacro" MacroName="LCLWidgetType" Value="cocoa"/>
</SharedMatrixOptions>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default"/>
</Modes>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="bgracontrols"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="test_bcgamegrid.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="umain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="test_bcgamegrid"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
<Optimizations>
<VariablesInRegisters Value="True"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
<UseHeaptrc Value="True"/>
<StripSymbols Value="True"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</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,21 @@
program test_bcgamegrid;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, umain
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,39 @@
object Form1: TForm1
Left = 348
Height = 516
Top = 49
Width = 614
Caption = 'Form1'
ClientHeight = 516
ClientWidth = 614
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
OnKeyDown = FormKeyDown
LCLVersion = '1.1'
object BCGameGrid2: TBCGameGrid
Left = 6
Height = 508
Top = 8
Width = 608
GridWidth = 6
GridHeight = 6
BlockWidth = 60
BlockHeight = 50
OnRenderControl = BCGameGrid2RenderControl
OnClickControl = BCGameGrid2ClickControl
OnMouseDown = BCGameGrid2MouseDown
OnMouseMove = BCGameGrid2MouseMove
OnMouseUp = BCGameGrid2MouseUp
OnMouseEnter = BCGameGrid2MouseEnter
OnMouseLeave = BCGameGrid2MouseLeave
OnMouseWheel = BCGameGrid2MouseWheel
OnMouseWheelDown = BCGameGrid2MouseWheelDown
OnMouseWheelUp = BCGameGrid2MouseWheelUp
end
object Timer1: TTimer
Interval = 33
OnTimer = Timer1Timer
left = 40
top = 24
end
end

View File

@@ -0,0 +1,213 @@
unit umain;
{$mode objfpc}{$H+}
interface
uses
Classes, Forms, Graphics, SysUtils, BCGameGrid, BGRABitmap,
BGRABitmapTypes, types, Controls, Dialogs, ExtCtrls, LCLType, BCEffect;
type
{ TForm1 }
TForm1 = class(TForm)
BCGameGrid2: TBCGameGrid;
Timer1: TTimer;
procedure BCGameGrid2ClickControl(Sender: TObject; n, x, y: integer);
procedure BCGameGrid2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: integer);
procedure BCGameGrid2MouseEnter(Sender: TObject);
procedure BCGameGrid2MouseLeave(Sender: TObject);
procedure BCGameGrid2MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: integer);
procedure BCGameGrid2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: integer);
procedure BCGameGrid2MouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: integer; MousePos: TPoint; var Handled: boolean);
procedure BCGameGrid2MouseWheelDown(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: boolean);
procedure BCGameGrid2MouseWheelUp(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: boolean);
procedure BCGameGrid2RenderControl(Sender: TObject; Bitmap: TBGRABitmap;
r: TRect; n, x, y: integer);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormCreate(Sender: TObject);
procedure FormHide(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: word; Shift: TShiftState);
procedure Timer1Timer(Sender: TObject);
private
procedure SetFSelected(AValue: integer);
{ private declarations }
public
{ public declarations }
FSelected: integer;
Fade: TFading;
property Selected: integer read FSelected write SetFSelected;
end;
var
Form1: TForm1;
const
L1 = VK_LEFT;
R1 = VK_RIGHT;
U1 = VK_UP;
D1 = VK_DOWN;
L2 = VK_A;
R2 = VK_D;
U2 = VK_W;
D2 = VK_S;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.BCGameGrid2RenderControl(Sender: TObject; Bitmap: TBGRABitmap;
r: TRect; n, x, y: integer);
var
cr, cg, cb, ca: byte;
bmp: TBGRABitmap;
begin
cr := Random(100);
cg := Random(100);
cb := Random(255);
ca := Random(100);
// selected
if Selected = n then
begin
ca := 255;
Bitmap.FillRect(r, BGRA(0, 0, 255, Fade.Execute), dmSet);
end
// colors
else
begin
Bitmap.FillRect(r, BGRA(cr, cg, cb, ca), dmSet);
Bitmap.Rectangle(r, BGRA(100, 100, 100, ca), dmDrawWithTransparency);
end;
// text
Bitmap.TextRect(r, concat('n', IntToStr(n), ',x', IntToStr(x), ',y', IntToStr(y)),
taCenter, tlCenter, BGRA(0, 0, 0, ca));
// crazy effect
if n = BCGameGrid2.GridWidth * BCGameGrid2.GridHeight -1 then { remove this if you want to see the original thing... }
if Odd(n) then { this is for improve speed... }
begin
bmp := Bitmap.FilterBlurRadial(1, rbFast) as TBGRABitmap;
Bitmap.BlendImage(Random(4), Random(4), bmp, boLinearBlend);
bmp.Free;
end;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: boolean);
begin
Timer1.Enabled := False;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Fade.Mode := fmFadeInOut;
Fade.Step := 17;
Fade.Reset;
end;
procedure TForm1.FormHide(Sender: TObject);
begin
end;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: word; Shift: TShiftState);
begin
if (Key = L1) or (Key = L2) then
Selected := Selected - 1
else if (Key = R1) or (Key = R2) then
Selected := Selected + 1
else if (Key = U1) or (Key = U2) then
Selected := Selected - BCGameGrid2.GridWidth
else if (Key = D1) or (Key = D2) then
Selected := Selected + BCGameGrid2.GridWidth;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
BCGameGrid2.RenderAndDrawControl;
end;
procedure TForm1.SetFSelected(AValue: integer);
begin
if FSelected = AValue then
Exit;
FSelected := AValue;
end;
procedure TForm1.BCGameGrid2ClickControl(Sender: TObject; n, x, y: integer);
begin
Selected := n;
end;
procedure TForm1.BCGameGrid2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: integer);
begin
{if Button = mbLeft then
...}
end;
procedure TForm1.BCGameGrid2MouseEnter(Sender: TObject);
begin
//ShowMessage('Enter');
end;
procedure TForm1.BCGameGrid2MouseLeave(Sender: TObject);
begin
//ShowMessage('Leave');
end;
procedure TForm1.BCGameGrid2MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: integer);
begin
{if ssLeft in Shift then
...}
end;
procedure TForm1.BCGameGrid2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: integer);
begin
{if ssLeft in Shift then
...}
end;
procedure TForm1.BCGameGrid2MouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: integer; MousePos: TPoint; var Handled: boolean);
begin
//ShowMessage('Wheeeeel!');
end;
procedure TForm1.BCGameGrid2MouseWheelDown(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: boolean);
begin
{ Decrease grid }
BCGameGrid2.GridWidth := BCGameGrid2.GridWidth - 1;
BCGameGrid2.GridHeight := BCGameGrid2.GridHeight - 1;
end;
procedure TForm1.BCGameGrid2MouseWheelUp(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: boolean);
begin
{ Increase grid }
BCGameGrid2.GridWidth := BCGameGrid2.GridWidth + 1;
BCGameGrid2.GridHeight := BCGameGrid2.GridHeight + 1;
end;
end.