Re: [Gnoga-list] Project for someone - Chess - Sprite

2016-12-10 Thread Pascal
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  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


Re: [Gnoga-list] Project for someone - Chess - Sprite

2016-12-01 Thread Jeffrey R. Carter
On 12/01/2016 12:46 PM, Pascal wrote:
> Ok for Update_Interval.
> Concerning access type, Sprite_Type is a limited record because of 
> Context_2D_Type and Image_Data_Type are limited.
> Thus Sprite_Type can't be part of Vector.
> Maybe I could have used an array of Sprite_Type?

OK, then you have a valid reason, which it might be useful to document so you
don't get similar comments from others who, like me, don't look closely enough
at the declaration to realize it's limited. You can't use Indefinite_Vectors 
either.

You could use an array, but then you'd have an upper limit on the number of
sprites, either hard-coded or a generic parameter. If you want to keep it
unbounded, you'd need to replicate the needed functionality from Vectors. That
can probably be done for a specific limited type; generalizing it to
Limited_Vectors is probably not possible.

-- 
Jeff Carter
"If you think you got a nasty taunting this time,
you ain't heard nothing yet!"
Monty Python and the Holy Grail
23



--
___
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list


Re: [Gnoga-list] Project for someone - Chess - Sprite

2016-11-27 Thread Jeffrey R. Carter
On 11/27/2016 11:48 AM, Pascal wrote:
> Many thanks Jeff.
>
> Specification has been modified and pushed to SF GIT branch dev_1.3 with a 
> test case:
> https://sourceforge.net/p/gnoga/code/ci/dev_1.3/tree/src/gnoga-gui-element-canvas-context_2d-sprite.ads

This looks good. I'd suggest Update_Interval rather than Trigger, and a comment
to specify the default value.

Why not store the sprite data directly in the vector? That would eliminate the
need for memory management. I don't see why you'd need the access type.

-- 
Jeff Carter
"I'm a lumberjack and I'm OK."
Monty Python's Flying Circus
54



--
___
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list