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.

Author
Message
Behdadsoft
17
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 26th Apr 2013 11:26 Edited at: 26th Apr 2013 11:28
Hi.

I want more Explanation about bold line at below:

================================

Rem define sync
sync on
sync rate 30
Rem set text font & size
set text font "Arial"
set text size 18
Rem set text to width screen
str as String = "DarkBasic Programming Language"
Text Screen Width() - Text Width(str),100,str
Rem wait Press Key to Close Window
Wait Key

================================

Thanks
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 26th Apr 2013 14:08
That's telling DBPro to start outputting the text string at X position Screen Width() - Text Width(str) and Y position 100.

So, for example, if the screen width is 1920 and the text width is 120, the text will be positioned at X position 1800.

[On my machine the text doesn't appear in Windowed mode till I move the window. Odd. ]
Behdadsoft
17
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 26th Apr 2013 16:17
Thanks.

in DarkBasic width is y axis?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 26th Apr 2013 16:28
It's the X axis in Dark Basic Professional, not sure about Dark Basic itself though.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 26th Apr 2013 17:20
Quote: "not sure about Dark Basic itself though."

It's the same.

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Apr 2013 12:15
Your X-coordinate will always be left to right, or width. The Y-coordinate will always be up and down, or height. This is true for every single thing I can think of involving 2D.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 27th Apr 2013 17:40
Quote: "On my machine the text doesn't appear in Windowed mode till I move the window. Odd."


Not overly considering that code tells DBPro to hand over responsibility for rendering but then never calls 'sync'.


Previously TEH_CODERER.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Apr 2013 17:56
True - but then it's no better with sync. But, again, why does it appear at all without the sync?
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 27th Apr 2013 20:31
Not true; this code displays the text as expected.



I'm assuming you didn't add the first 'sync'? I think the first 'sync' call after taking over control of updating does something a little more and that moving the window triggers that as well. It is the same in any scenario such as this example.



The box will only appear after moving the window. Insert another 'sync' and it will appear straight away.


Previously TEH_CODERER.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Apr 2013 20:44
Quote: "I'm assuming you didn't add the first 'sync'?"


Er, yes.

Thanks.
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 28th Apr 2013 00:56
Haha, no worries. It is some slightly odd behaviour and it is just guess work as to the reasoning. Also, having reread my last post, I'm really sorry if it came across as short or anything because it certainly wasn't meant that way. My wording sometimes isn't the best!


Previously TEH_CODERER.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Apr 2013 01:53
Quote: "I'm really sorry if it came across as short or anything "


It didn't - and even if it did I probably deserved it.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 28th Apr 2013 10:56
Quote: "It is some slightly odd behaviour"

It's not odd when you take double buffering into account.

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Apr 2013 13:07 Edited at: 28th Apr 2013 13:08
Why? I think the "odd behaviour" refers to the fact that the text appears after you move the window even without any syncs. Where does double buffering fit into that? As Andrew says there's something else going on, i.e. why is "sync" being triggered when you move the window when "sync on" should mean that the program takes control of syncing?

Not a big issue but a bit baffling all the same.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Apr 2013 03:31
When you move the window, it should call a redraw function internally. And maybe that is what is calling the sync for the graphics buffer?

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Apr 2013 12:50
I guess so.

Login to post a reply

Server time is: 2026-07-06 18:34:25
Your offset time is: 2026-07-06 18:34:25