예제 #1
0
	void TestState::enter()
	{
	    int screenWidth = graphicsEngine->getScreenWidth();
		int screenHeight = graphicsEngine->getScreenHeight();

		AG_Window *chatWindow = AG_WindowNewNamed(AG_WINDOW_NOBUTTONS, "ChatWindow");
		AG_WindowSetCaption(chatWindow, "Chat");
		AG_WindowSetSpacing(chatWindow, 5);
		AG_WindowSetGeometry(chatWindow, 10, screenHeight - 185, 400, 175);
		AG_WindowShow(chatWindow);

        AG_Notebook *book = AG_NotebookNew(chatWindow, AG_NOTEBOOK_EXPAND);
        AG_ObjectSetName(book, "ChannelsFolder");
        AG_NotebookTab *nbTab = AG_NotebookAddTab(book, "Global Chat", AG_BOX_VERT);
        AG_ObjectSetName(nbTab, "GlobalChat");

        AG_Console *console = AG_ConsoleNew(nbTab, AG_CONSOLE_EXPAND|AG_CONSOLE_AUTOSCROLL);
        AG_ObjectSetName(console, "Chat");

		AG_Textbox *chatInput = AG_TextboxNewS(chatWindow, AG_TEXTBOX_CATCH_TAB, "");
		AG_TextboxSizeHint(chatInput, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
		AG_SetEvent(chatInput, "textbox-return", submit_chat, "%p%p%p", chatServer, chatInput, console);

		// add elements to interface manager
		interfaceManager->addWindow(chatWindow);

		popUp = AG_WindowNew(AG_WINDOW_NOBUTTONS);
		AG_WindowSetCaption(popUp, "Exit Game");
		AG_WindowSetGeometry(popUp, screenWidth / 2 - 75, screenHeight / 2 - 40, 150, 80);
		AG_WindowHide(popUp);

		AG_Button *logOut = AG_ButtonNewFn(popUp, 0, "Log Out", handle_logout, 0);
		AG_ButtonJustify(logOut, AG_TEXT_CENTER);

		AG_Button *exitGame = AG_ButtonNewFn(popUp, 0, "Exit to Desktop", handle_exit, 0);
		AG_ButtonJustify(exitGame, AG_TEXT_CENTER);

		interfaceManager->addWindow(popUp);

		std::string nick = player->getSelectedCharacter()->getName();
		std::string host = "neo.us.whatnet.org";
		chatServer->setNick(nick);

#ifndef WITHOUT_CHAT
        chatServer->connect(host);
#endif

        // add listener
        interfaceManager->addMouseListener(&handle_mouse);
	}
예제 #2
0
파일: titlebar.c 프로젝트: varialus/agar
static void
CreateCloseButton(AG_Titlebar *tbar)
{
	tbar->close_btn = AG_ButtonNewS(tbar, 0, NULL);
	AG_ButtonJustify(tbar->close_btn, AG_TEXT_LEFT);
	AG_ButtonSetFocusable(tbar->close_btn, 0);
	AG_ButtonSurfaceNODUP(tbar->close_btn, agIconWinClose.s);
	AG_ButtonSetPadding(tbar->close_btn, 0,0,0,0);
	AG_SetEvent(tbar->close_btn, "button-pushed",
	    CloseWindow, "%p", tbar);
}