Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Yo dawg I herd you like SET DISPLAY MODE

Author
Message
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 28th Aug 2010 20:03 Edited at: 28th Aug 2010 20:07
so we put a set in your set, so you can set while you set.

Err...

Just a quick couple of questions for the guru's...

SET DISPLAY MODE wipes out a lot of stuff when you use it, so using it once at the top of your program is optimal.

But can I use it at the end of my program, as a poor man's clean-up? Does it clear memory? What I'm doing now is un-dimensioning my big arrays, clearing out my strings, and deleting my objects. Is that enough? Should I do more? Delete sounds and images? Or would my friend SET DISPLAY MODE take care of it?

Hmmm?

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th Aug 2010 20:14 Edited at: 28th Aug 2010 20:14
SET DISPLAY MODE should just clear all loaded images and bitmaps. There's really no need to clear anything because once the program ends the memory is freed anyway.

Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 28th Aug 2010 20:30
This post is a bit edgy...

Anyway, I'm not sure if DBP cleans up when you exit though, someone told me that after playing my game there was still some memory left over.

I don't know if SET DISPLAY MODE will work.


Guns, cinematics, stealth, items and more!
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 28th Aug 2010 20:32
Okay, good to know, thanks!

dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 28th Aug 2010 20:40
Windows will automatically free everything requested by the application, so there's no need to free anything yourself.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Aug 2010 21:06
DBPro doesn't restore everything though when it exits. If I change the volume setting of sounds or music (not sure which, probably the latter) then the setting persists into the next run of a DBPro program. Rather annoying till you realise what's going on.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 28th Aug 2010 23:37
Set display mode only wipes VRAM. sounds, variables, arrays and things are not held in video memory so to answer your question, No, it wouldn't work as global clean up. Objects, images and bitmaps will be cleared though.

My signature is NOT a moderator plaything! Stop changing it!
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Aug 2010 20:51
Surely a simple loop of your sounds etc, checking they exist and deleting would do it? I don't think variables and arrays would be an issue myself. I would have thought they were deleted automatically.

http://s6.bitefight.org/c.php?uid=103081
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Aug 2010 23:02
Quote: "Surely a simple loop of your sounds etc, checking they exist and deleting would do it?"


I doubt it. The sounds, etc, are automatically deleted when the program closes but the volume setting (for music I think) persists till you next change it. It took me a long time to work out why music didn't seem to play on one one of my machines.
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 30th Aug 2010 15:09
Well, in that case, just reset the volume back before deleting ?

http://s6.bitefight.org/c.php?uid=103081
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 30th Aug 2010 15:24
Lots of programs do that - alter volume level without returning it on exit, I had multimedia keyboard that could alter volume. Muting was global but sound level was different from software to software. There were soooo many occasions when I didnt realise what was going on and reinstalled drivers, when all I had to do was go through each software that could alter volume level, and restore it.

Restoring before exit might seem the right way to go, but what if the program is not ended in the expected way?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Aug 2010 22:06
It's easy to solve in this case - but why not warn the user in the Help file?
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 30th Aug 2010 22:29 Edited at: 30th Aug 2010 22:29
I'm with Green Gandalf. If changing the volume in one Darkbasic program effects the next ran Darkbasic program then Darkbasic needs to be changed a bit to automatically reset the volume when the program closes.

Uncle Sam
20
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 30th Aug 2010 23:07
You may want to check out the flush memory command.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Aug 2010 23:21
I think you mean flush video memory - but that command doesn't do anything as far as I can tell.
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 31st Aug 2010 01:12
Quote: "but why not warn the user in the Help file? "

exactly - as easy as a fix it may be(correct at start of dbp exe), as devs we do need to know about this. Once again this highlights the need to have someone from TGC to maintain helpfiles more accurateley.
Duke E
17
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 31st Aug 2010 10:26 Edited at: 31st Aug 2010 10:27
If i where TGC i'd put the helpfiles on a moderated wiki. I'm sure people would update it just cause they where irritated something like this where not included . Easy enough to automatically extract the changes and update the editors helpfiles when a new update is issued.

Login to post a reply

Server time is: 2026-07-23 12:09:56
Your offset time is: 2026-07-23 12:09:56