Esempio n. 1
0
static void FileMenu_BootMode(AG_Event *event)
{
	AG_Menu *self = (AG_Menu *)AG_SELF();
	AG_MenuItem *item = (AG_MenuItem *)AG_SENDER();
	AG_Window *w;
	AG_Button   *btn[3];
	AG_Box *box;
	AG_Box *box2;
	char *label;
	AG_Label *lbl;

	w = AG_WindowNew(AG_WINDOW_NOMINIMIZE | AG_WINDOW_NOMAXIMIZE | FILEDIALOG_WINDOW_DEFAULT);
	AG_WindowSetMinSize(w, 230, 80);
	label = gettext("Select mode (Notice: If select , reboot.)");
	AG_WindowSetMinSize(w, 230, 80);
	box = AG_BoxNewHorizNS(w, AG_BOX_HFILL);
	AG_WidgetSetSize(box, 230, 32);
	lbl = AG_LabelNew(AGWIDGET(box), AG_LABEL_EXPAND, "%s", label);
	box = AG_BoxNewVert(w, AG_BOX_HFILL);
	AG_WidgetSetSize(box, 230, 32);

	box2 = AG_BoxNewHoriz(box, 0);
	btn[0] = AG_ButtonNewFn (AGWIDGET(box2), 0, gettext("BASIC"), SetBootMode, "%i", FALSE);
	box2 = AG_BoxNewVert(box, 0);
	btn[1] = AG_ButtonNewFn (AGWIDGET(box2), 0, gettext("DOS"), SetBootMode, "%i", TRUE);
	box2 = AG_BoxNewVert(box, 0);
	btn[2] = AG_ButtonNewFn (AGWIDGET(box2), 0, gettext("Cancel"), OnPushCancel, NULL);
    AG_ActionFn(AGWIDGET(w), "window-close", OnPushCancel, NULL);
	AG_WindowSetCaption(w, gettext("Boot Mode"));
	AG_WindowShow(w);

}
Esempio n. 2
0
File: osd.c Progetto: FrMo/gravit
void osdInitIntroWindow() {
    AG_Window *w = osdNewWindow("Welcome to Gravit!");
    
    AG_Box *vBox = AG_BoxNewVert(w, 0);
    AG_Box *hBox = AG_BoxNewHoriz(w, 0);
    AG_Label *text;
    AG_BoxSetSpacing(vBox, 10);
    
    text = AG_LabelNew(vBox, 0, 0);
    AG_LabelText(text, "Gravit is a free, visually stunning gravity simulator, where you can spend endless\ntime experimenting with various configurations of simulated universes.\n\nQuick Start:\n\n - Click on RESPAWN to start a new simulation.\n - Click on PLAY to replay a recording\n - Click on RECORD to resume recording\n - Hold down a mouse button and move it around to change your perspective.\n - Use the A and Z keys, or the scroll wheel to zoom in and out.\n");
    AG_WidgetSetSize(text, 200, 100);
    
    // AG_Checkbox *showAgain = AG_CheckboxNew(vBox, AG_CHECKBOX_SET, "Show this window on startup");
    AG_ButtonNewFn(hBox, 0, "  OK  ", AG_WindowCloseGenEv, "%p", w);
    
    AG_WindowShow(w);
}
Esempio n. 3
0
void ResizeStatus(AG_Widget *parent, int w, int h, int h2)
{
    int i;
    int pos = 0;
    float ww = (float)w;
    int hh;

   if(parent == NULL) return;

   hh = (int)((float)h / 400.0f * (float)STAT_HEIGHT);
   if(h < 400) hh += 5.0f; // WORKAROUNDS 
   nFontSize = (int)((float)STAT_PT * ww / 800.0f);

   w = w - 5;
   AG_WidgetSetSize(parent, w, hh);
   ResizeStatOSD(parent, w, hh);
   ResizeVFD(parent, w, hh);
   ResizeTapeOSD(parent, w, hh);
   ResizeLeds(parent, w, hh);
   DrawStatusForce();
   AG_WidgetUpdate(parent);
}
Esempio n. 4
0
static void VolumeMenu(AG_NotebookTab *parent, struct gui_sound *cfg)
{
	AG_Slider *slider;
	AG_Box *box;
	AG_Box *vbox;
	AG_Label *lbl;

	lbl = AG_LabelNew(AGWIDGET(parent), 0, "%s", gettext("Main Volume"));
	slider = AG_SliderNewIntR(AGWIDGET(parent),AG_SLIDER_HORIZ, AG_SLIDER_HFILL, &(cfg->iTotalVolume), 0, 128);
	AG_SetEvent(AGOBJECT(slider), "slider-changed", OnChangeTotalVolume, "%p", cfg);

	box = AG_BoxNewHoriz(AGWIDGET(parent), AG_BOX_HFILL);
	AG_WidgetSetSize(AGWIDGET(box), 320, 12);
	lbl = AG_LabelNew(AGWIDGET(parent), 0, "%s", gettext("PSG"));
	slider = AG_SliderNewIntR(AGWIDGET(parent),AG_SLIDER_HORIZ, AG_SLIDER_HFILL, &(cfg->nPSGVolume), -40, 12);
	AG_SetEvent(AGOBJECT(slider), "slider-changed", OnChangeVolume, "%p", cfg);

	lbl = AG_LabelNew(AGWIDGET(parent), 0, "%s", gettext("FM"));
	slider = AG_SliderNewIntR(AGWIDGET(parent),AG_SLIDER_HORIZ, AG_SLIDER_HFILL, &(cfg->nFMVolume), -40, 12);
	AG_SetEvent(AGOBJECT(slider), "slider-changed", OnChangeVolume, "%p", cfg);

	lbl = AG_LabelNew(AGWIDGET(parent), 0, "%s", gettext("BEEP"));
	slider = AG_SliderNewIntR(AGWIDGET(parent),AG_SLIDER_HORIZ, AG_SLIDER_HFILL, &(cfg->nBeepVolume), -35, 12);
	AG_SetEvent(AGOBJECT(slider), "slider-changed", OnChangeVolume, "%p", cfg);

	lbl = AG_LabelNew(AGWIDGET(parent), 0, "%s", gettext("CMT"));
	slider = AG_SliderNewIntR(AGWIDGET(parent),AG_SLIDER_HORIZ, AG_SLIDER_HFILL, &(cfg->nCMTVolume), -35, 6);
	AG_SetEvent(AGOBJECT(slider), "slider-changed", OnChangeVolume, "%p", cfg);

	lbl = AG_LabelNew(AGWIDGET(parent), 0, "%s", gettext("SFX"));
	slider = AG_SliderNewIntR(AGWIDGET(parent),AG_SLIDER_HORIZ, AG_SLIDER_HFILL, &(cfg->nWaveVolume), -35, 12);
	AG_SetEvent(AGOBJECT(slider), "slider-changed", OnChangeVolume, "%p", cfg);

	lbl = AG_LabelNew(AGWIDGET(parent), 0, "%s", gettext("Channel Separation"));
	slider = AG_SliderNewUint32R(AGWIDGET(parent),AG_SLIDER_HORIZ, AG_SLIDER_HFILL, &(cfg->uChSeparation), 0, 16);
	AG_SetEvent(AGOBJECT(slider), "slider-changed", OnChangeVolume, "%p", cfg);

}
void OnConfigDisplayMenu(AG_Event *event)
{
	AG_MenuItem *self = (AG_MenuItem *)AG_SELF();
	AG_Window *win;
	AG_Notebook *note;
	AG_Notebook *note2;

	AG_NotebookTab *tab;
	AG_NotebookTab *tab2;
	AG_Box *box;
	AG_Button *btn;
        struct gui_disp *cfg;
	int i, num;
   
        cfg = (struct gui_disp *)malloc(sizeof(struct gui_disp));
        if(cfg == NULL) return;
	{
	  LockVM();
	  cfg->nDrawFPS = configdat.nDrawFPS;
	  cfg->nEmuFPS = configdat.nEmuFPS;
	  cfg->nBrightness = configdat.nBrightness;
	  cfg->nRenderMethod = configdat.nRenderMethod;
	  cfg->uWidth = configdat.uWidth;
	  cfg->uHeight = configdat.uHeight;
	  cfg->bFullScan = configdat.bFullScan;
	  cfg->bFullScanFS = configdat.bFullScanFS;
	  cfg->bSmoosing = configdat.bSmoosing;
	  cfg->bUseSIMD = configdat.bUseSIMD; 
#ifdef _USE_OPENCL
	  cfg->bUseOpenCL = configdat.bUseOpenCL;
	  cfg->nCLGlobalWorkThreads = configdat.nCLGlobalWorkThreads;
	  cfg->bCLSparse = configdat.bCLSparse;
	  cfg->nCLDeviceNum = configdat.nCLDeviceNum;
	  cfg->nCLPlatformNum = configdat.nCLPlatformNum;
	  cfg->bCLInteropGL = configdat.bCLInteropGL;
	  for(i = 0; i <= 8; i++) cfg->sDeviceName[i] = NULL;
	  if(cldraw == NULL) {
	    num = 8;
	  } else {
	    num = cldraw->GetDevices();
	  }
	  if(num >= 8) num = 8;
	  if(num <= 0) num = 0;
	  for(i = 0; i < num; i++) {
	    cfg->sDeviceName[i] = malloc(96 * sizeof(char));
	    cfg->sDeviceName[i][0] = '\0';
	    if(cldraw == NULL) {
	      snprintf(cfg->sDeviceName[i], 94, "Processor #%d", i);
	    } else {
	      char sName[64];
	      char sType[16];
	      cldraw->GetDeviceName(sName, 64, i);
	      cldraw->GetDeviceType(sType, 16, i);
	      snprintf(cfg->sDeviceName[i], 94, "%s(%s)", sType, sName);
	    }
	  }
	  cfg->sDeviceName[8] = NULL;
#endif
	  UnlockVM();
	}

	win= AG_WindowNew(DIALOG_WINDOW_DEFAULT);
        note = AG_NotebookNew(AGWIDGET(win), AG_NOTEBOOK_HFILL);

        {
    	tab = AG_NotebookAddTab(note, gettext("Screen"), AG_BOX_HORIZ);
    	OnConfigMenuScreen(cfg, tab);
#ifdef USE_OPENGL
    	tab = AG_NotebookAddTab(note, gettext("Display"), AG_BOX_HORIZ);
    	ConfigMenuBright(cfg, tab);
#endif /* USE_OPENGL */

#ifdef _USE_OPENCL
    	tab = AG_NotebookAddTab(note, gettext("OpenCL"), AG_BOX_HORIZ);
    	ConfigMenuOpenCL(cfg, tab);
#endif /* USE_OPENGL */
    }
    box = AG_BoxNewHoriz(AGWIDGET(win), AG_BOX_HFILL);
    AG_WidgetSetSize(AGWIDGET(box), 320, 24);
    {
    	AG_Box *vbox;
        vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL);
    	btn = AG_ButtonNewFn(AGWIDGET(box), 0, gettext("OK"), OnConfigApplyDisp, "%p", cfg);
        vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL);
        AG_WidgetSetSize(AGWIDGET(vbox), 80, 24);
        vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL);
    	btn = AG_ButtonNewFn(AGWIDGET(box), 0, gettext("Cancel"), OnPushCancel2, "%p", cfg);
    }
    AG_SetEvent(win, "window-close", OnPushCancel2, "%p", cfg);
    AG_WindowSetCaption(win, gettext("Display"));
    AG_WindowShow(win);
}
Esempio n. 6
0
void OnConfigSoundMenu(AG_Event *event)
{
	AG_MenuItem *self = (AG_MenuItem *)AG_SELF();
	AG_Window *win;
	AG_Notebook *note;
	AG_Notebook *note2;

	AG_NotebookTab *tab;
	AG_NotebookTab *tab2;
	AG_Box *box;
	AG_Button *btn;
	struct gui_sound *cfg;
	
	cfg = malloc(sizeof(struct gui_sound));
	if(cfg == NULL) return;
	{
	  cfg->iTotalVolume = configdat.iTotalVolume;
	  cfg->nFMVolume = configdat.nFMVolume;
	  cfg->nPSGVolume = configdat.nPSGVolume;
	  cfg->nBeepVolume = configdat.nBeepVolume;
	  cfg->nCMTVolume = configdat.nCMTVolume;
	  cfg->nWaveVolume = configdat.nWaveVolume;
	  cfg->uChSeparation = configdat.uChSeparation;
	  cfg->nSampleRate = configdat.nSampleRate;
	  cfg->nSoundBuffer = configdat.nSoundBuffer;
	  cfg->nBeepFreq = configdat.nBeepFreq;
	  cfg->bFMHQmode = configdat.bFMHQmode;
	  cfg->nStereoOut = configdat.nStereoOut;
	  cfg->bTapeMon = configdat.bTapeMon;
	  cfg->bOPNEnable = configdat.bOPNEnable;
	  cfg->bWHGEnable = configdat.bWHGEnable;
	  cfg->bTHGEnable = configdat.bTHGEnable;
#ifdef FDDSND
	  cfg->bFddSound = configdat.bFddSound;
#endif
	}

	win= AG_WindowNew(DIALOG_WINDOW_DEFAULT);

	note = AG_NotebookNew(AGWIDGET(win), AG_NOTEBOOK_HFILL);
	{
	  tab = AG_NotebookAddTab(note, gettext("Volume"), AG_BOX_VERT);
	  VolumeMenu(tab, cfg);
	  tab = AG_NotebookAddTab(note, gettext("Rendering"), AG_BOX_HORIZ);
	  SoundMenu(tab, cfg);
	  tab = AG_NotebookAddTab(note, gettext("Misc"), AG_BOX_HORIZ);
	  SoundMenu2(tab, cfg);
	}
	box = AG_BoxNewHoriz(AGWIDGET(win), AG_BOX_HFILL);
	AG_WidgetSetSize(AGWIDGET(box), 320, 24);
	{
	  AG_Box *vbox;
	  vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL);
	  btn = AG_ButtonNewFn(AGWIDGET(box), 0, gettext("OK"), OnConfigApplySound, "%p", cfg);
	  vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL);
	  AG_WidgetSetSize(AGWIDGET(vbox), 80, 24);
	  vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL);
	  btn = AG_ButtonNewFn(AGWIDGET(box), 0, gettext("Cancel"), OnPushCancel2, "%p", cfg);
	}
	AG_SetEvent(win, "window-close", OnPushCancel2, "%p", cfg);
	AG_WindowSetCaption(win, gettext("Sound Preferences"));
	AG_WindowShow(win);
}