Beispiel #1
0
static void
Init(void *obj)
{
	AG_Slider *sl = obj;

	WIDGET(sl)->flags |= AG_WIDGET_UNFOCUSED_BUTTONUP|
	                     AG_WIDGET_UNFOCUSED_MOTION|
			     AG_WIDGET_FOCUSABLE|
			     AG_WIDGET_TABLE_EMBEDDABLE;

	sl->type = AG_SLIDER_HORIZ;
	sl->ctlPressed = 0;
	sl->flags = 0;
	sl->wControlPref = agTextFontHeight;
	sl->wControl = sl->wControlPref;
	sl->xOffs = 0;
	
	AG_InitTimer(&sl->moveTo, "move", 0);

	AG_AddEvent(sl, "widget-shown", OnShow, NULL);
	AG_AddEvent(sl, "widget-hidden", OnFocusLoss, NULL);
	AG_SetEvent(sl, "widget-lostfocus", OnFocusLoss, NULL);
	AG_SetEvent(sl, "mouse-button-down", MouseButtonDown, NULL);
	AG_SetEvent(sl, "mouse-button-up", MouseButtonUp, NULL);
	AG_SetEvent(sl, "mouse-motion", MouseMotion, NULL);
	AG_SetEvent(sl, "key-down", KeyDown, NULL);
	AG_SetEvent(sl, "key-up", KeyUp, NULL);

#ifdef AG_DEBUG
	AG_BindInt(sl, "xOffs", &sl->xOffs);
	AG_BindInt(sl, "extent", &sl->extent);
#endif /* AG_DEBUG */
}
Beispiel #2
0
static void
Init(void *obj)
{
	AG_Button *bu = obj;

	WIDGET(bu)->flags |= AG_WIDGET_FOCUSABLE|
	                     AG_WIDGET_UNFOCUSED_MOTION|
			     AG_WIDGET_UNFOCUSED_BUTTONUP|
			     AG_WIDGET_TABLE_EMBEDDABLE|
			     AG_WIDGET_USE_TEXT|
			     AG_WIDGET_USE_MOUSEOVER;

	bu->flags = 0;
	bu->lbl = NULL;
	bu->surface = -1;
	bu->state = 0;
	bu->justify = AG_TEXT_CENTER;
	bu->valign = AG_TEXT_MIDDLE;
	bu->lPad = 4;
	bu->rPad = 4;
	bu->tPad = 3;
	bu->bPad = 3;
	AG_InitTimer(&bu->delayTo, "delay", 0);
	AG_InitTimer(&bu->repeatTo, "repeat", 0);

	AG_AddEvent(bu, "widget-shown", OnShow, NULL);
	AG_SetEvent(bu, "mouse-button-up", MouseButtonUp, NULL);
	AG_SetEvent(bu, "mouse-button-down", MouseButtonDown, NULL);
	AG_SetEvent(bu, "mouse-motion", MouseMotion, NULL);
	AG_SetEvent(bu, "key-up", KeyUp, NULL);
	AG_SetEvent(bu, "key-down", KeyDown, NULL);

	AG_BindInt(bu, "state", &bu->state);
}
Beispiel #3
0
static void
Init(void *obj)
{
	AG_GLView *glv = obj;

	WIDGET(glv)->flags |= AG_WIDGET_FOCUSABLE;

	glv->wPre = 100;
	glv->hPre = 100;
	glv->bgColor = AG_ColorRGB(0,0,0);

	glv->flags = AG_GLVIEW_INIT_MATRICES;
	glv->draw_ev = NULL;
	glv->underlay_ev = NULL;
	glv->overlay_ev = NULL;
	glv->scale_ev = NULL;
	glv->keydown_ev = NULL;
	glv->btndown_ev = NULL;
	glv->keyup_ev = NULL;
	glv->btnup_ev = NULL;
	glv->motion_ev = NULL;

	AG_SetEvent(glv, "widget-moved", WidgetMoved, NULL);
	AG_SetEvent(glv, "mouse-button-down", MouseButtonDown, NULL);
	AG_AddEvent(glv, "attached", OnAttach, NULL);
}
Beispiel #4
0
static void
Init(void *obj)
{
    AG_GLView *glv = obj;

    WIDGET(glv)->flags |= AG_WIDGET_FOCUSABLE;

    glv->wPre = 100;
    glv->hPre = 100;

    glv->flags = AG_GLVIEW_INIT_MATRICES;
    glv->draw_ev = NULL;
    glv->overlay_ev = NULL;
    glv->scale_ev = NULL;
    glv->keydown_ev = NULL;
    glv->btndown_ev = NULL;
    glv->keyup_ev = NULL;
    glv->btnup_ev = NULL;
    glv->motion_ev = NULL;

    AG_SetEvent(glv, "widget-moved", WidgetMoved, NULL);
    AG_SetEvent(glv, "mouse-button-down", MouseButtonDown, NULL);
    AG_AddEvent(glv, "attached", OnAttach, NULL);

    /* XXX TODO should make this configurable through AG_GLView. */
    AG_RedrawOnTick(glv, 1);

#ifdef AG_DEBUG
    AG_BindUint(glv, "flags", &glv->flags);
    AG_BindInt(glv, "wPre", &glv->wPre);
    AG_BindInt(glv, "hPre", &glv->hPre);
#endif
}
MenuDeathmatchBonuses::MenuDeathmatchBonuses(){
	AG_Box * item;

	// nadpis
	createHeading("Deathmatch bonuses setings");

	// ok
	item = createItem("OK");
	AG_SetEvent(item, "window-mousebuttondown", handlerBack, 0);

	// bonus
	item = createItemHoriz("bonus");
	AG_AddEvent(items_.back(), "window-keydown", handlerIntItem,
		"%p,%i,%i", &bonus,
		MENU_DEATHMATCH_BONUSES_MIN, MENU_DEATHMATCH_BONUSES_MAX);

	AG_NumericalNewIntR(item, 0, 0, 0, &bonus,
		MENU_DEATHMATCH_BONUSES_MIN, MENU_DEATHMATCH_BONUSES_MAX);

	// ok
	item = createItem("OK");
	AG_SetEvent(item, "window-mousebuttondown", handlerBack, 0);

	AG_SpacerNewHoriz(win);
}
Beispiel #6
0
void AGOL_About::SetWindowCloseEvent(EventHandler *handler)
{
	if(handler)
	{
		CloseEventHandler = handler;

		AG_AddEvent(AboutDialog, "window-close", EventReceiver, "%p", handler);
	}
}
Beispiel #7
0
static void
Init(void *obj)
{
	AG_HSVPal *pal = obj;

	WIDGET(pal)->flags |= AG_WIDGET_FOCUSABLE;

	pal->flags = 0;
	pal->h = 0.0;
	pal->s = 0.0;
	pal->v = 0.0;
	pal->a = 1.0;
	pal->pixel = 0;
	pal->color = AG_ColorRGBA(0,0,0,255);
	pal->circle.spacing = 10;
	pal->circle.width = 20;
	pal->state = AG_HSVPAL_SEL_NONE;
	pal->surface = NULL;
	pal->surfaceId = -1;
	pal->menu = NULL;
	pal->menu_item = NULL;
	pal->menu_win = NULL;
	pal->cTile = AG_ColorRGB(140,140,140);

	AG_SetEvent(pal, "mouse-button-up", MouseButtonUp, NULL);
	AG_SetEvent(pal, "mouse-button-down", MouseButtonDown, NULL);
	AG_SetEvent(pal, "mouse-motion", MouseMotion, NULL);
	
	AG_BindFloat(pal, "hue", &pal->h);
	AG_BindFloat(pal, "saturation", &pal->s);
	AG_BindFloat(pal, "value", &pal->v);
	AG_BindFloat(pal, "alpha", &pal->a);
	AG_BindUint32(pal, "pixel", &pal->pixel);
	AG_BindPointer(pal, "color", (void *)&pal->color);
	AG_BindPointer(pal, "pixel-format", NULL);
/*	AG_BindFloat(pal, "red", &pal->r); */
/*	AG_BindFloat(pal, "green", &pal->g); */
/*	AG_BindFloat(pal, "blue", &pal->b); */
/*	AG_BindFloat(pal, "RGBAv", &pal->rgbav); */
	
	AG_SetEvent(pal, "bound", Bound, NULL);
	AG_AddEvent(pal, "attached", OnAttach, NULL);
}
Beispiel #8
0
static void
Init(void *obj)
{
	AG_FontSelector *fs = obj;
	
	fs->flags = AG_FONTSELECTOR_UPDATE;

	fs->hPane = AG_PaneNewHoriz(fs, AG_PANE_EXPAND);
	fs->tlFaces = AG_TlistNew(fs->hPane->div[0], AG_TLIST_EXPAND);
	fs->hPane2 = AG_PaneNewHoriz(fs->hPane->div[1], AG_PANE_EXPAND);
	fs->tlStyles = AG_TlistNew(fs->hPane2->div[0], AG_TLIST_EXPAND);
	fs->sizeBox = AG_BoxNewVert(fs->hPane2->div[1], AG_BOX_EXPAND);
	fs->tlSizes = AG_TlistNew(fs->sizeBox, AG_TLIST_EXPAND);

	fs->font = NULL;
	fs->curFace[0] = '\0';
	fs->curStyle = 0;
	fs->curSize = 0;
	fs->rPreview = AG_RECT(0,0,0,64);
	fs->sPreview = -1;

	AG_TlistSizeHint(fs->tlFaces, "XXXXXXXXXXXXXXX", 8);
	AG_TlistSizeHint(fs->tlStyles, "XXXXXXXXX", 8);
	AG_TlistSizeHint(fs->tlSizes, "100", 8);
	
	AG_BindPointer(fs, "font", (void *)&fs->font);
	
	AG_SetEvent(fs, "bound", Bound, NULL);
	AG_AddEvent(fs, "widget-shown", UpdateFaces, NULL);
	AG_SetEvent(fs->tlFaces, "tlist-selected", SelectedFace, "%p", fs);
	AG_SetEvent(fs->tlStyles, "tlist-selected", SelectedStyle, "%p", fs);
	AG_SetEvent(fs->tlSizes, "tlist-selected", SelectedSize, "%p", fs);
	
#ifdef AG_DEBUG
	AG_BindUint(fs, "flags", &fs->flags);
	/* AG_BindString(fs, "curFace", fs->curFace, sizeof(fs->curFace)); */
	AG_BindUint(fs, "curStyle", &fs->curStyle);
	AG_BindInt(fs, "curSize", &fs->curSize);
	AG_BindInt(fs, "sPreview", &fs->sPreview);
#endif
}
Beispiel #9
0
MenuOptions::MenuOptions():
			speed_(CONFIG->speed()),
			visible_presumption_(CONFIG->visible_presumption()),
			fullscreen_(CONFIG->fullscreen()),
			sound_(CONFIG->sound()){
	AG_Box * item;

	// nadpis
	createHeading("Options");

	// jazyk
	item = createItem("Language");
// TODO u combo

	// klavesy
	item = createItem("Controls");
	AG_SetEvent(item, "window-mousebuttondown",
			MenuOptionsControls::create, 0);

	// rychlost hry
	item = createItemHoriz("Game speed");
	AG_AddEvent(items_.back(), "window-keydown", handlerIntItem,
		"%p,%i,%i", &speed_,
		CONFIG_SPEED_MIN, CONFIG_SPEED_MAX);

	AG_NumericalNewIntR(item, 0, 0, 0, &speed_,
		CONFIG_SPEED_MIN, CONFIG_SPEED_MAX);

	// viditelna presumpce
	item = createItemHoriz("Explosion presumptions");
	AG_AddEvent(items_.back(), "window-keydown", handlerBoolItem,
		"%p", &visible_presumption_);

	item = AG_BoxNewHoriz(item, AG_BOX_HOMOGENOUS | AG_BOX_HFILL);
	AG_BoxSetPadding(item, 0);
	AG_SpacerNewVert(item);
	AG_CheckboxNewInt(item, 0, "  ", &visible_presumption_);

	// fullscreen
	item = createItemHoriz("Play in fullscreen");
	AG_AddEvent(items_.back(), "window-keydown", handlerBoolItem,
		"%p", &fullscreen_);

	item = AG_BoxNewHoriz(item, AG_BOX_HOMOGENOUS | AG_BOX_HFILL);
	AG_BoxSetPadding(item, 0);
	AG_SpacerNewVert(item);
	AG_CheckboxNewInt(item, 0, "  ", &fullscreen_);

	// zvuk
	item = createItemHoriz("Sound enabled");
	AG_AddEvent(items_.back(), "window-keydown", handlerBoolItem,
		"%p", &sound_);

	item = AG_BoxNewHoriz(item, AG_BOX_HOMOGENOUS | AG_BOX_HFILL);
	AG_BoxSetPadding(item, 0);
	AG_SpacerNewVert(item);
	AG_CheckboxNewInt(item, 0, "  ", &sound_);


	// back
	item = createItem("Save");
	AG_SetEvent(item, "window-mousebuttondown", handlerBack, 0);

	AG_SpacerNewHoriz(win);
}
Beispiel #10
0
MenuOptions::MenuOptions():
			speed_(CONFIG->speed()),
			visible_presumption_(CONFIG->visible_presumption()),
			split_screen_(CONFIG->split_screen()),
			fullscreen_(CONFIG->fullscreen()),
			sound_(CONFIG->sound()){
	AG_Box * item;
	AG_UCombo *combo;
	AG_TlistItem * combo_item;
	AG_Checkbox * checkbox;
	// nadpis
	createHeading(LANG_MENU(LANG_OPTIONS, LANG_HEADING));

	// jazyk
	item = createItem(LANG_MENU(LANG_OPTIONS, LANG_LANGUAGE));
	combo = AG_UComboNew(item, AG_UCOMBO_HFILL);
	AG_SetEvent(combo, "ucombo-selected", handlerLanguage,
			"%p", combo->button);
	for(Uint16 i=0 ; i<CONFIG->languages_.size() ; ++i){
		combo_item = AG_TlistAddPtr(combo->list, 0,
			CONFIG->languages_[i].show.c_str(), &CONFIG->languages_[i]);
		if(CONFIG->language_==CONFIG->languages_[i].name)
			AG_ButtonText(combo->button, "%s", combo_item->text);
	}

	// klavesy
	item = createItem(LANG_MENU(LANG_OPTIONS, LANG_CONTROLS));
	AG_SetEvent(item, "window-mousebuttondown",
			MenuOptionsControls::create, 0);

	// rychlost hry
	item = createItemHoriz(LANG_MENU(LANG_OPTIONS, LANG_SPEED));
	AG_AddEvent(items_.back(), "window-keyup", handlerIntItem,
		"%p,%i,%i", &speed_,
		CONFIG_SPEED_MIN, CONFIG_SPEED_MAX);

	AG_NumericalNewIntR(item, 0, 0, 0, &speed_,
		CONFIG_SPEED_MIN, CONFIG_SPEED_MAX);

	// viditelna presumpce
	createCheckboxItem(LANG_MENU(LANG_OPTIONS, LANG_PRESUMPTIONS),
		&visible_presumption_);
	// rozedelni obrazovek
	createCheckboxItem(LANG_MENU(LANG_OPTIONS, LANG_SPLIT_SCREEN),
		&split_screen_);

	// fullscreen
	checkbox = createCheckboxItem(LANG_MENU(LANG_OPTIONS, LANG_FULLSCREEN),
		&fullscreen_);
	AG_AddEvent(items_.back(), "window-mousebuttondown", handlerToggleFullscreen, 0);
	AG_AddEvent(checkbox, "window-mousebuttondown", handlerToggleFullscreen, 0);

	// zvuk - neni implementovano
// 	createCheckboxItem(LANG_MENU(LANG_OPTIONS, LANG_SOUND),
// 		&sound_);

	// back
	item = createItem(LANG_MENU(LANG_OPTIONS, LANG_SAVE));
	AG_SetEvent(item, "window-mousebuttondown", handlerBack, 0);

	AG_SpacerNewHoriz(win);
}