Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Thu Mar 28, 2024 7:54 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: About API Reference
PostPosted: Sat Oct 03, 2009 11:21 pm 
Offline

Joined: Thu Oct 09, 2008 5:49 pm
Posts: 69
Firstly, I would like to say that the API reference on the wiki has helped me tons and that I really like it!

I only know little C++, and knew no C (though they are kinda the same) but I was able to learn a lot of Radium very quickly!


I do have question though, for more experienced (or maybe just plain experienced :D) programmer with Raydium...

Is there somewhere that has tutorial for Gui, possibly?
I searched in Google lots, and found info about RayPHP (which maybe can display a PHP/HTML based gui?)
But... with lack of better words.. I am very new to this :D

I suppose I need a bit of explaining, like for instance, on the API reference...

Quote:
Raydium's GUI are themable, using ".gui" theme text files. A default "full"
theme is provided as "theme-raydium2.gui" (and suitable ".tga" file) on the
data repository.


What does a .gui file actually do, if you have API and must code Gui in C..?
Does it like change font color and text size? or something else?


Quote:
The idea is simple: build a window (position and size), and create
widgets over this window.
All widgets are created using the current sizes (x,y and font). See
suitable function).


This does make sense. For instance (what I am thinking?) is that you make a 'clear' window over the actual map (say I have like hills.tri loaded) and then in that 'clear' window, you could display buttons, then put a texture on each button?

Do you get to specify texture for each button?

Like for instance..

I have window that is 500x500 (just example)
and I make a gui that was 500x500
then I make 4 buttons that are 50x50 each
could I put a 50x50 texture in each button?
or must I make a 500x500 texture for the whole gui? that has my 50x50 button textures on it?

Sorry for all questions...

Also, (I know I know, I must be very bugging to you all) could someone give a small example, with comments of what each piece of code do?
for instance, say I have this test application (just for reference, really.)

Code:
#include "raydium/index.c"
 
GLfloat sun[]={1.0,0.9,0.5,1.0};
 
GLfloat camx=10;
GLfloat camy=10;
GLfloat camz=20;
 
void display(void)
{
raydium_joy_key_emul();
 
camx+=raydium_joy_x;
camy+=raydium_joy_y;
 
if(raydium_key[GLUT_KEY_PAGE_DOWN]) camz--;
if(raydium_key[GLUT_KEY_PAGE_UP]  ) camz++;
 
if(raydium_key_last==1027) exit(0);
 
raydium_clear_frame();
raydium_camera_look_at(camx,camy,camz,0,0,0);
raydium_object_draw_name("cocorobix.tri");
raydium_rendering_finish();
}
 
int main(int argc, char **argv)
{
raydium_init_args(argc,argv);
raydium_window_create(640,480,RAYDIUM_RENDERING_WINDOW,"Mon premier test !");
raydium_texture_filter_change(RAYDIUM_TEXTURE_FILTER_TRILINEAR);
raydium_projection_near=0.01;
raydium_projection_far=1000;
raydium_projection_fov=60;
raydium_window_view_update();
raydium_light_on(0);
memcpy(raydium_light_color[0],sun,raydium_internal_size_vector_float_4);
raydium_light_intensity[0]=1000000;
 
raydium_light_position[0][0]=50;
raydium_light_position[0][1]=150;
raydium_light_position[0][2]=200;
 
raydium_light_update_all(0);
raydium_background_color_change(sun[0],sun[1],sun[2],sun[3]);
raydium_fog_disable();
raydium_callback(&display);
 
return 0;
}



how would I go about adding a simplistic gui that just had a start, and exit button, with a texture (or no texture) on it?
Could someone example code for me?



Sorry about all the hassle I must cause :lol:


Top
 Profile  
 
 Post subject: Re: About API Reference
PostPosted: Mon Oct 05, 2009 8:37 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Hi,

Huge bunch of questions here ! :)

To make it short, GUI system is based on "theme" files (.gui) that describes pixmaps that should be used for widgets ("buttons will used this rectangular area of the theme texture when idle, this other rectangle when activated, ..."). Then you load this .gui file into Raydium and simply ask for "high-level" widgets ("I want a windown, and a button, and it should be here on the window, ...")

The best is probably to have a look to an application that use the GUI API, like kinghill2 for a simple example, and ManiaDrive for what's probably currently the complexiest usage of this API. Source code of these applications are in the source tree of Raydium. It should help you a lot, I think.

And, yes, one day, we'll write tutorials for all this ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 31 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group