#include "set.h"
#include "text.h"
#include "tilt.h"
-#include "syswm.h"
#include "st_conf.h"
#include "st_title.h"
audio_init();
tilt_init();
- /* Require 16-bit double buffer with 16-bit depth buffer. */
-
- SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
- SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
- SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
-
- /* This has to happen before mode setting... */
-
- set_SDL_icon("icon/neverball.png");
-
/* Initialize the video. */
- if (!video_mode(config_get_d(CONFIG_FULLSCREEN),
- config_get_d(CONFIG_WIDTH), config_get_d(CONFIG_HEIGHT)))
- {
- fprintf(stderr, "%s\n", SDL_GetError());
+ if (!video_init(TITLE, "icon/neverball.png"))
return 1;
- }
-
- /* ...and this has to happen after it. */
-
- set_EWMH_icon("icon/neverball.png");
-
- SDL_WM_SetCaption(TITLE, TITLE);
init_state(&st_null);
#include "game.h"
#include "gui.h"
#include "text.h"
-#include "syswm.h"
#include "st_conf.h"
#include "st_all.h"
audio_init();
- /* Require 16-bit double buffer with 16-bit depth buffer. */
-
- SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
- SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
- SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
-
- /* This has to happen before mode setting... */
-
- set_SDL_icon("icon/neverputt.png");
-
/* Initialize the video. */
- if (video_mode(config_get_d(CONFIG_FULLSCREEN),
- config_get_d(CONFIG_WIDTH),
- config_get_d(CONFIG_HEIGHT)))
+ if (video_init(TITLE, "icon/neverputt.png"))
{
int t1, t0 = SDL_GetTicks();
- /* ... and this has to happen after it. */
-
- set_EWMH_icon("icon/neverputt.png");
-
- SDL_WM_SetCaption(TITLE, TITLE);
-
/* Run the main game loop. */
init_state(&st_null);
SDL_Delay(1);
}
}
- else fprintf(stderr, "%s: %s\n", argv[0], SDL_GetError());
/* Restore Neverball's camera setting. */
#include "vec3.h"
#include "glext.h"
#include "config.h"
+#include "syswm.h"
+
+/*---------------------------------------------------------------------------*/
+
+int video_init(const char *title, const char *icon)
+{
+ /* Require 16-bit double buffer with 16-bit depth buffer. */
+
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+
+ /* This has to happen before mode setting... */
+
+ set_SDL_icon(icon);
+
+ /* Initialize the video. */
+
+ if (!video_mode(config_get_d(CONFIG_FULLSCREEN),
+ config_get_d(CONFIG_WIDTH), config_get_d(CONFIG_HEIGHT)))
+ {
+ fprintf(stderr, "%s\n", SDL_GetError());
+ return 0;
+ }
+
+ /* ...and this has to happen after it. */
+
+ set_EWMH_icon(icon);
+
+ SDL_WM_SetCaption(title, title);
+
+ return 1;
+}
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
+int video_init(const char *, const char *);
+
+/*---------------------------------------------------------------------------*/
+
int video_mode(int, int, int);
int video_perf(void);