Esempio n. 1
0
File: options.c Progetto: s0be/naev
/**
 * @brief Sets the default gameplay options.
 */
static void opt_gameplayDefaults( unsigned int wid, char *str )
{
   (void) str;

   /* Ask user. */
   if (!dialogue_YesNoRaw( "Restore Defaults", "Are you sure you want to restore default gameplay settings?" ))
      return;

   /* Restore. */
   conf_setGameplayDefaults();
   opt_gameplayUpdate( wid, NULL );

   /* Alert user it worked. */
   dialogue_msgRaw( "Defaults Restored", "Gameplay settings restored to defaults.");
}
Esempio n. 2
0
File: options.c Progetto: s0be/naev
/**
 * @brief Opens the gameplay menu.
 */
static void opt_gameplay( unsigned int wid )
{
   (void) wid;
   char buf[PATH_MAX];
   const char *path;
   int cw;
   int w, h, y, x, by, l;
   char *s;

   /* Get size. */
   window_dimWindow( wid, &w, &h );

   /* Close button */
   window_addButton( wid, -20, 20,
         BUTTON_WIDTH, BUTTON_HEIGHT,
         "btnClose", "Close", opt_close );
   window_addButton( wid, -20 - 1*(BUTTON_WIDTH+20), 20,
         BUTTON_WIDTH, BUTTON_HEIGHT,
         "btnApply", "Apply", opt_gameplaySave );
   window_addButton( wid, -20 - 2*(BUTTON_WIDTH+20), 20,
         BUTTON_WIDTH, BUTTON_HEIGHT,
         "btnDefaults", "Defaults", opt_gameplayDefaults );

   /* Information. */
   cw = (w-40);
   x = 20;
   y = -60;
   window_addText( wid, x, y, cw, 20, 1, "txtVersion",
         NULL, NULL, naev_version(1) );
   y -= 20;
#ifdef GIT_COMMIT
   window_addText( wid, x, y, cw, 20, 1, "txtCommit",
         NULL, NULL, "Commit: "GIT_COMMIT );
#endif /* GIT_COMMIT */
   y -= 20;
   path = ndata_getPath();
   if (path == NULL)
      snprintf( buf, sizeof(buf), "not using ndata" );
   else
      snprintf( buf, sizeof(buf), "ndata: %s", path);
   window_addText( wid, x, y, cw, 20, 1, "txtNdata",
         NULL, NULL, buf );
   y -= 40;
   by = y;


   /* Compiletime stuff. */
   cw = (w-60)/2;
   y  = by;
   x  = 20;
   window_addText( wid, x+20, y, cw, 20, 0, "txtCompile",
         NULL, &cDConsole, "Compilation Flags" );
   y -= 30;
   window_addText( wid, x, y, cw, h+y-20, 0, "txtFlags",
         NULL, NULL,
         ""
#ifdef DEBUGGING
#ifdef DEBUG_PARANOID
         "Debug Paranoid\n"
#else /* DEBUG_PARANOID */
         "Debug\n"
#endif /* DEBUG_PARANOID */
#endif /* DEBUGGING */
#if defined(LINUX)
         "Linux\n"
#elif defined(FREEBSD)
         "FreeBSD\n"
#elif defined(MACOSX)
         "Mac OS X\n"
#elif defined(WIN32)
         "Windows\n"
#else
         "Unknown OS\n"
#endif
#ifdef USE_OPENAL
         "With OpenAL\n"
#endif /* USE_OPENAL */
#ifdef USE_SDLMIX
         "With SDL_mixer\n"
#endif
#ifdef HAVE_LUAJIT
         "Using Lua JIT\n"
#endif
#ifdef NDATA_DEF
         "ndata: "NDATA_DEF"\n"
#endif /* NDATA_DEF */
#ifdef PREFSDIR_DEF
         "preference directory: "PREFSDIR_DEF"\n"
#endif /* PREFSDIR_DEF */
         );


   /* Options. */
   y  = by;
   x += cw;

   /* Autonav abort. */
   x = 20 + cw + 20;
   window_addText( wid, x+65, y, 150, 150, 0, "txtAAutonav",
         NULL, &cDConsole, "Abort Autonav At:" );
   y -= 20;

   /* Autonav abort fader. */
   opt_getAutonavAbortStr( buf, sizeof(buf) );
   window_addText( wid, x, y, cw, 20, 1, "txtAutonav",
         NULL, NULL, buf );
   y -= 20;
   window_addFader( wid, x, y, cw, 20, "fadAutonav", 0., 1.,
         conf.autonav_abort, opt_setAutonavAbort );
   y -= 40;

   window_addText( wid, x+20, y, cw, 20, 0, "txtSettings",
         NULL, &cDConsole, "Settings" );
   y -= 25;
   window_addCheckbox( wid, x, y, cw, 20,
         "chkZoomManual", "Enable manual zoom control", NULL, conf.zoom_manual );
   y -= 25;
   window_addCheckbox( wid, x, y, cw, 20,
         "chkAfterburn", "Enable double-tap afterburn", NULL, conf.afterburn_sens );
   y -= 25;
   window_addCheckbox( wid, x, y, cw, 20,
         "chkMouseThrust", "Enable mouse-flying thrust control", NULL, conf.mouse_thrust );
   y -= 25;
   window_addCheckbox( wid, x, y, cw, 20,
         "chkCompress", "Enable savegame compression", NULL, conf.save_compress );
   y -= 30;
   s = "Visible Messages";
   l = gl_printWidthRaw( NULL, s );
   window_addText( wid, -100, y, l, 20, 1, "txtSMSG",
         NULL, &cBlack, s );
   window_addInput( wid, -50, y, 40, 20, "inpMSG", 4, 1, NULL );
   y -= 30;
   s = "Max Time Compression Factor";
   l = gl_printWidthRaw( NULL, s );
   window_addText( wid, -100, y, l, 20, 1, "txtTMax",
         NULL, &cBlack, s );
   window_addInput( wid, -50, y, 40, 20, "inpTMax", 4, 1, NULL );
   y -= 30;

   /* Restart text. */
   window_addText( wid, 20, 10, 3*(BUTTON_WIDTH + 20),
         30, 0, "txtRestart", &gl_smallFont, &cBlack, NULL );

   /* Update. */
   opt_gameplayUpdate( wid, NULL );
}
Esempio n. 3
0
File: options.c Progetto: isfos/naev
/**
 * @brief Opens the gameplay menu.
 */
