From 6e5b33a195324bd33d946cad15844139d1ba9650 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Tue, 15 May 2018 16:47:35 +1000 Subject: Updated to bring into line with FLTK binding --- src/displays.adb | 10 +++++----- src/displays.ads | 4 ++-- src/grids.adb | 2 +- src/sokoban.adb | 22 +++++++++++----------- src/squares.ads | 8 ++++---- src/things.ads | 4 ++-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/displays.adb b/src/displays.adb index 0a3df2b..e7d241b 100644 --- a/src/displays.adb +++ b/src/displays.adb @@ -25,13 +25,13 @@ package body Displays is My_Height : Integer := Misc.Max (Message_Box_Height + Stat_Box_Height, H); begin return This : Display := - (WD.Double_Window'(WD.Create (X, Y, My_Width, My_Height, Text)) with + (WD.Double_Window'(WD.Forge.Create (X, Y, My_Width, My_Height, Text)) with - Message_Box => B.Box'(B.Create + Message_Box => B.Box'(B.Forge.Create (0, 0, Message_Box_Width, Message_Box_Height, "")), - Level_Box => B.Box'(B.Create + Level_Box => B.Box'(B.Forge.Create (0, Message_Box_Height, Stat_Box_Width, Stat_Box_Height, "")), - Move_Box => B.Box'(B.Create + Move_Box => B.Box'(B.Forge.Create (Stat_Box_Width, Message_Box_Height, Stat_Box_Width, Stat_Box_Height, "")), Current_Grid => null, Key_Func => null, @@ -175,7 +175,7 @@ package body Displays is use type FLTK.Event_Kind, FLTK.Event_Outcome; begin if This.Key_Func /= null and then Event = FLTK.Keydown and then - This.Key_Func (FLTK.Event.Last_Keypress) = FLTK.Handled + This.Key_Func (FLTK.Press (FLTK.Event.Last_Key)) = FLTK.Handled then return FLTK.Handled; diff --git a/src/displays.ads b/src/displays.ads index 89e4542..22f3bed 100644 --- a/src/displays.ads +++ b/src/displays.ads @@ -21,7 +21,7 @@ package Displays is type Keyboard_Callback is access function - (Key : in FLTK.Shortcut_Key) + (Key : in FLTK.Key_Combo) return FLTK.Event_Outcome; type Mouse_Callback is access function @@ -109,7 +109,7 @@ private Logo : FLTK.Images.RGB.PNG.PNG_Image := - FLTK.Images.RGB.PNG.Create (Misc.Origin & "/../share/sokoban/img/man.png"); + FLTK.Images.RGB.PNG.Forge.Create (Misc.Origin & "/../share/sokoban/img/man.png"); Text_Size : constant FLTK.Font_Size := 12; diff --git a/src/grids.adb b/src/grids.adb index 3da212b..12f1ae4 100644 --- a/src/grids.adb +++ b/src/grids.adb @@ -9,7 +9,7 @@ package body Grids is return Grid is begin return This : Grid := - (FLTK.Widgets.Widget'(FLTK.Widgets.Create (X, Y, W, H, Text)) with + (FLTK.Widgets.Widget'(FLTK.Widgets.Forge.Create (X, Y, W, H, Text)) with Cells => Square_Vector_Vectors.Empty_Vector, Rows => 0, Cols => 0); end Create; diff --git a/src/sokoban.adb b/src/sokoban.adb index de5601d..80a2972 100644 --- a/src/sokoban.adb +++ b/src/sokoban.adb @@ -54,10 +54,10 @@ package body Sokoban is Fully_Complete_Message : String := "Congratulations! All levels complete!" & ASCII.LF & "Press enter to start again at the first level, or q to quit."; - U_Key : FLTK.Shortcut_Key := FLTK.Shortcut ('u'); - N_Key : FLTK.Shortcut_Key := FLTK.Shortcut ('n'); - R_Key : FLTK.Shortcut_Key := FLTK.Shortcut ('r'); - Q_Key : FLTK.Shortcut_Key := FLTK.Shortcut ('q'); + U_Key : FLTK.Key_Combo := FLTK.Press ('u'); + N_Key : FLTK.Key_Combo := FLTK.Press ('n'); + R_Key : FLTK.Key_Combo := FLTK.Press ('r'); + Q_Key : FLTK.Key_Combo := FLTK.Press ('q'); @@ -149,10 +149,10 @@ package body Sokoban is -- Keyboard and mouse control handling. function Keypress - (Key : in FLTK.Shortcut_Key) + (Key : in FLTK.Key_Combo) return FLTK.Event_Outcome is - use type FLTK.Shortcut_Key; + use type FLTK.Key_Combo; begin if Key = Q_Key then Hide; @@ -160,13 +160,13 @@ package body Sokoban is end if; if Level_State = Play then - if Key = FLTK.Up_Key then + if Key = FLTK.Press (FLTK.Up_Key) then Move_Man (0, -1); - elsif Key = FLTK.Down_Key then + elsif Key = FLTK.Press (FLTK.Down_Key) then Move_Man (0, 1); - elsif Key = FLTK.Left_Key then + elsif Key = FLTK.Press (FLTK.Left_Key) then Move_Man (-1, 0); - elsif Key = FLTK.Right_Key then + elsif Key = FLTK.Press (FLTK.Right_Key) then Move_Man (1, 0); elsif Key = U_Key then if Move_Record.Length > 0 then @@ -185,7 +185,7 @@ package body Sokoban is return FLTK.Not_Handled; end if; return FLTK.Handled; - elsif Level_State = Complete and Key = FLTK.Enter_Key then + elsif Level_State = Complete and Key = FLTK.Press (FLTK.Enter_Key) then if Current_Level = LevelID'Last then Load_Level (LevelID'First); else diff --git a/src/squares.ads b/src/squares.ads index 5aed2fb..8ab911e 100644 --- a/src/squares.ads +++ b/src/squares.ads @@ -68,13 +68,13 @@ private Wall_Image : aliased FLTK.Images.RGB.PNG.PNG_Image := - FLTK.Images.RGB.PNG.Create (Image_Dir & "/wall.png"); + FLTK.Images.RGB.PNG.Forge.Create (Image_Dir & "/wall.png"); Space_Image : aliased FLTK.Images.RGB.PNG.PNG_Image := - FLTK.Images.RGB.PNG.Create (Image_Dir & "/space.png"); + FLTK.Images.RGB.PNG.Forge.Create (Image_Dir & "/space.png"); Empty_Image : aliased FLTK.Images.RGB.PNG.PNG_Image := - FLTK.Images.RGB.PNG.Create (Image_Dir & "/empty.png"); + FLTK.Images.RGB.PNG.Forge.Create (Image_Dir & "/empty.png"); Goal_Image : aliased FLTK.Images.RGB.PNG.PNG_Image := - FLTK.Images.RGB.PNG.Create (Image_Dir & "/goal.png"); + FLTK.Images.RGB.PNG.Forge.Create (Image_Dir & "/goal.png"); Void : constant Square := diff --git a/src/things.ads b/src/things.ads index 3babe65..7257029 100644 --- a/src/things.ads +++ b/src/things.ads @@ -40,9 +40,9 @@ private Man_Image : aliased FLTK.Images.RGB.PNG.PNG_Image := - FLTK.Images.RGB.PNG.Create (Image_Dir & "/man.png"); + FLTK.Images.RGB.PNG.Forge.Create (Image_Dir & "/man.png"); Treasure_Image : aliased FLTK.Images.RGB.PNG.PNG_Image := - FLTK.Images.RGB.PNG.Create (Image_Dir & "/treasure.png"); + FLTK.Images.RGB.PNG.Forge.Create (Image_Dir & "/treasure.png"); Nothing : constant Thing := -- cgit