summaryrefslogtreecommitdiff
path: root/src/grids.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/grids.adb')
-rw-r--r--src/grids.adb60
1 files changed, 37 insertions, 23 deletions
diff --git a/src/grids.adb b/src/grids.adb
index 64f0c34..3da212b 100644
--- a/src/grids.adb
+++ b/src/grids.adb
@@ -15,8 +15,6 @@ package body Grids is
end Create;
-
-
function Create
(X, Y : in Integer)
return Grid is
@@ -27,21 +25,6 @@ package body Grids is
- procedure Draw
- (This : in out Grid) is
- begin
- for Y in Integer range 1 .. This.Rows loop
- for X in Integer range 1 .. This.Cols loop
- This.Cells.Reference (X).Reference (Y).Draw
- (This.Get_X + (X - 1) * Step,
- This.Get_Y + (Y - 1) * Step);
- end loop;
- end loop;
- end Draw;
-
-
-
-
procedure Set_Cols
(This : in out Grid;
To : in Natural) is
@@ -59,8 +42,6 @@ package body Grids is
end Set_Cols;
-
-
procedure Set_Rows
(This : in out Grid;
To : in Natural) is
@@ -87,8 +68,6 @@ package body Grids is
end In_Bounds;
-
-
function Get_Square
(This : in Grid;
X, Y : in Integer)
@@ -102,8 +81,6 @@ package body Grids is
end Get_Square;
-
-
procedure Set_Square
(This : in out Grid;
X, Y : in Integer;
@@ -113,5 +90,42 @@ package body Grids is
end Set_Square;
+
+
+ procedure Pixel_To_Colrow
+ (This : in Grid;
+ X, Y : in Integer;
+ C, R : out Integer) is
+ begin
+ C := X / Step + 1;
+ R := Y / Step + 1;
+ end Pixel_To_Colrow;
+
+
+ procedure Colrow_To_Pixel
+ (This : in Grid;
+ C, R : in Integer;
+ X, Y : out Integer) is
+ begin
+ X := (C - 1) * Step;
+ Y := (R - 1) * Step;
+ end Colrow_To_Pixel;
+
+
+
+
+ procedure Draw
+ (This : in out Grid) is
+ begin
+ for Y in Integer range 1 .. This.Rows loop
+ for X in Integer range 1 .. This.Cols loop
+ This.Cells.Reference (X).Reference (Y).Draw
+ (This.Get_X + (X - 1) * Step,
+ This.Get_Y + (Y - 1) * Step);
+ end loop;
+ end loop;
+ end Draw;
+
+
end Grids;