static void opt_gameplay( unsigned int wid )
{
    (void) wid;
    char buf[PATH_MAX];
    const char *path;
    int cw;
    int w, h, y, x, by, l;
    char *s;

    /* Get size. */
    window_dimWindow( wid, &w, &h );

    /* Close button */
    window_addButton( wid, -20, 20,
                      BUTTON_WIDTH, BUTTON_HEIGHT,
                      "btnClose", "Close", opt_close );
    window_addButton( wid, -20 - 1*(BUTTON_WIDTH+20), 20,
                      BUTTON_WIDTH, BUTTON_HEIGHT,
                      "btnApply", "Apply", opt_gameplaySave );
    window_addButton( wid, -20 - 2*(BUTTON_WIDTH+20), 20,
                      BUTTON_WIDTH, BUTTON_HEIGHT,
                      "btnDefaults", "Defaults", opt_gameplayDefaults );

    /* Information. */
    cw = (w-40);
    x = 20;
    y = -60;
    window_addText( wid, x, y, cw, 20, 1, "txtVersion",
                    NULL, NULL, naev_version(1) );
    y -= 20;
#ifdef GIT_COMMIT
    window_addText( wid, x, y, cw, 20, 1, "txtCommit",
                    NULL, NULL, "Commit: "GIT_COMMIT );
#endif /* GIT_COMMIT */
    y -= 20;
    path = ndata_getPath();
    if (path == NULL)
        snprintf( buf, sizeof(buf), "not using ndata" );
    else
        snprintf( buf, sizeof(buf), "ndata: %s", path);
    window_addText( wid, x, y, cw, 20, 1, "txtNdata",
                    NULL, NULL, buf );
    y -= 50;
    by = y;


    /* Compiletime stuff. */
    cw = (w-60)/2;
    y  = by;
    x  = 20;
    window_addText( wid, x+20, y, cw, 20, 0, "txtCompile",
                    NULL, &cDConsole, "Compilation Flags" );
    y -= 30;
    window_addText( wid, x, y, cw, h+y-20, 0, "txtFlags",
                    NULL, NULL,
                    ""
#ifdef DEBUGGING
#ifdef DEBUG_PARANOID
                    "Debug Paranoid\n"
#else /* DEBUG_PARANOID */
                    "Debug\n"
#endif /* DEBUG_PARANOID */
#endif /* DEBUGGING */
#if defined(LINUX)
                    "Linux\n"
#elif defined(FREEBSD)
                    "FreeBSD\n"
#elif defined(MACOSX)
                    "Mac OS X\n"
#elif defined(WIN32)
                    "Windows\n"
#else
                    "Unknown OS\n"
#endif
#ifdef USE_OPENAL
                    "With OpenAL\n"
#endif /* USE_OPENAL */
#ifdef USE_SDLMIX
                    "With SDL_mixer\n"
#endif
#ifdef NDATA_DEF
                    "ndata: "NDATA_DEF"\n"
#endif /* NDATA_DEF */
                  );


    /* Options. */
    y  = by;
    x += cw;
    window_addText( wid, x+20, y, cw, 20, 0, "txtSettings",
                    NULL, &cDConsole, "Settings" );
    y -= 30;
    window_addCheckbox( wid, x, y, cw, 20,
                        "chkAfterburn", "Enable doubletap afterburn", NULL, conf.afterburn_sens );
    y -= 20;
    window_addCheckbox( wid, x, y, cw, 20,
                        "chkCompress", "Enable savegame compression", NULL, conf.save_compress );
    y -= 50;
    s = "Visible messages";
    l = gl_printWidthRaw( NULL, s );
    window_addText( wid, x, y, l, 20, 1, "txtSMSG",
                    NULL, &cBlack, s );
    window_addInput( wid, x+l+20, y, 40, 20, "inpMSG", 4, 1 );
    y -= 20;

    /* Restart text. */
    window_addText( wid, -20, 20+BUTTON_HEIGHT+20, 3*(BUTTON_WIDTH + 20),
                    30, 1, "txtRestart", &gl_smallFont, &cBlack, NULL );

    /* Update. */
    opt_gameplayUpdate( wid, NULL );
}