Game Menu (ANSI C)


#1

Hi, i’m trying (yep, still trying) to code a domino game, i’m still dealing
with SDL/game programming basics (main loop, etc) and i’m kind of lost now
trying to add a configuration menu to set some values because i don’t know
where/how to put the code for the menu, i’ve only found C++ theory talking
about classes for menu state and game state. Anybody knows or has code with
this kind of examples but just for C (no C++)

Thanks in advanced

Ciro


#2

Hi, i’m trying (yep, still trying) to code a domino game, i’m still
dealing
with SDL/game programming basics (main loop, etc) and i’m kind of
lost now
trying to add a configuration menu to set some values because i
don’t know
where/how to put the code for the menu, i’ve only found C++ theory
talking
about classes for menu state and game state. Anybody knows or has
code with
this kind of examples but just for C (no C++)

Thanks in advanced

Ciro

SDL is not like glut and has no menu support. You might check:


http://www.libsdl.org/pipermail/sdl/2005-March/067723.html
http://www.libsdl.org/pipermail/sdl/2005-June/069203.html

in general
http://www.google.com/search?
num=100&hl=en&lr=&safe=off&client=firefox-a&rls=org.mozilla%3Aen-US%
3Aofficial&hs=tvf&q=%22SDL+menu%22&btnG=Search

And you have a listing of GUI lib at libsdl.org

Then, in theory, you do something like this:

mainloop() {

pool event
if event is mouse click
	handle mouse click (show menu)


}

Good luck

RegardsOn Jan 11, 2007, at 10:58 AM, Ciro Iriarte wrote:


Kuon
Programmer and sysadmin.

“Computers should not stop working when the users’ brain does.”


#3

Ciro Iriarte wrote:

Hi, i’m trying (yep, still trying) to code a domino game, i’m still dealing
with SDL/game programming basics (main loop, etc) and i’m kind of lost now
trying to add a configuration menu to set some values because i don’t know
where/how to put the code for the menu, i’ve only found C++ theory talking
about classes for menu state and game state. Anybody knows or has code with
this kind of examples but just for C (no C++)

Thanks in advanced

Ciro


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

the absolutely easiest way to code a gui is the so called
"immediate gui" method.

go too

and it does not requires object orientation ala c++.


#4

" Kuon - Nicolas Goy - ??? (Goyman.com SA) " escribi? en
el mensaje news:E06C9642-780E-4DC2-BD11-16828241DFCF at goyman.com

Hi, i’m trying (yep, still trying) to code a domino game, i’m still
dealing
with SDL/game programming basics (main loop, etc) and i’m kind of
lost now
trying to add a configuration menu to set some values because i
don’t know
where/how to put the code for the menu, i’ve only found C++ theory
talking
about classes for menu state and game state. Anybody knows or has
code with
this kind of examples but just for C (no C++)

Thanks in advanced

Ciro

SDL is not like glut and has no menu support. You might check:

http://www.gamedev.net/community/forums/topic.asp?topic_id=376231
http://www.libsdl.org/pipermail/sdl/2005-March/067723.html
http://www.libsdl.org/pipermail/sdl/2005-June/069203.html

in general
http://www.google.com/search?
num=100&hl=en&lr=&safe=off&client=firefox-a&rls=org.mozilla%3Aen-US%
3Aofficial&hs=tvf&q=%22SDL+menu%22&btnG=Search

And you have a listing of GUI lib at libsdl.org

Then, in theory, you do something like this:

mainloop() {

pool event
if event is mouse click
handle mouse click (show menu)

}

Good luck

Regards


Kuon
Programmer and sysadmin.

“Computers should not stop working when the users’ brain does.”

Thanks for you reply, i would really like to keep it simple and not add
other libs, it doesn’t need to be a winapi like menu, maybe a doom old
school kind of menu?, i just need it to set some variables and define the
game modality

Ciro> On Jan 11, 2007, at 10:58 AM, Ciro Iriarte wrote:


#5

the absolutely easiest way to code a gui is the so called
"immediate gui" method.

go too
http://www.mollyrocket.com/forums/viewforum.php?f=10&sid=a02fd5fe9fb2bdf93376454a5385e793

and it does not requires object orientation ala c++.

I’ll check it out, thanks!


#6

“Ciro Iriarte” <@Ciro_Iriarte> escribi? en el mensaje
news:eo51ls$p6l$1 at sea.gmane.org

Hi, i’m trying (yep, still trying) to code a domino game, i’m still
dealing with SDL/game programming basics (main loop, etc) and i’m kind of
lost now trying to add a configuration menu to set some values because i
don’t know where/how to put the code for the menu, i’ve only found C++
theory talking about classes for menu state and game state. Anybody knows
or has code with this kind of examples but just for C (no C++)

Thanks in advanced

