text
stringlengths
0
234
Slot_Object => Win);
Button.Set_Size_Request(100, 20);--TAM_BUTTON_EXIT);
Gtk.Alignment.Gtk_New(alinea_button, 0.5, 0.5, 0.0, 0.0);
alinea_button.Add(Button);
-- Double buffer
Double_Buffer.Gtk_New(Buffer);
Buffer.Set_Size_Request(CANVAS_WIDTH, CANVAS_HEIGHT);-- -TAM_BUTTON_EXIT);
-- Asociar widgets a la ventana principal y mostrarla
Gtk_New_Hbox (Hbox, Homogeneous => True, Spacing => 10);
Gtk_New_Vbox (Vbox, Homogeneous => False, Spacing => 0);
Pack_Start (Vbox, Buffer);
--Pack_Start (Vbox, Button, Expand => False, Fill => False);
Pack_Start (Vbox, alinea_button);--, Expand => False, Fill => False);
Pack_Start (Hbox, Vbox);
Win.Add(Hbox);
Show_All (Win);
--ventana := Get_Window(Gtk_Widget(Buffer));
--Gdk.Window.Move(ventana, 0, 0);
Id := Main_Context_Sources.Timeout_Add (PERIODICIDAD_REDIBUJAR_MILISEGUNDOS,
Draw_Complex_Buffer'Access,
Gtk_Drawing_Area (Buffer));
Gdk_New(pangoLayout, Get_Pango_Context(Buffer));
inbuilt_font := Pango.Font.From_String("Courier");
Pango.Layout.Set_Font_Description(pangoLayout, inbuilt_font);
-- INICIALIZACIÓN DEL ESTADO DE TODOS LOS OBJETOS VISUALIZADOS
Inicializar_Buffer_Coches;
end Inicializar_Interfaz_Grafica;
------------------
-- Draw_Complex --
------------------
procedure Draw_Complex (Pixmap : Cairo_Context) is
begin
Draw_Rectangle (Pixmap, Black_Gc, Filled => True,
X => 0, Y => 0,
Width => CANVAS_WIDTH, Height => CANVAS_HEIGHT);
-- DIBUJAR EN EL CANVAS EL ESTADO ACTUAL DE TODOS LOS OBJETOS
Dibujar_Canvas_Calle(Pixmap);
end Draw_Complex;
-------------------------
-- Draw_Complex_Buffer --
-------------------------
function Draw_Complex_Buffer (Area : Gtk_Drawing_Area) return Boolean is
Buffer : Gtk_Double_Buffer := Gtk_Double_Buffer (Area);
begin
Draw_Complex (Get_Pixmap (Buffer));
Double_Buffer.Thaw(Buffer);
--Double_Buffer.Draw (Buffer);
return True;
end Draw_Complex_Buffer;
----------
-- Quit --
----------
procedure Quit (Win : access Gtk_Window_Record'Class) is
pragma Warnings (Off, Win);
begin
Gnat.OS_Lib.OS_Exit(0);
--Gtk.Main.Main_Quit;
--Ada.Task_Identification.Abort_Task(Ada.Task_Identification.Current_Task);
end Quit;
------------------------------------------------------------------------
-- Procedure que inicializa el buffer de coches
------------------------------------------------------------------------
procedure Inicializar_Buffer_Coches is
coche : T_RecordCoche;