Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Basic4ppc Wishlist
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Basic4ppc Wishlist Missing any feature?

Sprite attributes (properties)

Reply
 
LinkBack Thread Tools Display Modes
  #41 (permalink)  
Old 07-06-2009, 01:22 PM
enonod's Avatar
Basic4ppc Veteran
 
Join Date: Oct 2007
Location: U.K.
Posts: 324
Default

Thank you for your time, please be patient with me.
At the risk of upsetting you, I understand the arrays and I understand the structures but what I am trying to get at is that, as shown in your first example above, the permitted one dimensional array for the sprite is taken up by the structure being 'equivalent' to the 1D array and thus using up all the entitlement the sprite data offers.

I had thought that each structure would actually be usable as an entity (item, variable) which could then be placed in a single element of a 1D array, so that when asking for say, sprite.DataArray(1) I would get back the structure x1,y1,z1, and sprite.DataArray(2) give x2,y2,z2.

I presume from what you say that what I have actually asked for cannot be done because it is 'equivalent to' a 2D array. I 'thought' that you had said, when this data issue began, that I could get around the 1D by using structures and my brain supplied the result mentioned in the previous para, but in fact it seems we must have been at cross purposes.

Now, if what I expected is available then I have failed miserably to comprehend how to obtain the second and subsequent complete structure items (sets of x,y,z) from the sprite data array elements.

[Edit] So I should perhaps use a 1D array that holds... x,y,z,x1,y1,z1,... and step in threes which is an inelegant equivalent.
Should I have taken this to a different forum?
__________________
You never stop learning until you die.
Sometimes I think I am dead.
Sometimes others think I am dead!
Homesite: http://www.don-simmonds.co.uk for Libyan Mural

Device:Viewsonic VPad7, Android 2.2.2

Last edited by enonod : 07-06-2009 at 01:34 PM.
Reply With Quote
  #42 (permalink)  
Old 07-06-2009, 01:41 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by enonod View Post
permitted one dimensional array for the sprite is taken up by the structure being 'equivalent' to the 1D array
Exactly!

Quote:
I had thought that each structure would actually be usable as an entity (item, variable) which could then be placed in a single element of a 1D array,
Nope, Basic4ppc isn't that complicated! No entities, objects, variable references etc. - just untyped values as singletons or arrays of up to three dimensions.

Quote:
So I should perhaps use a 1D array that holds... x,y,z,x1,y1,z1,... and step in threes
Yup!
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #43 (permalink)  
Old 07-06-2009, 01:54 PM
enonod's Avatar
Basic4ppc Veteran
 
Join Date: Oct 2007
Location: U.K.
Posts: 324
Default

Thanks for that confirmation. It looks as though the stepping along the array is therefore more versatile than a structure for this purpose, because by altering the steps, more 'equivalent' dimensions 'appear' to be available. More ineligant to step through a retrieved structure.
Sorry, but I obviously misunderstood what I thought was your 'way around' 1D.
Everything works fine, and thank you again for all the extras.
__________________
You never stop learning until you die.
Sometimes I think I am dead.
Sometimes others think I am dead!
Homesite: http://www.don-simmonds.co.uk for Libyan Mural

Device:Viewsonic VPad7, Android 2.2.2
Reply With Quote
  #44 (permalink)  
Old 07-06-2009, 05:47 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by enonod View Post
More ineligant to step through a retrieved structure
No, you can treat a structure as an array to iterate it if you want. The structure definition still serves to document the items.

Code:
Dim Type(x1, y1, z1, x2, y2, z2, x3, y3, z3, name)Data
...

