GLBasic forum

Main forum => GLBasic - en => Topic started by: Hatonastick on 2008-Apr-07

Title: What's the maximum window size I should go for windowed games?
Post by: Hatonastick on 2008-Apr-07
The game I'm working on currently uses a 600x600 window, but I was thinking of upping it to 700x700 (it has to be square) as 600x600 looks tiny.  The problem is that messes up those who use 800x600 as their desktop size.  However do enough people really still use that resolution to worry about it?  The next real size up from that 1024x768 shouldn't be a problem (although I'd prefer being able to make the window 800x800 :)).  Or should I just stick with 600x600? :)
Title: What's the maximum window size I should go for windowed games?
Post by: Hatonastick on 2008-Apr-07
Hmm maybe I should have called this thread: Several questions.  I have another one but it might be  a waste to make another thread.  Is there a command to detect whether or not the game window is currently active (selected) or does GLBasic automatically pause when the screen loses focus?
Title: What's the maximum window size I should go for windowed games?
Post by: Quentin on 2008-Apr-07
normally the game pauses automatically when the game windows lost the focus. You can control this behavior with the AUTOPAUSE commend. (see at F1 help)

regarding window resolutions:
I think there are not much people using desktop resolutions of 800x600. Even older pc's are able to handle 1024x768 or higher for normal windows applications.
Title: What's the maximum window size I should go for windowed games?
Post by: Hatonastick on 2008-Apr-07
Thanks for your help! :)  Yeah I just found the autopause command just then.  Still getting my head around the differences between GLBasic and others I've used.

Is it possible to define the window size in your program, or is it only via the Project Options dialogue box?  Or do you need to use inline and Win32 API calls?
Title: What's the maximum window size I should go for windowed games?
Post by: Quentin on 2008-Apr-07
use SETSCREEN command. SETSCREEN will overwrite your settings in the project properties.
Title: What's the maximum window size I should go for windowed games?
Post by: Hatonastick on 2008-Apr-07
Ok thanks! :)  Yet another question.  Sorry about all these, I'm starting to convert a game I was writing in PureBASIC to GLBasic so hence running about looking for equivalents.  So I need to make sure there are, or aren't equivalents before I start rewriting code.  If that makes sense.  Oh and I definitely look before asking here too.  Dont want to be a pain. :)

Anyway, is there a round fractions up or down command?  Nevermind, looks like RND() returns whole numbers?

Ah I do have a question: Are arrays automatically global?  I noticed it didn't like it when I put GLOBAL before DIM.
eg. GLOBAL DIM Enemies[50]
Title: What's the maximum window size I should go for windowed games?
Post by: Quentin on 2008-Apr-07
do you mean random number? Yes the RND() function will give you ;)

if you mean a ROUND function like in PureBasic .... is not present acutally in GLBasic but you can easily build it on your own

Code (glbasic) Select
a = 1.454544

PRINT "Number (original):   " + a, 0, 0
PRINT "Number (round up):   " + round(a, 1), 0, 20
PRINT "Number (round down): " + round(a, 0), 0, 40
SHOWSCREEN
MOUSEWAIT
END

FUNCTION round: number, mode
  IF mode = 0
    RETURN INTEGER(number)
  ELSE
    RETURN INTEGER(number + 1)
  ENDIF
ENDFUNCTION
Title: What's the maximum window size I should go for windowed games?
Post by: Hatonastick on 2008-Apr-07
Nice - thanks! :)  I might have to stop editing my posts.

Anyway just in case you miss it, are arrays automatically global?  I can't find anything in the help file that says one way or the other.
Title: What's the maximum window size I should go for windowed games?
Post by: Quentin on 2008-Apr-07
you can use the commands GLOBAL and LOCAL (see help once more ;))

If you don't define an array GLOBAL or LOCAL it is defined as GLOBAL, so you can use it everywhere in your program.

Example:
Code (glbasic) Select
DIM array[10]

// fill array with random numbers
FOR i = 0 TO 9
  array[i] = RND(10)
NEXT

// print array content on screen
PRINT "Array content:", 0, 0
printarray()
SHOWSCREEN
MOUSEWAIT
KEYWAIT
END


FUNCTION printarray:
  LOCAL i
  FOR i = 0 TO 9
    PRINT array[i], 0, (i + 1) * 20
  NEXT
ENDFUNCTION
if you define it LOCAL, it can be used only in the main program (in this example) or in a function
In the next example it can't be used in the function "printarray()"
Code (glbasic) Select
LOCAL array[]
DIM array[10]

// fill array with random numbers
FOR i = 0 TO 9
  array[i] = RND(10)
NEXT

// print array content on screen
PRINT "Array content:", 0, 0
printarray()
SHOWSCREEN
MOUSEWAIT
KEYWAIT
END


FUNCTION printarray:
  LOCAL i
  FOR i = 0 TO 9
    PRINT array[i], 0, (i + 1) * 20
  NEXT
ENDFUNCTION
Title: What's the maximum window size I should go for windowed games?
Post by: Hatonastick on 2008-Apr-07
Thanks very, very much for your answers.  I think I might be ok for now.  Those were my main issues.
Title: What's the maximum window size I should go for windowed games?
Post by: Quentin on 2008-Apr-07
you're welcome
have fun with it ;)
Title: What's the maximum window size I should go for windowed games?
Post by: Hatonastick on 2008-Apr-07
Heheheh thanks - appears I've hit a block already.

I'm trying to create an array of types.  The error might be somewhere else in my code though.  Anyway do you do this:
DIM MyArray[arraysize] AS mytype
Title: What's the maximum window size I should go for windowed games?
Post by: Quentin on 2008-Apr-07
use it in that way.

Code (glbasic) Select
TYPE mytype
  a
  b
ENDTYPE

GLOBAL MyArray[] AS mytype    // or use LOCAL just as you want
DIM MyArray[arraysize]
Title: What's the maximum window size I should go for windowed games?
Post by: Hatonastick on 2008-Apr-07
Aha!  Ok thanks yet again. :)  Hopefully finally now my barrage will cease. :)

Hey I like the debugger now that I've finally worked out how to use it properly. :)
Title: What's the maximum window size I should go for windowed games?
Post by: Hatonastick on 2008-Apr-07
Ok another question, is there a command to change the title of the window (I cant find one) or do I need to resort to DLL pokery trickery?

If no command that's fine, the DLL pokery trickery already worked. :)
Title: What's the maximum window size I should go for windowed games?
Post by: Kitty Hello on 2008-Apr-07
Project/Options -> Program name.