aseprite/jinete/examples/00hello.c

66 lines
1.5 KiB
C
Raw Normal View History

2007-09-18 23:57:02 +00:00
/* jinete - a GUI library
2007-09-23 20:13:58 +00:00
* Copyright (C) 2003-2005, 2007 by David A. Capello
2007-09-18 23:57:02 +00:00
*
* Jinete is gift-ware.
*/
#include <allegro.h>
#include "jinete.h"
2007-09-23 20:13:58 +00:00
int main(int argc, char *argv[])
2007-09-18 23:57:02 +00:00
{
/* widgets to use */
JWidget manager, window, box, label, button;
/* Allegro stuff */
2007-09-23 20:13:58 +00:00
allegro_init();
if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 200, 0, 0) < 0) {
if (set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0) < 0) {
allegro_message("%s\n", allegro_error);
return 1;
}
2007-09-18 23:57:02 +00:00
}
2007-09-23 20:13:58 +00:00
install_timer();
install_keyboard();
install_mouse();
2007-09-18 23:57:02 +00:00
/* Jinete initialization */
2007-09-23 20:13:58 +00:00
manager = jmanager_new();
ji_set_standard_theme();
2007-09-18 23:57:02 +00:00
/* create main window */
2007-09-23 20:13:58 +00:00
window = jwindow_new("Example 00");
2007-09-18 23:57:02 +00:00
/* create a vertical box to set label and button positions */
2007-09-23 20:13:58 +00:00
box = jbox_new(JI_VERTICAL);
2007-09-18 23:57:02 +00:00
/* create a simple centered label with "Hello World!" text */
2007-09-23 20:13:58 +00:00
label = jlabel_new("Hello World!");
jwidget_set_align(label, JI_CENTER | JI_MIDDLE);
2007-09-18 23:57:02 +00:00
/* create a button to close the window */
2007-09-23 20:13:58 +00:00
button = jbutton_new("&Close");
2007-09-18 23:57:02 +00:00
/* a expansive widget can get more space that other ones */
2007-09-23 20:13:58 +00:00
jwidget_expansive(label, TRUE);
2007-09-18 23:57:02 +00:00
/* put the label and button in the box and that box in the window */
2007-09-23 20:13:58 +00:00
jwidget_add_child(box, label);
jwidget_add_child(box, button);
jwidget_add_child(window, box);
2007-09-18 23:57:02 +00:00
/* show the window in the screen and leave it in the background (the
manager will free it) */
2007-09-23 20:13:58 +00:00
jwindow_open_bg(window);
2007-09-18 23:57:02 +00:00
/* run windows */
2007-09-23 20:13:58 +00:00
jmanager_run(manager);
2007-09-18 23:57:02 +00:00
/* Jinete finalization */
2007-09-23 20:13:58 +00:00
jmanager_free(manager);
2007-09-18 23:57:02 +00:00
return 0;
}
END_OF_MAIN();