Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - BdR

Pages: 1 2 3 [4]
I saw "Life", the latest showroom entry and I thought it was pretty cool.. :good:

Unfortunately, it always starts with a random pattern, so I've written a little function to read in *.lif files. These are relatively simple files (plain-text) used to describe and exchange Life pattern. You can download these kind of files from many websites, for example here. I've also created a glbasic.lif, it display the GLBasic logo. 8) (see attachment)
Code: GLBasic [Select]
FUNCTION lifload: filename$
// load and interpret a Game of Life pattern file (*.lif)

        LOCAL str$, px$, py$
        LOCAL i
        LOCAL x%, y%, scrx%, scry%

        // clear
        FOR y%=0 TO heigt%-1
                FOR x%=0 TO width%-1
                        pl%[x%][y%] = 0

        // get middle of screen
        GETSCREENSIZE scrx%, scry%

        // open and read file
        IF OPENFILE(1, filename$, 1)
                WHILE (ENDOFFILE(1) = FALSE)
                        // read next line
                        READLINE 1, str$
                        str$ = str$ + "\n"
                        // command
                        IF (MID$(str$, 0, 1) = "#")
                                // P = position command, for example "#P -3 -1"
                                IF (MID$(str$, 1, 1) = "P")
                                        str$ = MID$(str$, 3)
                                        i = INSTR(str$, " ")
                                        IF (i <> -1)
                                                // get positions
                                                px$ = MID$(str$, 0, i)
                                                py$ = MID$(str$, i+1)
                                                // string to int
                                        x% = INTEGER(px$) + (scrx% / 2)
                                                y% = INTEGER(py$) + (scry% / 2)
                                // TODO: display comment lines on screen? "#D blah bla"
                                //IF (MID$(str$, 1, 1) = "D")
                                // cells, for example "*...***"
                                FOR i = 0 TO LEN(str$)
                                        IF (MID$(str$, i, 1) = "*")
                                                // not out of bounds
                                                IF (x%+i >= 0) AND (y% >= 0) AND (x%+i < scrx%) AND (y% < scry%)
                                                        pl%[x%+i][y%] = 1
                                NEXT //i
                                y% = y% + 1

and in the sourcecode (provided in showroom download) you can replace "GOSUB rrand" with "lifload("glbasic.lif")"

It was written by someone only known as Goos (who is dutch I think, looking at some of the code), no e-mail or anything, so I hope he will read this topic.

[attachment deleted by admin]

GLBasic - en / GLBasic and MacOS..?
« on: 2007-Jul-04 »
I'm new to GLBasic and just started to check it out, but I'm very impressed. Easy coding with awesome game results. :) I tried the Quantum game and looked at the code, and it runs great. I especially like the built in net-support for online highscore tables, and with only a few lines of code.

My question, will GLBasic have MacOS support at some point? Or is this not planned? I currently program in BlitzMax (newest BlitzBasic IDE) which has MacOS support. No MacOS support is for me the main reason not to use GLBasic. :|

Don't get me wrong, I know this is not a small thing to do, adding a completely new architecture/OS support to a compiler. But MacOS has a large userbase, most people play games on their mac. And Linux and GP2X seem, at least to me, relatively obscure platforms.

Pages: 1 2 3 [4]