Computer Science Canada

GUI or Non-GUI?

Author:  Sean [ Tue Jan 22, 2008 3:42 pm ]
Post subject:  GUI or Non-GUI?

Hello, I making a game similar to 1 vs 100. I was told countless times, GUI is not the way to go, but is GUI that bad to use for such a game, or am I better off to create my own buttons and use the Mouse.Where function.

The thing is, I want a simple, yet elligant look to the program, creating your own buttons doesn't add the texture look that GUI does offer. GUI does take more time, I understand, but I would like the advice of others, I could try both and decide later on.

The look would be simple, an A Button, B Button, and C Button. Also with a Hint Button. Then above the question will appear, then start countdown. I understand how to do the buttons, design them and all that, but I am interested in attempting GUI for this project.

Author:  ericfourfour [ Tue Jan 22, 2008 4:10 pm ]
Post subject:  RE:GUI or Non-GUI?

I have only seen the show once a year ago. The player had to answer questions and chose people from a grid. If that is all the player does to interface, the gui is not really needed.

I recommend you make the game all text based. Use the keyboard to select people from the grid and answer questions. Make the ui modular so you can add different ones later. You will be done this game in no time. If you design this program with modularity in mind, adding a graphical interface will be no problem.

By the way, when I say modular, I don't mean use modules. Modularity is a programming concept. If you look at firefox, for example, the extensions and themes are an example of modularity. Object orientation (classes) and namespaces (modules) make this easier.

Author:  Sean [ Tue Jan 22, 2008 4:13 pm ]
Post subject:  Re: GUI or Non-GUI?

Alright, thanks for your input, I'll look into it at a later time.

Author:  Gooie [ Tue Jan 22, 2008 5:10 pm ]
Post subject:  Re: GUI or Non-GUI?

I still stand by DON'T USE GUI! Although I'm starting to see why someone would.


Just looked up 1 vs 100, looks like it would be fun to make, and play. (Use Classes)

Author:  Sean [ Tue Jan 22, 2008 5:44 pm ]
Post subject:  Re: GUI or Non-GUI?

Will be doing Gooie, but have plenty of Hockey and studying to do for the rest of my exams. Hopefully will get started on it tomorrow, since I am off.

Author:  Sean [ Wed Jan 23, 2008 7:33 pm ]
Post subject:  Re: GUI or Non-GUI?

Okay, I am using arrays for my answers is there an easier way to do it then this?

Turing:

var answer : array 0 .. 9 of string

answer (0) := "Yes?"
answer (1) := "No?"
answer (2) := "What?"
answer (3) := "Huh?"
answer (4) := "Say What?"
answer (5) := "Pardon?"
answer (6) := "Excuse Me?"
answer (7) := "Well?"
answer (8) := "Okay?"
answer (9) := "Maybe?"

This is not my actual code this is just an example I am trying to put out there. There must be a simpler way to declare my array answers then doing this constantly. Any ideas.

Author:  Nick [ Wed Jan 23, 2008 7:37 pm ]
Post subject:  RE:GUI or Non-GUI?

if you're arrays are all they same you could

code:
for i:1..upper(arrayName)
    arrayName(i);= [10,10.5,"I own you",true]
end for


however if they are diffrent theres not much you can do besides waht you have

Author:  Gooie [ Wed Jan 23, 2008 7:38 pm ]
Post subject:  Re: GUI or Non-GUI?

Vilament @ January 23rd, 7:33 pm wrote:
Okay, I am using arrays for my answers is there an easier way to do it then this?

Turing:

var answer : array 0 .. 9 of string

answer (0) := "Yes?"
answer (1) := "No?"
answer (2) := "What?"
answer (3) := "Huh?"
answer (4) := "Say What?"
answer (5) := "Pardon?"
answer (6) := "Excuse Me?"
answer (7) := "Well?"
answer (8) := "Okay?"
answer (9) := "Maybe?"

This is not my actual code this is just an example I am trying to put out there. There must be a simpler way to declare my array answers then doing this constantly. Any ideas.




Use init.
Turing:

var answer : array 0 .. 9 of string := init ("Yes?", "No?", "What?", "Huh?", "Say What?", "Pardon?", "Excuse Me?", "Well?", "Okay?", "Maybe?")

Author:  Sean [ Wed Jan 23, 2008 7:38 pm ]
Post subject:  Re: GUI or Non-GUI?

They will be all different, so I guess I'll stick with that, thanks for the fast response.

Author:  ericfourfour [ Wed Jan 23, 2008 8:01 pm ]
Post subject:  Re: GUI or Non-GUI?

Use flexible arrays and a text file. It's quite a bit of work initially, but once it's set up, adding questions is a breeze.

You can structure the text file so that each question is separated by a newline.

You should make two functions to make reading the text file easier. One that appends each line until it reaches a blank one or the end of file. The other calls the first function in a loop and adds each one to the flexible array until the end of the file.

Ex (not tested):
Turing:
fcn getNextQuestion (file : int) : string
    var str : string := ""
    loop
        exit when eof (file)
        var currentLine : string
        get : file, currentLine
        exit when currentLine = ""
        str += currentLine
    end loop
    result str
end getNextQuestion

proc loadQuestions
    var file : int
    open : file, "questions.txt", get
    loop
        exit when eof (file)
        var question : string := getNextQuestion (file)
        if question not= "" then
            % add question to flexible array
        end if
    end loop
    close : file
end loadQuestions


Edit: With this it is not that difficult to add answers to coresponding questions.

Author:  Sean [ Thu Jan 24, 2008 8:02 am ]
Post subject:  Re: GUI or Non-GUI?

It's not going to be a text game, there is buttons to press, graphics.

With Text I can not implement any graphic designs into it.

I'll look at the init.

Author:  ericfourfour [ Thu Jan 24, 2008 3:17 pm ]
Post subject:  RE:GUI or Non-GUI?

Vilament you shold reread what I posted. It does not require that you make a text based game.


: