Thanks Jeff for the welcome explanations.

Thus I switch to a map container (my son advice ;-).
I push the modifications to dev_1.3 branch on SF with some other fixes.
Next, I'll work on a smoother sprite movement instead of small hops, see 
sprite_test.adb.

NB: for those who use dev_1.3 with GPS, do:
$ make # as usual
$ make gps # to launch GPS with GNAT project paths set
Don't forget to set GPS variables in scenario tab.

Feel free to report any bad or good results especially on Linux or Windows as I 
make only macOS tests.

Regards, Pascal.
http://blady.pagesperso-orange.fr


> Le 5 déc. 2016 à 05:04, Jeffrey R. Carter <jrcar...@acm.org> a écrit :
> 
> On 12/04/2016 11:35 AM, Pascal wrote:
>> I used a vector of sprites, the private Sprite_Type is the cursor type of 
>> the vector.
>> After I created 2 sprites SP1 and SP2 of Sprite_Type and I deleted SP1 with 
>> no error then I deleted SP2 with the error:
>> raised CONSTRAINT_ERROR : 
>> Gnoga.Gui.Element.Canvas.Context_2D.Sprite.Sprite_Lists.Element: Position 
>> cursor is out of range
>> I can't get SP2 element before deleting it.
>> 
>> Is it cursor tampering when deleting SP1?
>> If yes, I don't understand actually why.
>> Any clue?
>> Thus what should I take for Sprite_Type?
> 
> I've never really understood what a cursor is supposed to be for a vector. 
> Since
> it should be named Unbounded_Arrays, the idea should be that you access 
> elements
> through indices. Anyway, GNAT 4.9 implements Cursor as
> 
>   type Cursor is record
> 
>      Container : Vector_Access;
> 
>      Index     : Index_Type := Index_Type'First;
> 
>   end record;
> 
> So I'd guess when you delete SP1, the Index in SP2 becomes invalid. Not very
> useful, and we shouldn't have to look in the private part to understand how it
> works. You'd probably do better with a list, since Cursor would then be an
> access to a list node, and not change when nodes are inserted or deleted.
> 
> -- 
> Jeff Carter
> "I snapped my chin down onto some guy's fist and
> hit another one in the knee with my nose."
> Play It Again, Sam
> 129
> 
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Gnoga-list mailing list
> Gnoga-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gnoga-list


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list

Reply via email to