Bad Boy JH
2010-09-01 09:09:57
As many of you may or may not know, I have been creating a computer version of a board game, for a school project, using SCAR. fairly simple except part of my image, In a TImage is being cut off, and won't look good when I hand it in..
Any help is appreciated. (using Scar Divi 3.22 portable btw)
type
VisibleTile = record
Tile: Array[0..2] of TLabel;
TileImg: TImage;
end;
var
Board: TForm;
VisTile: Array[1..3] of Array of VisibleTile;
Procedure SetupVisTileB(Lvl, ID, X, Y: Integer; MainCapt, Value, MinorCapt: String);
var
I, b, w, h: Integer;
begin
For I := 0 to 3 do
VisTile[Lvl][ID].Tile[I] := TLabel.Create(Board);
VisTile[Lvl][ID].TileImg := TImage.Create(Board);
with VisTile[LVL][ID].TileImg do
begin
Parent := Board
Left := Y;
Top := X;
end;
b := LoadBitmap('Level1B.bmp');
GetbitmapSize(b, w, h);
CopyCanvas(GetBitmapCanvas(b), VisTile[LVL][ID].TileImg.Canvas, 0, 0, w, h, 0, 0, w, h);
With VisTile[Lvl][ID].Tile[0] do
begin
Parent := Board;
Left := Y;
Top := X + 10;
Caption := MainCapt;
WORDWRAP := True;
Alignment := taCenter;
Height := 60;
Width := 80;
end;
With VisTile[Lvl][ID].Tile[1] do
begin
Parent := Board;
Left := Y;
Top := X + 70;
Caption := Value;
WORDWRAP := True;
Alignment := taCenter;
Height := 20;
Width := 80;
end;
With VisTIle[Lvl][ID].Tile[2] do
begin
Parent := Board;
Left := Y;
Top := X + 90;
Caption := MinorCapt;
WORDWRAP := True;
Alignment := taCenter;
Height := 20;
Width := 80;
end;
end;
Procedure SetupVisTileL(Lvl, ID, X, Y: Integer; MainCapt, Value, MinorCapt: String);
var
MCapt: String;
I, b, w, h, Number: Integer;
begin
For I := 0 to 3 do
VisTile[Lvl][ID].Tile[I] := TLabel.Create(Board);
VisTile[Lvl][ID].TileImg := TImage.Create(Board);
with VisTile[LVL][ID].TileImg do
begin
Parent := Board
Left := Y;
Top := X;
end;
b := LoadBitmap('Level1L.bmp');
GetbitmapSize(b, w, h);
CopyCanvas(GetBitmapCanvas(b), VisTile[LVL][ID].TileImg.Canvas, 0, 0, w, h, 0, 0, w, h);
With VisTile[Lvl][ID].Tile[0] do
begin
Parent := Board;
Left := Y + 20;
Top := X;
Caption := MainCapt;
WORDWRAP := True;
Alignment := taCenter;
Height := 60;
Width := 80;
end;
With VisTile[Lvl][ID].Tile[1] do
begin
Parent := Board;
Left := Y+ 20;
Top := X + 60;
Caption := Value;
WORDWRAP := True;
Alignment := taCenter;
Height := 20;
Width := 80;
end;
For I := 1 to Length(MinorCapt) do
begin
MCapt := MCapt + Copy(MinorCapt, I, 1);
if I > Ceil(Number * Length(MinorCapt) / 6.0) then
begin
Inc(Number);
MCapt := MCapt + ' ';
end;
end;
MCapt := Trim(MCapt);
With VisTIle[Lvl][ID].Tile[2] do
begin
Parent := Board;
Left := Y + 3;
Top := X;
Caption := MCapt;
WORDWRAP := True;
Alignment := taCenter;
Height := 80;
Width := 14;
end;
end;
Procedure OpenBoard;
var
I: Integer;
begin
Board := CreateForm;
Board.Left := 100;
Board.Top := 160;
Board.Width := 300;
Board.Height := 500;
Board.Caption := 'Rum Rebellion';
Board.Color := ClWhite;
SetLength(VisTile[1], 52);
SetLength(VisTile[1], 40);
SetLength(VisTile[1], 32);
For I := 25 downto 14 do
SetupVisTileL(1, I, 10 + (25 - I) * 80, 5, 'Allow Convict to escape on your ship', '3 barrels', 'Misfortune');
For I := 12 downto 1 do
SetupVisTileB(1, I, 10 + 12 * 80, 35 + (13 - i) * 80, 'Allow Convict to escape on your ship', '3 barrels', 'Crime');
end;
procedure SafeOpenBoard;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('OpenBoard', v);
end;
procedure ShowBoardModal;
begin
Board.ShowModal;
end;
procedure SafeShowBoardModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowBoardModal', v);
end;
begin
SafeOpenBoard;
SafeShowBoardModal;
end.this is part of the game (Part of the actual board) and the images on the left are being cut off…(Im going to attach the two images I am using, called Level1B, and Level1L (Bottom and Left, I have another two ready for the top and the right))Any help is appreciated. (using Scar Divi 3.22 portable btw)