Computer Science Canada

Graphics Size determined by variable

Author:  TheEvilOne [ Tue Apr 12, 2005 4:59 pm ]
Post subject:  Graphics Size determined by variable

Alright, this might be a really stupid question but... does anyone know how I can set the screen size by a variable? I've been trying, but it wont work =/ it will let me use a number, but not a variable.

code:

const ScreenWidth : int := 600 %Whatever you want the screen width to be
const ScreenHeight : int := 600 %Whatever you want the screen height to be
const TilesAcross : int := 20 %number of numbers in 1 line
const TilesDown : int := 15 %number of lines in tiles.txt file
const TileWidth : int := 32 %The width of each tile - Temporary
const TileHeight : int := 32 %The height of each tile - Temporary
const TileDirectory : string := "tiles/" %The directory in which your tiles are help
const NumberOfTiles : int := 10 %IMPORTANT - The amount of tiles you have
const FileType : string := "bmp" %Put this as the type of file your tiles are - put "bmp" or "jpg" depending on file type
var Transparency : boolean := false %Change this to true if you want your tiles to have transparency (WARNING: Unless you do modifications to the code, and put something under the main map, you will only see white through your tiles)

%%%%%%%%%%%%%%%%%%%%%%%%%% DO NOT CHANGE ANYTHING BELOW THIS LINE!!!!! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
setscreen("graphics:TileWidth*TilesAcross;TileHeight*TilesDown")
setscreen("offscreenonly,noecho,nobuttonbar,nocursor")


Anyways, im writing a dynamic tile system, and its not really a must, just thought it would be easier for users to be able to specify the size by variable =/

Author:  Cervantes [ Tue Apr 12, 2005 7:10 pm ]
Post subject: 

Convert your integer into a string.
code:

var num := 234
setscreen ("graphics:"+intstr (num) + ";" + intstr (num) + ",offscreenonly, etc.")

Author:  TheEvilOne [ Tue Apr 12, 2005 8:04 pm ]
Post subject: 

You know... I didnt think about the fact that it had to be converted to string. Thanks so much Very Happy


: