Ejemplo n.º 1
0
static void
SDLGL_Close(void *obj)
{
	AG_Driver *drv = obj;
	AG_DriverSDLGL *sgl = obj;

#ifdef AG_DEBUG
	if (nDrivers != 1) { AG_FatalError("Driver close without open"); }
#endif
	AG_FreeCursors(AGDRIVER(sgl));

	if (AG_CfgBool("view.full-screen")) {
		SDL_WM_ToggleFullScreen(sgl->s);
	}
	if (initedSDLVideo) {
		SDL_QuitSubSystem(SDL_INIT_VIDEO);
		initedSDLVideo = 0;
	}
	AG_ObjectDetach(drv->mouse);
	AG_ObjectDestroy(drv->mouse);
	AG_ObjectDetach(drv->kbd);
	AG_ObjectDestroy(drv->kbd);
	drv->mouse = NULL;
	drv->kbd = NULL;

	if (sgl->outMode != AG_SDLGL_OUT_NONE) {
		Free(sgl->outBuf);
		sgl->outBuf = NULL;
		sgl->outMode = AG_SDLGL_OUT_NONE;
	}

	nDrivers = 0;
}
Ejemplo n.º 2
0
Archivo: ucombo.c Proyecto: adsr/agar
static void
OnDetach(AG_Event *event)
{
	AG_UCombo *com = AG_SELF();

	if (com->panel != NULL) {
		AG_ObjectDetach(com->list);
		AG_ObjectDetach(com->panel);
		com->panel = NULL;
	}
}
Ejemplo n.º 3
0
static void
Destroy(void *p)
{
    AG_FileSelector *fs = p;

    if (fs ->panel != NULL) {
        AG_WindowHide(fs->panel);
        AG_ObjectDetach(fs->filedlg);
        AG_ObjectDetach(fs->panel);
    }
    AG_ObjectDestroy(fs->filedlg);
}
Ejemplo n.º 4
0
Archivo: ucombo.c Proyecto: adsr/agar
/* The UCombo must be locked. */
static void
Collapse(AG_UCombo *com)
{
	if (com->panel == NULL) {
		return;
	}
	com->wSaved = WIDTH(com->panel);
	com->hSaved = HEIGHT(com->panel);
	
	AG_ObjectDetach(com->list);
	AG_ObjectDetach(com->panel);
	com->panel = NULL;

	AG_SetInt(com->button, "state", 0);
}
Ejemplo n.º 5
0
static void
Collapse(AG_FileSelector *fs)
{
    if (fs->panel == NULL) {
        return;
    }
    fs->wSaved = WIDTH(fs->panel);
    fs->hSaved = HEIGHT(fs->panel);

    AG_WindowHide(fs->panel);
    AG_ObjectDetach(fs->filedlg);
    AG_ObjectDetach(fs->panel);
    fs->panel = NULL;

    AG_SetInt(fs->button, "state", 0);
}
Ejemplo n.º 6
0
Archivo: drv.c Proyecto: varialus/agar
/* Close and destroy a driver. */
void
AG_DriverClose(AG_Driver *drv)
{
	AG_ObjectDetach(drv);
	AGDRIVER_CLASS(drv)->close(drv);
	AG_ObjectDestroy(drv);
}
Ejemplo n.º 7
0
void XM7_DbgDumpMMRDetach(struct XM7_DbgMMRDump *dbg)
{
    if(dbg == NULL) return;
    if(dbg->draw != NULL) {
        AG_ObjectDetach(dbg->draw);
    }
    if(dbg->cons != NULL) delete dbg->cons;
    free(dbg);
}
Ejemplo n.º 8
0
void AGOL_About::OnOK(AG_Event *event)
{
	// Detach and destroy the window + contents
	AG_ObjectDetach(AboutDialog);

	// Call the close handler if one was set
	if(CloseEventHandler)
		CloseEventHandler->Trigger(event);
}
Ejemplo n.º 9
0
void AGOL_Settings::OnCancel(AG_Event *event)
{
	// Detach and destroy the window + contents
	AG_ObjectDetach(SettingsDialog);

	// Call the close handler if one was set
	if(CloseEventHandler)
		CloseEventHandler->Trigger(event);
}
Ejemplo n.º 10
0
void XM7_DbgDumpMemDetach(struct XM7_DbgDump *dbg)
{
    if(dbg == NULL) return;
    if(dbg->draw != NULL) {
        AG_ObjectDetach(dbg->draw);
    }
    if(dbg->buf != NULL) free(dbg->buf);
    if(dbg->dump != NULL) delete dbg->dump;
    free(dbg);
}
Ejemplo n.º 11
0
static void OnConfigApplyDisp(AG_Event *event)
{
        int ver;
	AG_Button *self = (AG_Button *)AG_SELF();
	struct gui_disp *cfg = (struct gui_disp *)AG_PTR(1);
	int i;

	LockVM();
	if(cfg != NULL){
	  configdat.nDrawFPS = cfg->nDrawFPS;
	  configdat.nEmuFPS = cfg->nEmuFPS;
	  configdat.nBrightness = cfg->nBrightness;
	  configdat.nRenderMethod = cfg->nRenderMethod;
	  configdat.uWidth = cfg->uWidth;
	  configdat.uHeight = cfg->uHeight;
	  configdat.bFullScan = cfg->bFullScan;
	  configdat.bFullScanFS = cfg->bFullScanFS;
	  configdat.bSmoosing = cfg->bSmoosing;
	  configdat.bUseSIMD = cfg->bUseSIMD; 
#ifdef _USE_OPENCL
	  configdat.bUseOpenCL = cfg->bUseOpenCL;
	  configdat.nCLGlobalWorkThreads = cfg->nCLGlobalWorkThreads;
	  configdat.bCLSparse = cfg->bCLSparse; 
	  configdat.nCLDeviceNum = cfg->nCLDeviceNum;
	  configdat.nCLPlatformNum = cfg->nCLPlatformNum;
	  configdat.bCLInteropGL = cfg->bCLInteropGL;
	  for(i = 0; i < 8; i++) {
	    if(cfg->sDeviceName[i] != NULL) free(cfg->sDeviceName[i]);
	  }
#endif
	  free(cfg);
	}
	ver = fm7_ver;
	ApplyCfg();
	/*
	 * VMヴァージョンが違ったら強制リセット
	 */
	if(ver != fm7_ver){
		system_reset();
	}
	/*
	 * ここにアイコン変更入れる
	 */

	/*
	 * 終了処理
	 */
	UnlockVM();

	if(self != NULL) {
	  AG_WindowHide(self->wid.window);
	  AG_ObjectDetach(self);
	}
}
Ejemplo n.º 12
0
static void OnConfigApplySound(AG_Event *event)
{
        int ver;
	AG_Button *self = (AG_Button *)AG_SELF();
	struct gui_sound *cfg = AG_PTR(1);


	LockVM();
	if(cfg != NULL){
	  configdat.iTotalVolume = cfg->iTotalVolume;
	  configdat.nFMVolume = cfg->nFMVolume;
	  configdat.nPSGVolume = cfg->nPSGVolume;
	  configdat.nBeepVolume = cfg->nBeepVolume;
	  configdat.nCMTVolume = cfg->nCMTVolume;
	  configdat.nWaveVolume = cfg->nWaveVolume;
	  configdat.uChSeparation = cfg->uChSeparation;
	  configdat.nSampleRate = cfg->nSampleRate;
	  configdat.nSoundBuffer = cfg->nSoundBuffer;
	  configdat.nBeepFreq = cfg->nBeepFreq;
	  configdat.bFMHQmode = cfg->bFMHQmode;
	  configdat.nStereoOut = cfg->nStereoOut;
	  configdat.bTapeMon = cfg->bTapeMon;
	  configdat.bOPNEnable = cfg->bOPNEnable;
	  configdat.bWHGEnable = cfg->bWHGEnable;
	  configdat.bTHGEnable = cfg->bTHGEnable;
#ifdef FDDSND
	  configdat.bFddSound = cfg->bFddSound;
#endif
	  free(cfg);
	}
	ver = fm7_ver;
	ApplyCfg();
	/*
	 * VMヴァージョンが違ったら強制リセット
	 */
	if(ver != fm7_ver){
		system_reset();
	}
	/*
	 * ここにアイコン変更入れる
	 */

	/*
	 * 終了処理
	 */
	UnlockVM();

	if(self != NULL) {
	  AG_WindowHide(self->wid.window);
	  AG_ObjectDetach(self);
	}


}
Ejemplo n.º 13
0
static void
SelectPathOK(AG_Event *event)
{
	char *key = AG_STRING(1);
	AG_Textbox *tbox = AG_PTR(2);
	AG_Window *win = AG_PTR(3);
	char *path = AG_STRING(4);
	
	AG_SetString(agConfig, key, path);
	AG_TextboxSetString(tbox, path);
	AG_ObjectDetach(win);
}
Ejemplo n.º 14
0
static void SetBootMode(AG_Event *event)
{
	AG_Button *self = (AG_Button *)AG_SELF();
	int DosMode = AG_INT(1);

	if(DosMode) {
		// DOSモード
		OnDos(event);
	} else {
		OnBasic(event);
	}
	AG_WindowHide(self->wid.window);
	AG_ObjectDetach(self->wid.window);
}
Ejemplo n.º 15
0
static void
SelectFont(AG_Event *event)
{
	VG_Text *vt = AG_PTR(1);
	AG_Window *win = AG_PTR(2);
	AG_FontSelector *fs = AG_PTR(3);

	Strlcpy(vt->fontFace, fs->curFace, sizeof(vt->fontFace));
	vt->fontSize = fs->curSize;
	vt->fontFlags = 0;
	if (fs->curStyle & AG_FONT_BOLD) { vt->fontFlags |= VG_TEXT_BOLD; }
	if (fs->curStyle & AG_FONT_ITALIC) { vt->fontFlags |= VG_TEXT_ITALIC; }

	AG_ObjectDetach(win);
}
Ejemplo n.º 16
0
void
AG_ButtonSurfaceNODUP(AG_Button *bu, AG_Surface *su)
{
	AG_ObjectLock(bu);
	if (bu->lbl != NULL) {
		AG_ObjectDetach(bu->lbl);
		AG_ObjectDestroy(bu->lbl);
		bu->lbl = NULL;
	}
	if (bu->surface != -1) {
		AG_WidgetReplaceSurfaceNODUP(bu, bu->surface, su);
	} else {
		bu->surface = AG_WidgetMapSurfaceNODUP(bu, su);
	}
	AG_ObjectUnlock(bu);
	AG_Redraw(bu);
}
Ejemplo n.º 17
0
/* Set the label text (format string). */
void
AG_BoxSetLabelS(AG_Box *box, const char *s)
{
	AG_ObjectLock(box);
	if (s != NULL) {
		if (box->lbl == NULL) {
			box->lbl = AG_LabelNewS(box, 0, s);
			AG_SetStyle(box->lbl, "font-size", "80%");
		} else {
			AG_LabelTextS(box->lbl, s);
		}
	} else {
		AG_ObjectDetach(box->lbl);
		AG_ObjectDestroy(box->lbl);
		box->lbl = NULL;
	}
	AG_Redraw(box);
	AG_ObjectUnlock(box);
}
Ejemplo n.º 18
0
void AGOL_Settings::OnOK(AG_Event *event)
{
	// Call all the save functions
	SaveServerOptions();
	SaveGuiOptions();
#ifndef GCONSOLE
	SaveOdamexPath();
#endif
	SaveWadDirs();
	SaveExtraParams();

	// Save the ag-odalaunch configuration settings
	GuiConfig::Save();

	// Detach and destroy the window + contents
	AG_ObjectDetach(SettingsDialog);

	// Call the close handler if one was set
	if(CloseEventHandler)
		CloseEventHandler->Trigger(event);
}
Ejemplo n.º 19
0
Archivo: textbox.c Proyecto: adsr/agar
/* Toggle word wrapping */
void
AG_TextboxSetWordWrap(AG_Textbox *tb, int flag)
{
	AG_EditableSetWordWrap(tb->ed, flag);

	if (tb->ed->flags & AG_EDITABLE_MULTILINE) {
		if (tb->hBar != NULL) {
			AG_ObjectDetach(tb->hBar);
			AG_ObjectDestroy(tb->hBar);
			tb->hBar = NULL;
		}
		if (!flag) {
			tb->hBar = AG_ScrollbarNew(tb, AG_SCROLLBAR_HORIZ,
			    AG_SCROLLBAR_AUTOHIDE);
			AG_BindInt(tb->hBar, "value", &tb->ed->x);
			AG_BindInt(tb->hBar, "max", &tb->ed->xMax);
			AG_BindInt(tb->hBar, "visible", &WIDTH(tb->ed));
			AG_SetEvent(tb->hBar, "scrollbar-drag-begin", BeginScrollbarDrag, "%p", tb);
			AG_SetEvent(tb->hBar, "scrollbar-drag-end", EndScrollbarDrag, "%p", tb);
			AG_TextboxSizeHintLines(tb, 4);
		}
	}
}
Ejemplo n.º 20
0
static int
SDLGL_Open(void *obj, const char *spec)
{
	extern const AG_TimeOps agTimeOps_SDL;
	AG_Driver *drv = obj;
	AG_DriverSDLGL *sgl = obj;
	
	if (nDrivers != 0) {
		AG_SetError("Multiple SDL displays are not supported");
		return (-1);
	}

	/* Initialize SDL's video subsystem. */
	if (!initedSDL) {
		if (SDL_Init(0) == -1) {
			AG_SetError("SDL_Init() failed: %s", SDL_GetError());
			return (-1);
		}
		initedSDL = 1;
	}
	if (!SDL_WasInit(SDL_INIT_VIDEO)) {
		if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
			AG_SetError("SDL_INIT_VIDEO failed: %s", SDL_GetError());
			return (-1);
		}
		initedSDLVideo = 1;
	}

	/* We can use SDL's time interface. */
	if (agTimeOps == &agTimeOps_dummy)
		AG_SetTimeOps(&agTimeOps_SDL);

	/* Initialize this driver instance. */
	if ((drv->mouse = AG_MouseNew(sgl, "SDL mouse")) == NULL ||
	    (drv->kbd = AG_KeyboardNew(sgl, "SDL keyboard")) == NULL) {
		goto fail;
	}
	sgl->outMode = AG_SDLGL_OUT_NONE;
	sgl->outPath = NULL;
	sgl->outFrame = 0;
	sgl->outLast = 0;
	sgl->outBuf = NULL;

	/* Configure the window caption */
	SDL_WM_SetCaption(agProgName, agProgName);

	nDrivers = 1;
	return (0);
fail:
	if (drv->kbd != NULL) {
		AG_ObjectDetach(drv->kbd);
		AG_ObjectDestroy(drv->kbd);
		drv->kbd = NULL;
	}
	if (drv->mouse != NULL) {
		AG_ObjectDetach(drv->mouse);
		AG_ObjectDestroy(drv->mouse);
		drv->mouse = NULL;
	}
	return (-1);
}