text
stringlengths
0
234
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;
BEGIN
for carril IN T_Carril loop
FOR I IN T_RangoBufferCoches LOOP
Coche.Id := 0;
Coche.Pos.X := 0;
Coche.Pos.Y := y_carril(carril);
coche.velocidad := (VELOCIDAD_COCHE, 0);
Coche.Color:= T_ColorCoche'First;
coche.carril := carril;
Pkg_Buffer_Coches.Actualiza_Item(i, Coche, Buffer_Coches(carril));
-- Inicializamos también el buffer de coches accidentados
Pkg_Buffer_Accidentes.Actualiza_Item(i, Coche, Buffer_Accidentes(carril));
END LOOP;
END LOOP;
exception
when event: others =>
PKG_debug.Escribir("ERROR en Inicializar_Buffer_Coches: " & Exception_Name(Exception_Identity(event)));
end Inicializar_Buffer_Coches;