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
  #81 (permalink)  
Old 07-21-2009, 12:41 AM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by agraham View Post
Is this on device or desktop and is it an optimised compiled application or in the IDE? Out of interest (because I might like to play with it!) which Task Manager are you using to alter the priority?

Basic4ppc applications are single threaded and the Sprite library runs on that single thread so whatever the thread is it has nothing to do with the application unless you are running in the desktop IDE where, although I don't know the architecture, there are several threads running under the IDE.

I believe the device IDE is single threaded and an application running under the IDE runs on that thread which is one of the reasons there is no debugging capability in the device IDE.

This is on the device in the IDE.
It's something i've just noticed so i'm not sure what situations it will effect a sprite.

Using FdcSoft TaskManager I can see 3 threads running at normal priority when starting the IDE.
After loading the project and running the code it is still 3 at normal.

At some point one thread goes to a high priority, don't know why it changes but it does effect the speed of sprites.

Running an optimized compiled app not using sprites I can also see 3 threads.
So this does appear to be a b4p thread not specific to the Sprite library.

I'll have to complie and see if it still does the same.
Reply With Quote
  #82 (permalink)  
Old 07-21-2009, 02:29 AM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default

I just put this together and works about the same as I explained.

The difference is setting to an idle priority does not make it faster.
Maybe because I have been moving the Sprite left and right not up or down.

The critical priority is where it is most noticeable.
If the sprite is moved quickly in circles it will still move after taking the stylus off.

[Edit]
This is using Door and Sprite Libraries

Code:
Sub Globals
     gw.New1(
"Form1"00, Form1.Width, Form1.Height)
     obj.New1(
false)
     obj.FromLibrary (
"main.gw""gw", b4pobject(2))
     eMove.New1(obj.Value, 
"MouseMove")
     eUp.New1(obj.Value, 
"MouseUp")
   down = 
false
End Sub

Sub App_Start
     sp.New3 (imagelist1.Item(
0), 1, imagelist1.Width(0), imagelist1.Height(0), 1)
     gw.SetTransparentColor1 (imagelist1.Pixel(
011))
     gw.SpriteAdd(sp.Value)

sp.X = Form1.Width/
2 - sp.Width/2
sp.Y = Form1.Height/
2 - sp.Height/2

     gw.Tick
 Form1.Show
End Sub

Sub gw_CollisionMouse
  down = 
true
End Sub

Sub eMove_NewEvent
  
If down then
   obj.Value = eMove.Data
x = obj.GetProperty(
"X")
y = obj.GetProperty(
"Y")
   sp.X = x
   sp.Y = y
gw.Tick
  
End If
End Sub

Sub eUp_NewEvent
If down then
   sp.X = 
0
'Form1.Width/2 - sp.Width/2
   sp.Y = Form1.Height/2 - sp.Height/2
   gw.Tick
   down = 
false
End If
End Sub

Last edited by eww245 : 07-21-2009 at 02:33 AM.
Reply With Quote
  #83 (permalink)  
Old 07-21-2009, 10:09 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by eww245 View Post
So this does appear to be a b4p thread not specific to the Sprite library
An optimised compiled application and (I believe) the device IDE start no additional threads themselves but run on a single thread created by the Common Language Runtime. Those extra threads you see are most probably .NET CLR owned threads started to support the execution of managed code, such as Garbage Collection, and you should probably leave them alone. Just because a thread exists it doesn't mean that it is taking processor time whatever its priority.

You are using Tick in a way that is not really intended. Tick does a lot of work and trying to use it in real time following the movement of the stylus will probably 100% load the CPU. The Sprite carrying on moving after lifting the stylus is probably the system processing queued MouseMove events that it couldn't keep up with. Bear in mond that devices are very feeble compared to desktops and it is easy to run out of CPU time as soon as you start anything intensive.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #84 (permalink)  
Old 07-21-2009, 02:28 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
An optimised compiled application and (I believe) the device IDE start no additional threads themselves but run on a single thread created by the Common Language Runtime. Those extra threads you see are most probably .NET CLR owned threads started to support the execution of managed code, such as Garbage Collection, and you should probably leave them alone. Just because a thread exists it doesn't mean that it is taking processor time whatever its priority.

You are using Tick in a way that is not really intended. Tick does a lot of work and trying to use it in real time following the movement of the stylus will probably 100% load the CPU. The Sprite carrying on moving after lifting the stylus is probably the system processing queued MouseMove events that it couldn't keep up with. Bear in mond that devices are very feeble compared to desktops and it is easy to run out of CPU time as soon as you start anything intensive.
Changing the threads priority is not something that could be eaisly done, if at all, in b4p code.
So it's not something I will be doing.