Ciro

Hi, i need to code a Domino game, using plain C and some API, i chose SDL
thinking it could make my life easier, but i’m not quite sure now, i need to
set some variables for configuration (menu for the user) and probably drag
and drop to place each domino, this is apart from the game logic and general
drawing that i’m sure i can do with SDL, can anybody tell me if it’s worth
at all to use SDL for this particular project?, i’m still checking
documentation you just pointed me to, but would like to hear your opinion.

Thanks in advanced
Ciro


#7

[…]

Hi, i need to code a Domino game, using plain C and some API, i
chose SDL thinking it could make my life easier, but i’m not quite
sure now, i need to set some variables for configuration (menu for
the user)

Use sliders or “spinners” (two buttons and display) for values and
things where you’d normally use a combobox or similar… Text input
(player names and the like) is probably the hardest part, but even
that is rather trivial, as long as you stay away from selections,
clipboard, internationalization etc. (Though some of that is actually
handled by most of the SDL add-on libs you would use to render text;
SFont, DFont, SDL_ttf etc.)

and probably drag and drop to place each domino,

I actually think the easiest way to do this is with your own code,
over SDL. Just learning the API of any GUI toolkit that can help with
this to any significant extent is going to take longer than hacking a
working implementation over SDL.

this is apart from the game logic and general
drawing that i’m sure i can do with SDL, can anybody tell me if it’s
worth at all to use SDL for this particular project?, i’m still
checking documentation you just pointed me to, but would like to
hear your opinion.

Frankly, I don’t think it gets much easier. Basic buttons, dragging
with snap-to-grid or snap-to-object and things like that, is trivial
compared to any serious game logic.

Besides, if you’re doing this in order to learn something, I think
it’s a good idea to try to do it using plain SDL first. It’s a good
way to learn the very basics of interactive graphics programming.

(Actually, I’d say it would be a useful experience to implement a
complete GUI toolkit in pure assembly language, to the metal, no
drivers, no APIs, no nothing - but that’s probably just because that
was about the only way to create a nice GUI and still have some CPU
time left back when I started programming. These days, there
are “real” programmers who have never written a single line of
assembly language code…! :wink:

//David Olofson - Programmer, Composer, Open Source Advocate

.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
’-- http://www.reologica.se - Rheology instrumentation --'On Friday 12 January 2007 12:01, Ciro Iriarte wrote:


#8

Quoting David Olofson :

(Actually, I’d say it would be a useful experience to implement a
complete GUI toolkit in pure assembly language, to the metal, no
drivers, no APIs, no nothing - but that’s probably just because that
was about the only way to create a nice GUI and still have some CPU
time left back when I started programming. These days, there
are “real” programmers who have never written a single line of
assembly language code…! :wink:

Ah, those were the days! :slight_smile:

I think the last time I coded something 100% in assembly was around
1995.–
Paulo


This message was sent using IMP, the Internet Messaging Program.


#9

David Olofson wrote:> On Friday 12 January 2007 12:01, Ciro Iriarte wrote:

[…]

Hi, i need to code a Domino game, using plain C and some API, i
chose SDL thinking it could make my life easier, but i’m not quite
sure now, i need to set some variables for configuration (menu for
the user)

Use sliders or “spinners” (two buttons and display) for values and
things where you’d normally use a combobox or similar… Text input
(player names and the like) is probably the hardest part, but even
that is rather trivial, as long as you stay away from selections,
clipboard, internationalization etc. (Though some of that is actually
handled by most of the SDL add-on libs you would use to render text;
SFont, DFont, SDL_ttf etc.)

and probably drag and drop to place each domino,

I actually think the easiest way to do this is with your own code,
over SDL. Just learning the API of any GUI toolkit that can help with
this to any significant extent is going to take longer than hacking a
working implementation over SDL.

this is apart from the game logic and general
drawing that i’m sure i can do with SDL, can anybody tell me if it’s
worth at all to use SDL for this particular project?, i’m still
checking documentation you just pointed me to, but would like to
hear your opinion.

Frankly, I don’t think it gets much easier. Basic buttons, dragging
with snap-to-grid or snap-to-object and things like that, is trivial
compared to any serious game logic.

Besides, if you’re doing this in order to learn something, I think
it’s a good idea to try to do it using plain SDL first. It’s a good
way to learn the very basics of interactive graphics programming.

(Actually, I’d say it would be a useful experience to implement a
complete GUI toolkit in pure assembly language, to the metal, no
drivers, no APIs, no nothing - but that’s probably just because that
was about the only way to create a nice GUI and still have some CPU
time left back when I started programming. These days, there
are “real” programmers who have never written a single line of
assembly language code…! :wink:

Thanks for all your comments, i’ll keep looking for examples and try to hack
my way to make this work.

Ciro