text
stringlengths 0
234
|
|---|
------------------
|
-- 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;
|
------------------------------------------------------------------------
|
-- Función que devuelve la posición de un coche dentro del buffer
|
-----------------------------------------------------------------------
|
FUNCTION Posicion_Buffer(Id : T_IdCoche;
|
Buffer: Pkg_Buffer_Coches.T_Buffer) RETURN T_RangoBufferCoches is
|
coche_aux : T_RecordCoche;
|
pos : T_RangoBufferCoches;
|
BEGIN
|
BEGIN
|
Pos := Pkg_Buffer_Coches.Posicion_Primer_Item(Buffer);
|
Coche_Aux := Pkg_Buffer_Coches.Consulta_Item(Pos, Buffer);
|
WHILE Coche_Aux.Id /= Id LOOP
|
Pos := Pos+1;
|
Coche_Aux := Pkg_Buffer_Coches.Consulta_Item(Pos, Buffer);
|
END LOOP;
|
exception
|
when event: others =>
|
PKG_debug.Escribir("ERROR en Posicion_Buffer: " & Exception_Name(Exception_Identity(event)));
|
Function Definition: procedure Simular_Sistema IS
|
Function Body: BEGIN
|
Gtk.Main.Main;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.