Re: Re: How to scroll over An Image
"Nick Slaven" <[email protected]> Fri, 14 Nov 2003 10:25:21 -0000
| Newsgroups | gmane.comp.games.mobile |
|---|---|
| Organization | iomo |
| Message-ID | <[email protected]> |
------=_NextPart_000_0023_01C3AA99.9BF3F300 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Depends on the phone and how well the underlying JVM has been implemented. On some phones you can get away with doing a system.gc every frame whilst o= n others its slow and memory fragmentation issues can occur. To explicity deallocate, set the objects reference to null before calling s= ystem.gc. However you should note that on most JVMs a system.gc is only considered a = hint, the garbage collection may occur some time later or worse not at all. My advice would be to avoid continual memory allocation / freeing and alloc= ate a few large buffers at app instantiation. Nick ----- Original Message -----=20 From: Matt Benic=20 To: [email protected]=20 Sent: Friday, November 14, 2003 8:15 AM Subject: RE: [m_game-dev] Re: How to scroll over An Image and how slow is System.gc().. and what thread does it run in? Is it something you could safely call each frame? mattbenic I-Imagine | +27 11 7859800 | [email protected] <mailto:[email protected]>=20 "Sarcasm is just one more service I offer." Are you an organ donor yet? 0800 22 66 11=20 -----Original Message----- From: Maurice Sibrandi [mailto:[email protected]] Sent: Friday, November 14, 2003 10:10 AM To: '[email protected]' Subject: RE: [m_game-dev] Re: How to scroll over An Image Try System.gc(); This wil run the garbage collector. And about scrolling over an image. Try using a tile-bases approach to save some memory. Off course this wil only work when the image is suitable to create tile/map from it (lots of the same pieces). Maurice > -----Original Message----- > From: Matt Benic [mailto:[email protected]] > Sent: vrijdag 14 november 2003 9:05 > To: [email protected] > Subject: RE: [m_game-dev] Re: How to scroll over An Image >=20 >=20 > that reminds me of something I was wondering about.. I have written a > comprehensive streaming engine in c++, but there I had the=20 > advantage of > explicitly allocating and freeing resources.. how would one get around > the fact that objects are only destroyed by the garbage collecter in > java? I know the resource should be released sometime after the last > reference to it is released, but is there a way to force that=20 > (I want to > try and implement a simple image-streaming algorithm..why? because I > CAN!!! ;p ) >=20=20 >=20 > mattbenic > I-Imagine | +27 11 7859800 | [email protected] > <mailto:[email protected]>=20 > "Sarcasm is just one more service I offer." > Are you an organ donor yet? 0800 22 66 11=20 >=20 > -----Original Message----- > From: T [mailto:[email protected]] > Sent: Friday, November 14, 2003 2:50 AM > To: [email protected] > Subject: [m_game-dev] Re: How to scroll over An Image >=20 >=20 > Hi, >=20=20 > My limited experience is you define a floating rectangle the size of > your display viewport and move it over the top of an offscreen buffer > that contains your big image. Each time you update your display you > blit the area of the big image that is underneath the=20 > floating rectangle > to the screen. This gives the illusion of movement. If your=20 > big image > is really big then you might get into trouble with having it=20 > loaded into > memory on low memory hardware. >=20=20 > A more complicated way to handle the problem is to break your=20 > big image > into smaller ones. Then you load/unload small images from=20 > memory, only > having a few in memory at any one time (eg. 4). The 4 you keep in > memory are the ones that coincide with the location of the floating > rectangle. When your floating rectangles border crosses the=20 > borders of > your smaller images you will have to blit pieces of each=20 > small image to > the display viewport. A little more work, but you could reduce your > memory footprint substantially. >=20=20 > Hope this helps. >=20=20 >=20=20 > Ty >=20 > "patil_java" < [email protected] > <mailto:[email protected]> > wrote in message > news:[email protected] > <news:[email protected]> ... >=20 >=20 > Hi all, >=20 > I was just wondering how to scroll an backgroud Image so that=20 > we get an > feeling of we are moving. >=20 > And also I am not looking at just rolling over same segment=20 > like falling > stars etc where we put that in loop but actully what I am looking is > moving over an Big Image. >=20 >=20=20 >=20 > Thanxz >=20 > Chandu >=20 ------=_NextPart_000_0023_01C3AA99.9BF3F300 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 6.00.2800.1276" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>Depends on the phone and how well the underlying JVM has been implemented.</FONT></DIV> <DIV><FONT face=Arial size=2>On some phones you can get away with doing a system.gc every frame whilst on others its slow and memory fragmentation issues can occur.</FONT></DIV> <DIV><FONT face=Arial size=2>To explicity deallocate, set the objects reference to null before calling system.gc.</FONT></DIV> <DIV><FONT face=Arial size=2>However you should note that on most JVMs a system.gc is only considered a hint, the garbage collection may occur some time later or worse not at all.</FONT></DIV> <DIV><FONT face=Arial size=2>My advice would be to avoid continual memory allocation / freeing and allocate a few large buffers at app instantiation.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Nick</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT> </DIV> <DIV>----- Original Message ----- </DIV> <BLOCKQUOTE style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> <A [email protected] href="mailto:[email protected]">Matt Benic</A> </DIV> <DIV style="FONT: 10pt arial"><B>To:</B> <A [email protected] href="mailto:[email protected]">[email protected]</A> </DIV> <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, November 14, 2003 8:15 AM</DIV> <DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [m_game-dev] Re: How to scroll over An Image</DIV> <DIV><BR></DIV><TT>and how slow is System.gc().. and what thread does it run in? Is it<BR>something you could safely call each frame?<BR><BR><BR>mattbenic<BR>I-Imagine | +27 11 7859800 | <A href="mailto:[email protected]">[email protected]</A><BR><<A href="mailto:[email protected]">mailto:[email protected]</A>> <BR>"Sarcasm is just one more service I offer."<BR>Are you an organ donor yet? 0800 22 66 11 <BR><BR>-----Original Message-----<BR>From: Maurice Sibrandi [mailto:[email protected]]<BR>Sent: Friday, November 14, 2003 10:10 AM<BR>To: '[email protected]'<BR>Subject: RE: [m_game-dev] Re: How to scroll over An Image<BR><BR><BR>Try System.gc();<BR>This wil run the garbage collector.<BR><BR>And about scrolling over an image. Try using a tile-bases approach to<BR>save<BR>some memory. Off course this wil only work when the image is suitable to<BR>create tile/map from it (lots of the same pieces).<BR><BR><BR>Maurice<BR><BR>> -----Original Message-----<BR>> From: Matt Benic [mailto:[email protected]]<BR>> Sent: vrijdag 14 november 2003 9:05<BR>> To: [email protected]<BR>> Subject: RE: [m_game-dev] Re: How to scroll over An Image<BR>> <BR>> <BR>> that reminds me of something I was wondering about.. I have written a<BR>> comprehensive streaming engine in c++, but there I had the <BR>> advantage of<BR>> explicitly allocating and freeing resources.. how would one get around<BR>> the fact that objects are only destroyed by the garbage collecter in<BR>> java? I know the resource should be released sometime after the last<BR>> reference to it is released, but is there a way to force that <BR>> (I want to<BR>> try and implement a simple image-streaming algorithm..why? because I<BR>> CAN!!! ;p )<BR>> <BR>> <BR>> mattbenic<BR>> I-Imagine | +27 11 7859800 | [email protected]<BR>> <mailto:[email protected]> <BR>> "Sarcasm is just one more service I offer."<BR>> Are you an organ donor yet? 0800 22 66 11 <BR>> <BR>> -----Original Message-----<BR>> From: T [mailto:[email protected]]<BR>> Sent: Friday, November 14, 2003 2:50 AM<BR>> To: [email protected]<BR>> Subject: [m_game-dev] Re: How to scroll over An Image<BR>> <BR>> <BR>> Hi,<BR>> <BR>> My limited experience is you define a floating rectangle the size of<BR>> your display viewport and move it over the top of an offscreen buffer<BR>> that contains your big image. Each time you update your display you<BR>> blit the area of the big image that is underneath the <BR>> floating rectangle<BR>> to the screen. This gives the illusion of movement. If your <BR>> big image<BR>> is really big then you might get into trouble with having it <BR>> loaded into<BR>> memory on low memory hardware.<BR>> <BR>> A more complicated way to handle the problem is to break your <BR>> big image<BR>> into smaller ones. Then you load/unload small images from <BR>> memory, only<BR>> having a few in memory at any one time (eg. 4). The 4 you keep in<BR>> memory are the ones that coincide with the location of the floating<BR>> rectangle. When your floating rectangles border crosses the <BR>> borders of<BR>> your smaller images you will have to blit pieces of each <BR>> small image to<BR>> the display viewport. A little more work, but you could reduce your<BR>> memory footprint substantially.<BR>> <BR>> Hope this helps.<BR>> <BR>> <BR>> Ty<BR>> <BR>> "patil_java" < [email protected]<BR>> <mailto:[email protected]> > wrote in message<BR>> news:[email protected]<BR>> <news:[email protected]> ...<BR>> <BR>> <BR>> Hi all,<BR>> <BR>> I was just wondering how to scroll an backgroud Image so that <BR>> we get an<BR>> feeling of we are moving.<BR>> <BR>> And also I am not looking at just rolling over same segment <BR>> like falling<BR>> stars etc where we put that in loop but actully what I am looking is<BR>> moving over an Big Image.<BR>> <BR>> <BR>> <BR>> Thanxz<BR>> <BR>> Chandu<BR>> <BR></TT></BLOCKQUOTE> <br> <br> <tt> To unsubscribe from this group, send an email to:<BR> [email protected]<BR> <BR> </tt> <br> <br> <tt>Your use of Yahoo! Groups is subject to the <a href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of Service</a>.</tt> </br> </BODY></HTML> ------=_NextPart_000_0023_01C3AA99.9BF3F300--