Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

[JAVA] Image & AudioClip

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 0Circle0   Members   

343
Like
0Likes
Like

Posted 27 December 2012 - 10:49 AM

when you load a resource do you have to then remove it? and if so how?

 

        Click = getAudioClip(this.getClass().getResource("/Sprites/Audio/click.wav"));
        BlackPiece = getImage(this.getClass().getResource("/Sprites/BlackPiece.png"));
.......
        private AudioClip Click;
        private Image BlackPiece;
........


Edited by 0Circle0, 27 December 2012 - 10:52 AM.

Sprite Creator 3 VX & XP

WARNING: I edit my posts constantly.


#2 epicpunnum   Members   

459
Like
1Likes
Like

Posted 27 December 2012 - 06:35 PM

Java is a high-level programming language, and therefore does a lot of management for you in its virtual machine (JVM). One such thing is a garbage-collecting system. Once the JVM's garbage collector detects that your variable isn't being used anymore, it frees up that area in memory. So your short answer for that is no.
If you're concerned about using space however, you can model your objects in a way that removes references when they're "destroyed," prompting the garbage collector to remove them. If you know you're going to have multiples of that same class being displayed, it may also be a good idea to make your Images and AudioClips static, so you only need to instantiate one, rather than create a new one for every instance.

#3 0Circle0   Members   

343
Like
0Likes
Like

Posted 31 December 2012 - 04:49 AM

Thanks for the info


Sprite Creator 3 VX & XP

WARNING: I edit my posts constantly.





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.