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>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Nick</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT>&nbsp;</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>&lt;<A 
  href="mailto:[email protected]">mailto:[email protected]</A>&gt; 
  <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>&gt; -----Original Message-----<BR>&gt; 
  From: Matt Benic [mailto:[email protected]]<BR>&gt; Sent: vrijdag 14 november 
  2003 9:05<BR>&gt; To: [email protected]<BR>&gt; Subject: RE: 
  [m_game-dev] Re: How to scroll over An Image<BR>&gt; <BR>&gt; <BR>&gt; that 
  reminds me of something I was wondering about.. I have written a<BR>&gt; 
  comprehensive streaming engine in c++, but there I had the <BR>&gt; advantage 
  of<BR>&gt; explicitly allocating and freeing resources.. how would one get 
  around<BR>&gt; the fact that objects are only destroyed by the garbage 
  collecter in<BR>&gt; java? I know the resource should be released sometime 
  after the last<BR>&gt; reference to it is released, but is there a way to 
  force that <BR>&gt; (I want to<BR>&gt; try and implement a simple 
  image-streaming algorithm..why? because I<BR>&gt; CAN!!! ;p )<BR>&gt;&nbsp; 
  <BR>&gt; <BR>&gt; mattbenic<BR>&gt; I-Imagine | +27 11 7859800 | 
  [email protected]<BR>&gt; &lt;mailto:[email protected]&gt; <BR>&gt; "Sarcasm 
  is just one more service I offer."<BR>&gt; Are you an organ donor yet? 0800 22 
  66 11 <BR>&gt; <BR>&gt; -----Original Message-----<BR>&gt; From: T 
  [mailto:[email protected]]<BR>&gt; Sent: Friday, November 14, 2003 2:50 
  AM<BR>&gt; To: [email protected]<BR>&gt; Subject: [m_game-dev] Re: 
  How to scroll over An Image<BR>&gt; <BR>&gt; <BR>&gt; Hi,<BR>&gt;&nbsp; 
  <BR>&gt; My limited experience is you define a floating rectangle the size 
  of<BR>&gt; your display viewport and move it over the top of an offscreen 
  buffer<BR>&gt; that contains your big image.&nbsp; Each time you update your 
  display you<BR>&gt; blit the area of the big image that is underneath the 
  <BR>&gt; floating rectangle<BR>&gt; to the screen.&nbsp; This gives the 
  illusion of movement.&nbsp; If your <BR>&gt; big image<BR>&gt; is really big 
  then you might get into trouble with having it <BR>&gt; loaded into<BR>&gt; 
  memory on low memory hardware.<BR>&gt;&nbsp; <BR>&gt; A more complicated way 
  to handle the problem is to break your <BR>&gt; big image<BR>&gt; into smaller 
  ones.&nbsp; Then you load/unload small images from <BR>&gt; memory, 
  only<BR>&gt; having a few in memory at any one time (eg. 4).&nbsp; The 4 you 
  keep in<BR>&gt; memory are the ones that coincide with the location of the 
  floating<BR>&gt; rectangle.&nbsp; When your floating rectangles border crosses 
  the <BR>&gt; borders of<BR>&gt; your smaller images you will have to blit 
  pieces of each <BR>&gt; small image to<BR>&gt; the display viewport.&nbsp; A 
  little more work, but you could reduce your<BR>&gt; memory footprint 
  substantially.<BR>&gt;&nbsp; <BR>&gt; Hope this helps.<BR>&gt;&nbsp; 
  <BR>&gt;&nbsp; <BR>&gt; Ty<BR>&gt; <BR>&gt; "patil_java" &lt; 
  [email protected]<BR>&gt; &lt;mailto:[email protected]&gt; 
  &gt; wrote in message<BR>&gt; 
  news:[email protected]<BR>&gt; 
  &lt;news:[email protected]&gt; ...<BR>&gt; <BR>&gt; 
  <BR>&gt; Hi all,<BR>&gt; <BR>&gt; I was just wondering how to scroll an 
  backgroud Image so that <BR>&gt; we get an<BR>&gt; feeling of we are 
  moving.<BR>&gt; <BR>&gt; And also I am not looking at just rolling over same 
  segment <BR>&gt; like falling<BR>&gt; stars etc where we put that in loop but 
  actully what I am looking is<BR>&gt; moving over an Big Image.<BR>&gt; 
  <BR>&gt;&nbsp; <BR>&gt; <BR>&gt; Thanxz<BR>&gt; <BR>&gt; Chandu<BR>&gt; 
  <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--