Dim Data(10' new array
For i = 0 to 6 Step 3
  Data(i) = something 
' set Data.x1, Data.x2. Data.x3
  Data(i+1) = something ' set Data.y1, Data.y2. Data.y3
  Data(i+2) = something ' set Data.z1, Data.z2. Data.z3
Next
Data(
9) = somename ' set Data.name
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #45 (permalink)  
Old 07-06-2009, 06:30 PM
enonod's Avatar
Basic4ppc Veteran
 
Join Date: Oct 2007
Location: U.K.
Posts: 324
Default

Yes, except that this is only good for getting data out that was previously put in say, manually. using it to put in, puts the same data in x1,x2,x3 etc.

That trivial point aside, I see that there seems little in it either way.

To obtain x,y pairs I have...

Code:
Sub Globals
    cwTurn=
0
    
Dim cwWaypoints(8)
    
Dim arr(0)
End Sub

Sub App_Start
    cwWayPoints(
0)= 49 'x1
    cwWayPoints(1)=1 'y1
    cwWayPoints(2)= 271 'x2
    cwWayPoints(3)=1 'y2
    cwWayPoints(4)=271 'x3
    cwWayPoints(5)=319 'y3
    cwWayPoints(6)=49 'x4
    cwWayPoints(7)=319 'y4

'Save the data with the sprite    
    cw.DataArray=cwWayPoints()
...
End Sub

Sub gw_CollisionDestination
    cw.direction = 
Int(cwTurn/2)*90 Mod 360
    cwTurn =(cwTurn+
2Mod 8
    arr()=cw.DataArray
    cw.DestinationX=arr(cwTurn)
    cw.DestinationY=arr(cwTurn+
1)
End Sub
Everything you have provided works well, it is only my expectations from what is available in other languages.
__________________
You never stop learning until you die.
Sometimes I think I am dead.
Sometimes others think I am dead!
Homesite: http://www.don-simmonds.co.uk for Libyan Mural

Device:Viewsonic VPad7, Android 2.2.2
Reply With Quote
  #46 (permalink)  
Old 07-08-2009, 08:20 AM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default Sprite attributes (properties)

I've tried the newest 1.27 but there are some problems.

Moving a sprite leaves a trail.
EraseSprite didn't do anything.

I tried 1.25 as it seems to be before a change that could have been the cause.
There were no trails but there was alot more flashes.

There is a flicker and a flash with the original version.
The flicker is gone with 1.25 but the flash is worse, this is while a form is activated after it has been hidden or minimized.

I've tried many methods to resolve this which don't work with the new versions.

Setting the BackColor to black is a help, the flicker is less noticeable, which appears to have been changed from white to black in the new versions.

Running method Hide on LostFocus and Show on GotFocus, with Door library, also helps.

Setting gw.Tick anywhere where it could help, Resize, Paint, Focus events. Collision events and MouseDown,Up,Move on the GameWindow Form.

Hopefully this can help with any future updates.

Unfortunately for now I have to use the old version.
Reply With Quote
  #47 (permalink)  
Old 07-08-2009, 09:08 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Can you post an example that show these problems?

Quote:
Setting gw.Tick anywhere where it could help, Resize, Paint, Focus events. Collision events and MouseDown,Up,Move on the GameWindow Form.
I'm sorry but I don't inderstand what this means.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.

Last edited by agraham : 07-08-2009 at 09:27 AM.
Reply With Quote
  #48 (permalink)  
Old 07-08-2009, 02:36 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

I've changed the Sprite redrawing mechanism so that it should not now be possible (famous last words!) for fragments of Sprites to be left behind and for this reason I will remove EraseSprite from the next version as the library should now take care of erasing sprites it in all circumstances.

Quote:
The flicker is gone with 1.25 but the flash is worse
I don't understand the flicker/flash problem as in version 1.22, and ever since, the game window has been drawn like a proper Control in response to Windows Paint events. Is this on desktop or device? Before I post the next version can you either post some code that shows it or give me a more complete description of the effects you are seeing and an explanation of what is happening when you see them.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #49 (permalink)  
Old 07-09-2009, 11:32 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Version 1.28 (I'm going to run out of sub-version numbers before long I should have started at 1.201!) has the following changes.

GameWindow.EraseSprite removed as it should now never be needed as the library now keeps a record of where and at what size each sprite was drawn and uses that data to erase it when required.

Testing on the device I found that adding a Sprite caused a noticeable pause. This was because adding a Sprite builds an array of bitmaps that hold the sprite animation. This process can take an appreciable amount of time on the device, even a powerful one like my iPAQ 214, for an animation with more than a couple of frames. So I have added a Sprite.Bitmaps property that lets you get and set a sprites' bitmap array and the Sprite FrameCount, Height and Width are now writeable to allow direct assignment of a new animation to an existing Sprite. This process is encapsulated in a new Sprite.LoadFrames method and Sprite.New4 initialises a new Sprite using a bitmap array.

So you can now keep "stock" Sprites with their animation loaded and use them to initialise new Sprites. As well as speeding up adding Sprites this also has the advantage of using less memory as all the Sprites with the same animation would share the same bitmap array.

GameWindow is partially AutoScale aware in that it's window size is automatically scaled. However there is no other AutoScaling done. I started but it got too complicated with Sprites so I gave up. I might have another look before issuing the final code but I don't promise anything.

I haven't been able to observe any flashing, as reported by eww245, while hiding and showing a form on either the device or desktop - and in any case I don't think there is anything I could do to alter it as the repainting of the GameWindow is being done as it should be for a Control.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #50 (permalink)  
Old 07-09-2009, 01:44 PM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by agraham View Post

I haven't been able to observe any flashing, as reported by eww245, while hiding and showing a form on either the device or desktop - and in any case I don't think there is anything I could do to alter it as the repainting of the GameWindow is being done as it should be for a Control.
Well this new version fixed my issues.
I use this with a WM5 Pocket PC.

As far as the events, with door library i've set for the gamewindow, Paint, MouseUp,Down and MouseMove.

I use paint to start the Tick, this was useful to help with some of the filcker.
The mouse events are part of the application to allow moving the sprite, which I also set gw.Tick to help.

For the Form I set Resize event for the gw.tick, as Paint does not work and appears to be overidden in the b4p Enhanced Form.

For some reason the GameWindow would flash white even though it is set to black which I can see through .Net Reflector.
But I did set the backcolor to black to also help control the color of the flicker.

Anyway I've turned it all off except for the Ticks in mouse and paint events.

Thanks for the new version, this one looks ready for release.

Erik
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Properties module - useful module for working with properties / ini files Erel Code Samples & Tips 2 10-13-2011 10:02 PM
Assembly properties Pachuquin Questions (Windows Mobile) 1 05-05-2009 06:42 PM
Compiled Properties Zenerdiode Basic4ppc Wishlist 2 03-06-2009 08:08 PM
Evaluate properties Offbeatmammal Basic4ppc Wishlist 0 06-02-2008 07:23 AM
More properties for panels RandomCoder Basic4ppc Wishlist 0 07-12-2007 09:48 PM


All times are GMT. The time now is 03:56 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0