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.
Sub Globals
gw.New1("Form1", 0, 0, 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(0, 1, 1))
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
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.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.
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.Is there another way, that you can think of, to not have the Tick in the MouseMove event?
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.Is there any better possibility to insert sprite at specfic location into gw?
I didn't say that you would need to do this, only that you might need to as I haven't tried using Sprites that way. Try it without first as that would be more efficientExcept I did not know that I will need to put them invisible then tick and visible and tick
It's a feature that occurs because you are using the sprites in a way that they were not really designed for.Is it feature (planned to work this way) or bug?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?