Is there another way, that you can think of, to not have the Tick in the MouseMove event?
Reply With Quote
  #85 (permalink)  
Old 07-21-2009, 03:01 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by eww245 View Post
Is there another way, that you can think of, to not have the Tick in the MouseMove event?
As I don't know what you are trying to do I can't suggest anything. The Sprite library, and Tick as its name suggests, were really designed for moving a lot of objects around an area on a regularly timed basis.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #86 (permalink)  
Old 08-16-2009, 09:55 AM
Byak@'s Avatar
Basic4ppc Veteran
 
Join Date: Jul 2008
Posts: 416
Send a message via ICQ to Byak@
Awards Showcase
Beta Tester 
Total Awards: 1
Default

can anyone give a example with scrollable background?
__________________
I'll Kill you, I'll Crash you, I'll never be yours!
--------------------------------------------------
Qtek s110; o2 XDA Flame; Nokia E63 red;
ASUS Eee PC 901 (Windows XP sp3) + TouchScreen;
Reply With Quote
  #87 (permalink)  
Old 09-16-2009, 10:33 AM
Byak@'s Avatar
Basic4ppc Veteran
 
Join Date: Jul 2008
Posts: 416
Send a message via ICQ to Byak@
Awards Showcase
Beta Tester 
Total Awards: 1
Default

UP.anybody know?
__________________
I'll Kill you, I'll Crash you, I'll never be yours!
--------------------------------------------------
Qtek s110; o2 XDA Flame; Nokia E63 red;
ASUS Eee PC 901 (Windows XP sp3) + TouchScreen;
Reply With Quote
  #88 (permalink)  
Old 01-11-2010, 10:12 PM
Junior Member
 
Join Date: Sep 2009
Posts: 18
Question gw.SpriteInsertAt(Sprite.Value, Index As Int32) requirement

Hello

Recently I tried to create Isometric game engine using ImagelibEx and Drawpolygon to create Isometric objects, boxes etc, but moving objects using this library is terribly slow on device, even on Desktop it is not so fast as I expected. So now I am trying to recreate drawing procedures using sprite library which (I think) will be more faster. I need to add Isometric objects somewhere in space so I need to reorder visibility (z order) of objects (sprites). I miss from this library something like gw.SpriteInsertAt(Sprite, Index) method for easier insert sprite at desired location. Is it possible to add such functionality into library? Now with this library I would do same functionality like this (not tested) but seems to me no optimal way how to do it.

Sub SpriteInsertAt(Sprite,Index)
gw.SpriteAdd(Sprite.Value)
For i=SpritesCount-1 To Index+1 Step -1
gw.SpriteReplace(gw.GetSprite(i-1),i)
Next
gw.SpriteReplace(Sprite,Index)
End Sub

Is there any better possibility to insert sprite at specfic location into gw?

thnx
Reply With Quote
  #89 (permalink)  
Old 01-12-2010, 09:15 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by merli View Post
Is there any better possibility to insert sprite at specfic location into gw?
From the rest of your question I assume that by "location" you mean at a specific index. You cannot insert a new sprite but you can replace an existing one. You should be able to shuffle the sprites around to get the z-order you want. I haven't tried this and you may get some visible anomalies if the sprites change size. In this case make them invisible, call Tick, shuffle them and make them visible then call Tick again.

SpareSprite.Value = Gw.GetSprite(Iindex) ' save existing sprite
Gw.SpriteReplace(NewSprite.Value, Index) ' replace with another

Alternatively, as you have to create the bitmaps for each sprite why not just draw them yourself where you want them so you have complete control.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #90 (permalink)  
Old 01-12-2010, 01:58 PM
Junior Member
 
Join Date: Sep 2009
Posts: 18
Default

That is exacty what I thought. Except I did not know that I will need to put them invisible then tick and visible and tick. I need to have correct order of Sprites in sceene, because they can overlap (one is in front of other) and sometimes I need add another sprite _inside_ scene (think about some shooting or incoming another character of object for example) and that sprite I cannot just Add because it would be by visibility on top of all objects. I need to put it exactly on sceene where it needs to be by sprite index (and of course order of this object can change while it moves through 3D sceene. It can be in front of some objects and behind other). Anyway thnx for answer and I hope it will work ...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 2 (0 members and 2 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 09:02 PM
Assembly properties Pachuquin Questions (Windows Mobile) 1 05-05-2009 05:42 PM
Compiled Properties Zenerdiode Basic4ppc Wishlist 2 03-06-2009 07:08 PM
Evaluate properties Offbeatmammal Basic4ppc Wishlist 0 06-02-2008 06:23 AM
More properties for panels RandomCoder Basic4ppc Wishlist 0 07-12-2007 08:48 PM


All times are GMT. The time now is 11:47 AM.


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