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.

Newcomers DBPro Corner / Quick help with sync command

Author
Message
Mr Moo
18
Years of Service
User Offline
Joined: 12th May 2006
Location:
Posted: 12th May 2006 18:02
sorry if this has been asked before but was just having a problem with using the sync command, i want to use print to display amount of ammo etc. on the screen however i cant get it to work with the clear screen command, as in where to place it as it currently just show a black screen with the text instead of the world and objects etc. with text on top. please help =)



Btw am using DBP and have been modifying http://forum.thegamecreators.com/?m=forum_view&b=6&t=38869&p=0 (thanks Turoid!)

Yeah you know it.
Mr Moo
18
Years of Service
User Offline
Joined: 12th May 2006
Location:
Posted: 12th May 2006 19:46
oops sorry didnt add snippet properly




Yeah you know it.
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 12th May 2006 20:30
move the sync to the end of the loop.

also, sometimes text needs a double sync.
Mr Moo
18
Years of Service
User Offline
Joined: 12th May 2006
Location:
Posted: 12th May 2006 20:35
i tried moving it to the end with no luck, and double syncing gives me a sort of flashy screen (refreshing not quite right), any ideas?



Yeah you know it.
Tinkergirl
21
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 13th May 2006 00:01
May I ask why you're 'cls'ing at all?

With a 3d world, the screen is 'cleared' to your 3d view every time you run sync - so you don't need to cls to clear the screen of your old printing text.

Try putting the sync at the end of your loop, and removing the cls entirely. See if that helps?
Mr Moo
18
Years of Service
User Offline
Joined: 12th May 2006
Location:
Posted: 13th May 2006 00:51
thats what i've done now anyway, it doesnt clear the screen properly but the texted previously printed isnt visible and since on pro the print command scrolls (which i forgot) its working at the mo with the text on the bottom, thanks everyone for the help =)



Yeah you know it.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 13th May 2006 03:30
Just to add to what has already been said...

There isn't just one 'screen' when you program in DB. There are two - the 2D screen and the 3D screen.

CLS clears the 2D screen. It has no effect on 3D sections of the screen.

Once you create any 3D objects, the DirectX 3D screen is initialised and the 2D screen is automatically overwritten whenever the 3D screen is updated. This update is at the system's discretion.

If you use 'Sync On' however, it tells DB to do the update when you tell it to - in other words when you issue the 'Sync' command.

So, you alter all the 3D object's positions in your Do..loop and put Sync as the last line inside the loop to synchronise the screen with all the changes in memory.

If you want to put text over the top of the 3D screen, you have a couple of options:

The first is to use the Set Camera View command to define a smaller 3D window - leaving a strip of the underlying 2D screen running across the top (or bottom) of the screen. CLS will then work on this strip - not the 3D window.

The second is to use the Text Command to place the text on top of the 3D window. As any Sync will automatically wipe the text off, the trick is to place the Text commands immediately AFTER the Sync.

That way, the text remains while your new 3D screen is re-calculated and the text is immediately replaced after the next Sync.

(The second method works for DBC, but I'm not sure about DBPro as it may have changed a little so that Sync doesn't wipe out text).

TDK_Man

smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 13th May 2006 16:37
use text command instead of print to stop the number\info appearing at the bottom

life's one big game
spec= 2ghz, 1gb ram, 512mb gpu, directx 9.0c, dbpro and classic
Tinkergirl
21
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 13th May 2006 22:38
From my tests in DBP, printing to the screen is retained in 3d applications, but lost every frame (after sync). You can quite happily use print or text to put writing anywhere on the screen with the 3d stuff going on 'underneath' it.

As for scrolling off the screen, either do as smallg suggested (and use the text command with a position) or use 'set cursor 0,0' to position the printing cursor every frame.

Login to post a reply

Server time is: 2024-11-27 19:34:36
Your offset time is: 2024-11-27 19:34:36