K Kamac Active Member Licensed User Longtime User Sep 29, 2011 #1 Hi. I've got problems, since when i changed my technique to Canvas from ImageView, the FPSes dropped pretty much. All of that is because i have to redraw the whole screen (so i can remove the character to place it on the background again). Maybe i should do it some else way?
Hi. I've got problems, since when i changed my technique to Canvas from ImageView, the FPSes dropped pretty much. All of that is because i have to redraw the whole screen (so i can remove the character to place it on the background again). Maybe i should do it some else way?
K kickaha Well-Known Member Licensed User Longtime User Sep 29, 2011 #2 Instead of redrawing the whole screen, use ClipPath to limit the redraw region. Edit to add: If you have a static background, why not have that as a separate image, and use another canvas to draw your moveable things on. Last edited: Sep 29, 2011 Upvote 0
Instead of redrawing the whole screen, use ClipPath to limit the redraw region. Edit to add: If you have a static background, why not have that as a separate image, and use another canvas to draw your moveable things on.
thedesolatesoul Expert Licensed User Longtime User Sep 29, 2011 #3 You dont have to redraw the whole screen. Look at Erels arkanoid sample. Instead of Invalidating the whole screen, just invalidate the parts you want to redraw. And even then look for other leaks...do not keep reloading and redrawing bitmaps. Upvote 0
You dont have to redraw the whole screen. Look at Erels arkanoid sample. Instead of Invalidating the whole screen, just invalidate the parts you want to redraw. And even then look for other leaks...do not keep reloading and redrawing bitmaps.
K Kamac Active Member Licensed User Longtime User Sep 29, 2011 #4 You dont have to redraw the whole screen. Look at Erels arkanoid sample. Instead of Invalidating the whole screen, just invalidate the parts you want to redraw. And even then look for other leaks...do not keep reloading and redrawing bitmaps. Click to expand... How can i clean a part of the screen I'll look on Erel's example. Upvote 0
You dont have to redraw the whole screen. Look at Erels arkanoid sample. Instead of Invalidating the whole screen, just invalidate the parts you want to redraw. And even then look for other leaks...do not keep reloading and redrawing bitmaps. Click to expand... How can i clean a part of the screen I'll look on Erel's example.
thedesolatesoul Expert Licensed User Longtime User Sep 29, 2011 #5 If you have the background bitmap loaded in memory, you copy that region onto the part you want to clear. I think Erels example doesnt have a background so maybe he is just painting a black rectangle. Upvote 0
If you have the background bitmap loaded in memory, you copy that region onto the part you want to clear. I think Erels example doesnt have a background so maybe he is just painting a black rectangle.
K Kamac Active Member Licensed User Longtime User Sep 29, 2011 #6 I think Erels example doesnt have a background so maybe he is just painting a black rectangle. Click to expand... He's using transparent DrawRect :sign0137: Upvote 0
I think Erels example doesnt have a background so maybe he is just painting a black rectangle. Click to expand... He's using transparent DrawRect :sign0137:
Widget Well-Known Member Licensed User Longtime User Sep 29, 2011 #7 Kamac said: How can i clean a part of the screen I'll look on Erel's example. Click to expand... Kamac, What works for me is to put a transparent panel on top of the bitmap and draw on the transparent panel. To clear the part of the drawing, I draw a transparent rectangle on the transparent panel. Or I can also set the transparent panel's color to transparent to clear the entire transparent panel but this is slower. This is like drawing on a transparency, and then wiping off the drawings. It works well on zoomed images and panned images too. Widget Upvote 0
Kamac said: How can i clean a part of the screen I'll look on Erel's example. Click to expand... Kamac, What works for me is to put a transparent panel on top of the bitmap and draw on the transparent panel. To clear the part of the drawing, I draw a transparent rectangle on the transparent panel. Or I can also set the transparent panel's color to transparent to clear the entire transparent panel but this is slower. This is like drawing on a transparency, and then wiping off the drawings. It works well on zoomed images and panned images too. Widget
K Kamac Active Member Licensed User Longtime User Sep 29, 2011 #8 I've actually figured this out. Incredible how fast is it running now. Waaaay faster than with imageviews I made it this way: draw a transparent rect just where the player was to clear him out draw the background draw some object draw the player Upvote 0
I've actually figured this out. Incredible how fast is it running now. Waaaay faster than with imageviews I made it this way: draw a transparent rect just where the player was to clear him out draw the background draw some object draw the player
M Mikie Member Licensed User Longtime User Sep 29, 2011 #9 Kamac, Are you trying to use b4a to create games? I am using Corona. Very fast. Mikie Upvote 0
thedesolatesoul Expert Licensed User Longtime User Sep 29, 2011 #10 Kamac said: I've actually figured this out. Incredible how fast is it running now. Waaaay faster than with imageviews I made it this way: draw a transparent rect just where the player was to clear him out draw the background draw some object draw the player Click to expand... What is the point of drawing a transparent rect initially? (BTW...what IS a transparent rect?) Upvote 0
Kamac said: I've actually figured this out. Incredible how fast is it running now. Waaaay faster than with imageviews I made it this way: draw a transparent rect just where the player was to clear him out draw the background draw some object draw the player Click to expand... What is the point of drawing a transparent rect initially? (BTW...what IS a transparent rect?)