MyTetra Share
Делитесь знаниями!
Время создания: 23.06.2018 08:23
Текстовые метки: dark basic classic window position
Раздел: Dark Basic
Запись: Velonski/mytetra-database/master/base/1529724232jfqnj68ma8/text.html на raw.githubusercontent.com


FORUM HOMESEARCHPROFILEMESSAGES (0)MY THREADSLOGOUT

developer forums Banner image

DarkBASIC Discussion / Position window DBC

Author

Message


Insert Name Here

11 YEARS OF SERVICE

User Offline

Joined: 20th Mar 2007

Location: Worcester, England

Earn Badges

Posted: 7th Jun 2007 10:27 Link

I'm making a game in a window as opposed to full screen, and whenever I start the program the window always starts at the top left corner. Is there a way to position the window in a different place?

(Also, I'd like to know how to prevent resizing but that isn't vital).

Thanks


The below sentance is true.

The above sentance is false.

Paradox!

Lucifer

12 YEARS OF SERVICE

User Offline

Joined: 26th Dec 2005

Location:

Earn Badges

Posted: 7th Jun 2007 12:08 Link

set window position X, Y


i like pancakes..

LBFN

11 YEARS OF SERVICE

User Offline

Joined: 7th Apr 2007

Location: USA

Earn Badges

Posted: 7th Jun 2007 12:16 Link

What version of DBC are you using? You should be able to use 'SET WINDOW POSITION X,Y'. I am using the enhanced v 1.13. If you can't find this command in the help files, you can get v 1.13 here:

http://darkbasic.thegamecreators.com/?f=upgrade_language


LB

ghtry

11 YEARS OF SERVICE

User Offline

Joined: 6th Jun 2007

Location:

Earn Badges

Posted: 7th Jun 2007 17:53 Link

Insert name here:


Researched some of the DBCe commands for windows, and as previously mention you can adjust the window position on your windows desktop using the command SET WINDOW POSITION (x),(y).


As far as preventing users from re-sizing the window, I could not spot a command which actually prevents the window size from being changed. To make matters worse, there is not a command which returns the size of a window you specify. As cheap as this may sound there is indeed a solution to preventing users from changing the size of the window you specify.


Just create a 5 or 10 second timer which constantly sets the window size SET WINDOW SIZE (width),(height). So if the window is re-sized by the end user, your program will get around to setting the size correctly again. I hope this helps.


Best Regards

Anthony

TDK

15 YEARS OF SERVICE

User Offline

Joined: 19th Nov 2002

Location: UK

Earn Badges

Posted: 7th Jun 2007 19:00 Link

To prevent a window from being resized use the SET WINDOW LAYOUT command:



SET WINDOW ON

SET WINDOW SIZE 640,480

SET WINDOW POSITION 100,100

SET WINDOW LAYOUT 0,1,0

SET WINDOW TITLE "Powerball"

SHOW WINDOW

Sync On


Ink RGB(255,255,255),0

XPos# = 12.0: YPos# = 12.0

XDir# = 5.0: YDir# = 1.0


Do

Gosub MoveCircle

Loop


MoveCircle:

Inc YDir#,1.0

Inc XPos#, XDir#

Inc YPos#, YDir#


If YPos# >= 465.0

Rem Hit floor

YPos# = 465.0: YDir# = 0.0-YDir#

If XDir# > 0

Dec XDir#,.2

Else

Inc XDir#,.2

Endif

If ABS(XDir#) < 0.1

XPos# = 12.0: YPos# = 12.0

XDir# = Rnd(5)+4.0

YDir# = 1.0

Endif

Endif


If XPos# >= 630.0 Then XPos# = 630.0: XDir# = 0.0-XDir#

If XPos# <= 10.0 Then XPos# = 10.0: XDir# = 0.0-XDir#


Rem Add a bit of gravity...

Inc YPos#,0.5


CLS

Circle XPos#,YPos#,10

Sync

Return


+ Code Snippet


SET WINDOW ON

SET WINDOW SIZE 640,480

SET WINDOW POSITION 100,100

SET WINDOW LAYOUT 0,1,0

SET WINDOW TITLE "Powerball"

SHOW WINDOW

Sync On

Ink RGB(255,255,255),0

XPos# = 12.0: YPos# = 12.0

XDir# = 5.0: YDir# = 1.0

Do

Gosub MoveCircle

Loop

MoveCircle:

Inc YDir#,1.0

Inc XPos#, XDir#

Inc YPos#, YDir#

If YPos# >= 465.0

Rem Hit floor

YPos# = 465.0: YDir# = 0.0-YDir#

If XDir# > 0

Dec XDir#,.2

Else

Inc XDir#,.2

Endif

If ABS(XDir#) < 0.1

XPos# = 12.0: YPos# = 12.0

XDir# = Rnd(5)+4.0

YDir# = 1.0

Endif

Endif

If XPos# >= 630.0 Then XPos# = 630.0: XDir# = 0.0-XDir#

If XPos# <= 10.0 Then XPos# = 10.0: XDir# = 0.0-XDir#

Rem Add a bit of gravity...

Inc YPos#,0.5

CLS

Circle XPos#,YPos#,10

Sync

Return



TDK_Man


* TDK's Game Programming Forums - Open To All - DB & Team Request Boards *



Insert Name Here

11 YEARS OF SERVICE

User Offline

Joined: 20th Mar 2007

Location: Worcester, England

Earn Badges

Posted: 8th Jun 2007 09:03 Link

Thanks guys!

That was very useful.

can a mod lock this topic please?


The below sentance is true.

The above sentance is false.

Paradox!

NanoGamez guy

11 YEARS OF SERVICE

User Offline

Joined: 13th Jan 2007

Location: Closer than you think...

Earn Badges

Posted: 9th Jun 2007 10:10 Link

Quote: "can a mod lock this topic please"



what's the point?



Nothing is impossible...

No really, it is.

Insert Name Here

11 YEARS OF SERVICE

User Offline

Joined: 20th Mar 2007

Location: Worcester, England

Earn Badges

Posted: 14th Jun 2007 07:33 Link

Because the questions been answered. No-one else needs to post.


The below sentance is true.

The above sentance is false.

Paradox!

This thread has not been posted in for more than 90 days and has been locked!


Server time is: 2018-06-23 04:16:13

Your offset time is: 2018-06-23 15:16:13

© Copyright 2018

Acceptable Usage Policy

 
MyTetra Share v.0.65
Яндекс индекс цитирования