예제 #1
0
int main()
{
    SDL_version compiled;
    SDL_version linked;

    SDL_VERSION(&compiled);
    SDL_GetVersion(&linked);
    printf("We compiled against SDL version %d.%d.%d ...\n",
           compiled.major, compiled.minor, compiled.patch);
    printf("But we are linking against SDL version %d.%d.%d.\n",
           linked.major, linked.minor, linked.patch);

    SDL_Init(SDL_INIT_VIDEO);
    SDL_Window * window = SDL_CreateWindow("cppHero!", 0, 0, 640, 480, SDL_WINDOW_RESIZABLE);
    SDL_Renderer * renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
    SDL_Event event;
    printf("Game Initialized!\n");
    fflush(stdout);
    
    while (1)
    {
        SDL_PollEvent(&event);
        
        if (event.type == SDL_QUIT)
        {
            printf("Quitting.\n");
            break;
        }
    }
    
    return 0;
}
예제 #2
0
int
main(int argc, char *argv[])
{
    SDL_version compiled;
    SDL_version linked;

	/* Enable standard application logging */
    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

#if SDL_VERSION_ATLEAST(2, 0, 0)
    SDL_Log("Compiled with SDL 2.0 or newer\n");
#else
    SDL_Log("Compiled with SDL older than 2.0\n");
#endif
    SDL_VERSION(&compiled);
    SDL_Log("Compiled version: %d.%d.%d.%d (%s)\n",
           compiled.major, compiled.minor, compiled.patch,
           SDL_REVISION_NUMBER, SDL_REVISION);
    SDL_GetVersion(&linked);
    SDL_Log("Linked version: %d.%d.%d.%d (%s)\n",
           linked.major, linked.minor, linked.patch,
           SDL_GetRevisionNumber(), SDL_GetRevision());
    SDL_Quit();
    return (0);
}
예제 #3
0
int main(int argc, char *argv[]) {
    SDL_version compiled;
    SDL_version linked;

    SDL_VERSION(&compiled);
    SDL_GetVersion(&linked);

    if (compiled.major != linked.major) {
        fprintf(stderr, "Compiled major '%u' != linked major '%u'",
                compiled.major, linked.major);
        return -1;
    }

    if (compiled.minor != linked.minor) {
        fprintf(stderr, "Compiled minor '%u' != linked minor '%u'",
                compiled.minor, linked.minor);
        return -2;
    }
#if 0
    /* Disabled because sometimes this is 'micro' and sometimes 'patch' */
    if (compiled.micro != linked.micro) {
        fprintf(stderr, "Compiled micro '%u' != linked micro '%u'",
                compiled.micro, linked.micro);
        return -3;
    }
#endif
    return 0;
}
예제 #4
0
/**
 * @brief This routine is responsible for initializing the OS specific portions of OpenGL
 * @param[in,out] glConfig
 * @param[in] context
 */
void GLimp_Init(glconfig_t *glConfig, windowContext_t *context)
{
	SDL_version compiled;
	SDL_version linked;

	SDL_VERSION(&compiled);
	SDL_GetVersion(&linked);

	Com_Printf("SDL build version %d.%d.%d - link version %d.%d.%d.\n", compiled.major, compiled.minor, compiled.patch, linked.major, linked.minor, linked.patch);

	GLimp_InitCvars();

	if (Cvar_VariableIntegerValue("com_abnormalExit"))
	{
		Cvar_Set("r_mode", va("%d", R_MODE_FALLBACK));
		Cvar_Set("r_fullscreen", "0");
		Cvar_Set("r_centerWindow", "0");
		Cvar_Set("com_abnormalExit", "0");
	}

	Sys_GLimpInit();

	// Create the window and set up the context
	if (GLimp_StartDriverAndSetMode(glConfig, r_mode->integer, (qboolean) !!r_fullscreen->integer, (qboolean) !!r_noBorder->integer, context))
	{
		goto success;
	}

	// Try again, this time in a platform specific "safe mode"
	Sys_GLimpSafeInit();

	if (GLimp_StartDriverAndSetMode(glConfig, r_mode->integer, (qboolean) !!r_fullscreen->integer, qfalse, context))
	{
		goto success;
	}

	// Finally, try the default screen resolution
	if (r_mode->integer != R_MODE_FALLBACK)
	{
		Com_Printf("Setting r_mode %d failed, falling back on r_mode %d\n", r_mode->integer, R_MODE_FALLBACK);
		if (GLimp_StartDriverAndSetMode(glConfig, R_MODE_FALLBACK, qfalse, qfalse, context))
		{
			goto success;
		}
	}

	// Nothing worked, give up
	Com_Error(ERR_VID_FATAL, "GLimp_Init() - could not load OpenGL subsystem\n");

success:
	// Only using SDL_SetWindowBrightness to determine if hardware gamma is supported
	glConfig->deviceSupportsGamma = !r_ignorehwgamma->integer && SDL_SetWindowBrightness(main_window, 1.0f) >= 0;

	re.InitOpenGL();

	Cvar_Get("r_availableModes", "", CVAR_ROM);

	// This depends on SDL_INIT_VIDEO, hence having it here
	IN_Init();
}
예제 #5
0
파일: sdl.cpp 프로젝트: RenaKunisaki/fceux
static void ShowUsage(char *prog)
{
	printf("\nUsage is as follows:\n%s <options> filename\n\n",prog);
	puts(DriverUsage);
#ifdef _S9XLUA_H
	puts ("--loadlua      f       Loads lua script from filename f.");
#endif
#ifdef CREATE_AVI
	puts ("--videolog     c       Calls mencoder to grab the video and audio streams to\n                         encode them. Check the documentation for more on this.");
	puts ("--mute        {0|1}    Mutes FCEUX while still passing the audio stream to\n                         mencoder during avi creation.");
#endif
	puts("");
	printf("Compiled with SDL version %d.%d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL );
#if SDL_VERSION_ATLEAST(2, 0, 0)
	SDL_version* v; 
	SDL_GetVersion(v);
#else
	const SDL_version* v = SDL_Linked_Version();
#endif
	printf("Linked with SDL version %d.%d.%d\n", v->major, v->minor, v->patch);
#ifdef GTK
	printf("Compiled with GTK version %d.%d.%d\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION );
	//printf("Linked with GTK version %d.%d.%d\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION );
#endif
	
}
예제 #6
0
	void  GetEngineVersion(VerInfo& verInfo)
	{
		verInfo.major = VER_MAJOR;
		verInfo.minor = VER_MINOR;
		strcpy(verInfo.tag, BUILD_DATE);
		SDL_GetVersion(&verInfo.sdl_ver);
	}
예제 #7
0
const char *vid_version(void)
{
    static char SDLVersion[80];
    SDL_version compiled, running;

#if SDL_MAJOR_VERSION == 1
    const SDL_version *ver = SDL_Linked_Version();
    running.major = ver->major;
    running.minor = ver->minor;
    running.patch = ver->patch;
#else
    SDL_GetVersion(&running);
#endif
    SDL_VERSION(&compiled);

    if ((compiled.major == running.major) &&
            (compiled.minor == running.minor) &&
            (compiled.patch == running.patch))
        sprintf(SDLVersion, "SDL Version %d.%d.%d",
                compiled.major, compiled.minor, compiled.patch);
    else
        sprintf(SDLVersion, "SDL Version (Compiled: %d.%d.%d, Runtime: %d.%d.%d)",
                compiled.major, compiled.minor, compiled.patch,
                running.major, running.minor, running.patch);
    return (const char *)SDLVersion;
}
aboutDialog::aboutDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::aboutDialog)
{
    ui->setupUi(this);

    #ifdef Q_OS_MAC
    this->setWindowIcon(QIcon(":/cat_builder.icns"));
    #endif
    #ifdef Q_OS_WIN
    this->setWindowIcon(QIcon(":/cat_builder.ico"));

    if(QSysInfo::WindowsVersion>=QSysInfo::WV_VISTA)
    {
        if(QtWin::isCompositionEnabled())
        {
            this->setAttribute(Qt::WA_TranslucentBackground, true);
            QtWin::extendFrameIntoClientArea(this, -1,-1,-1, -1);
            QtWin::enableBlurBehindWindow(this);
        }
        else
        {
            QtWin::resetExtendedFrame(this);
            setAttribute(Qt::WA_TranslucentBackground, false);
        }
    }
    #endif

    SDL_version sdlVer;
    SDL_GetVersion(&sdlVer);
    const SDL_version *mixerXVer = Mix_Linked_Version();

    ui->About1->setText(ui->About1->text()
                        .arg(V_FILE_VERSION)
                        .arg(V_FILE_RELEASE)
                        .arg(FILE_CPU)
                        .arg(QString("<b>Revision:</b> %1-%2, <b>Build date:</b> <u>%3</u><br/>"
                                     "<b>Qt:</b> %4, <b>SDL2:</b> %5.%6.%7, <b>SDL Mixer X:</b> %8.%9.%10")
                             .arg(V_BUILD_VER)
                             .arg(V_BUILD_BRANCH)
                             .arg(V_DATE_OF_BUILD)
                             .arg(qVersion())
                             .arg(sdlVer.major).arg(sdlVer.minor).arg(sdlVer.patch)
                             .arg(mixerXVer->major).arg(mixerXVer->minor).arg(mixerXVer->patch)
                             )
                        );

    QFile mFile(":/credits.html");
    if(!mFile.open(QFile::ReadOnly | QFile::Text)){
        return;
    }

    QTextStream in(&mFile);
    in.setCodec("UTF-8");
    QString mText = in.readAll();
    ui->About2->setText(mText);
    mFile.close();
}
예제 #9
0
bool initPeripherals(void) {
	// Init SDL
	if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) != 0) {
		printf("[FATAL]SDL could not initialize. SDL: %s\n", SDL_GetError());
		return true;
	}
	SDL_version v;
	SDL_GetVersion(&v);
	printf("[INFO]SDL version %d.%d.%d\n", v.major, v.minor, v.patch);

	// Init window
	wndWidth = 480;
	wndHeight = 360;
	wnd = SDL_CreateWindow("Unofficial Scratch Project Player", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, wndWidth, wndHeight, SDL_WINDOW_SHOWN|SDL_WINDOW_RESIZABLE);
	if(wnd == NULL) {
		printf("[FATAL]SDL could not create new window. SDL: %s\n", SDL_GetError());
		return true;
	}

	// Init OpenGL
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG);
	//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
	//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
	
	gl = SDL_GL_CreateContext(wnd);
	if(gl == NULL) {
		printf("[FATAL]SDL could not create an OpenGL context. SDL: %s\n", SDL_GetError());
		return true;
	}

	if(SDL_GL_SetSwapInterval(-1) != 0) {
		printf("[NOTE]SDL could not enable late swap tearing. Trying vsync instead. SDL: %s\n", SDL_GetError());
		if(SDL_GL_SetSwapInterval(1) != 0)
			printf("[WARNING]SDL could not enable vsync: %s\n", SDL_GetError());
	}

	glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
	SDL_GL_SwapWindow(wnd);

	// finish setting OpenGL options
	//glEnable(GL_MULTISAMPLE);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	wndID = SDL_GetWindowID(wnd);
	hasFocus = true; hasMouse = true; windowIsShowing = true;
	shouldQuit = false;

	printf("[INFO]OpenGL: version %s ; glsl version %s ; vendor %s ; renderer %s\n", glGetString(GL_VERSION), glGetString(GL_SHADING_LANGUAGE_VERSION), glGetString(GL_VENDOR), glGetString(GL_RENDERER));

	initGraphics();
	//initAudio();

	return false;
}
예제 #10
0
bool SDL2Window::initializeFramework() {
	
	arx_assert(s_mainWindow == NULL, "SDL only supports one window"); // TODO it supports multiple windows now!
	arx_assert(m_displayModes.empty());
	
	const char * headerVersion = ARX_STR(SDL_MAJOR_VERSION) "." ARX_STR(SDL_MINOR_VERSION)
	                             "." ARX_STR(SDL_PATCHLEVEL);
	CrashHandler::setVariable("SDL version (headers)", headerVersion);
	
	if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) < 0) {
		LogError << "Failed to initialize SDL: " << SDL_GetError();
		return false;
	}
	
	#ifdef ARX_DEBUG
	// No SDL, this is more annoying than helpful!
	#if defined(SIGINT)
	signal(SIGINT, SIG_DFL);
	#endif
	#if defined(SIGTERM)
	signal(SIGTERM, SIG_DFL);
	#endif
	#endif
	
	SDL_version ver;
	SDL_GetVersion(&ver);
	std::ostringstream runtimeVersion;
	runtimeVersion << int(ver.major) << '.' << int(ver.minor) << '.' << int(ver.patch);
	CrashHandler::setVariable("SDL version (runtime)", runtimeVersion.str());
	LogInfo << "Using SDL " << runtimeVersion.str();
	
	int ndisplays = SDL_GetNumVideoDisplays();
	for(int display = 0; display < ndisplays; display++) {
		int modes = SDL_GetNumDisplayModes(display);
		for(int i = 0; i < modes; i++) {
			SDL_DisplayMode mode;
			if(SDL_GetDisplayMode(display, i, &mode) >= 0) {
				m_displayModes.push_back(Vec2i(mode.w, mode.h));
			}
		}
	}
	
	std::sort(m_displayModes.begin(), m_displayModes.end());
	m_displayModes.erase(std::unique(m_displayModes.begin(), m_displayModes.end()),
	                     m_displayModes.end());
	
	s_mainWindow = this;
	
	SDL_SetEventFilter(eventFilter, NULL);
	
	SDL_EventState(SDL_WINDOWEVENT, SDL_ENABLE);
	SDL_EventState(SDL_QUIT,        SDL_ENABLE);
	SDL_EventState(SDL_SYSWMEVENT,  SDL_IGNORE);
	SDL_EventState(SDL_USEREVENT,   SDL_IGNORE);
	
	return true;
}
예제 #11
0
void init(){
	if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {std::cout << SDL_GetError() << std::endl;}
	if (IMG_Init(IMG_INIT_PNG) != 0) {std::cout << SDL_GetError() << std::endl;}
	std::cout << "JE: Initiated Engine." << std::endl;
	SDL_version ver;
	SDL_GetVersion(&ver);
	std::cout << "JE: Using SDL version " << (int)ver.major << "." <<
		(int)ver.minor << "." << (int)ver.patch << std::endl;
	
	srand(time(nullptr));
}
예제 #12
0
	void Application::setup(Int32 argc, char** argv)
	{
		srand((unsigned)time(nullptr));

		if (SDL_Init(SDL_INIT_VIDEO) != 0)
		{
			D6_THROW(VideoException, Format("Unable to set graphics mode: {0}") << SDL_GetError());
		}
		if (TTF_Init() != 0)
		{
			D6_THROW(FontException, Format("Unable to initialize font subsystem: {0}") << TTF_GetError());
		}

		// Print application info
		SDL_version sdlVersion;
		console.printLine("\n===Application information===");
		console.printLine(Format("{0} version: {1}") << APP_NAME << APP_VERSION);
		SDL_GetVersion(&sdlVersion);
		console.printLine(Format("SDL version: {0}.{1}.{2}") << sdlVersion.major << sdlVersion.minor << sdlVersion.patch);
		const SDL_version* mixVersion = Mix_Linked_Version();
		console.printLine(Format("SDL_mixer version: {0}.{1}.{2}") << mixVersion->major << mixVersion->minor << mixVersion->patch);
		const SDL_version* ttfVersion = TTF_Linked_Version();
		console.printLine(Format("SDL_ttf version: {0}.{1}.{2}") << ttfVersion->major << ttfVersion->minor << ttfVersion->patch);

		Console::registerBasicCommands(console);
		ConsoleCommands::registerCommands(console, service, menu, gameSettings);

		Math::initialize();

		console.printLine("\n===Font initialization===");
		font.load(D6_FILE_TTF_FONT, console);

		video.initialize(APP_NAME, APP_FILE_ICON, console);
		menu.initialize();

		gameResources = std::make_unique<GameResources>(service);
		game = std::make_unique<Game>(service, *gameResources, gameSettings);
		menu.setGameReference(game.get());

		for (Weapon weapon : Weapon::values())
		{
			gameSettings.enableWeapon(weapon, true);
		}

		// Execute config script and command line arguments
		console.printLine("\n===Config===");
		console.exec(std::string("exec ") + D6_FILE_CONFIG);

		for (int i = 1; i < argc; i++)
		{
			console.exec(argv[i]);
		}
	}
예제 #13
0
Client::Client() : ClientComponent() {
	pClient = this;
	SDL_version ver;
	if (SDL_Init(SDL_INIT_EVENTS) != 0) {
		g_Console()->Err("Unable to initialize SDL Events: " +
		                 std::string(SDL_GetError()));
		return; // TODO: need exceptions
	}
	SDL_GetVersion(&ver);
	g_Console()->Info("Initialized SDL Events " + std::to_string(ver.major) + "." +
	                  std::to_string(ver.minor) + "." + std::to_string(ver.patch));
}
예제 #14
0
/**
 * @brief Disables the filter if active
 */
void IN_DisableDingFilter()
{
	Com_DPrintf("Disabling dingy filter\n");
	if (LegacyWndProc)
	{
		SDL_SysWMinfo wmInfo;
		SDL_GetVersion(&wmInfo.version);
		SDL_GetWindowWMInfo(mainScreen, &wmInfo);
		SetWindowLongPtr(wmInfo.info.win.window, GWLP_WNDPROC, (LONG_PTR)LegacyWndProc);
		LegacyWndProc = NULL;
	}
}
예제 #15
0
VALUE sdl2r_get_version(VALUE klass)
{
    SDL_version v;
    VALUE ary[3];

    SDL_GetVersion(&v);
    ary[0] = INT2NUM(v.major);
    ary[1] = INT2NUM(v.minor);
    ary[2] = INT2NUM(v.patch);

    return rb_class_new_instance(3, ary, cVersion);
}
예제 #16
0
파일: testsdl.c 프로젝트: albertz/sdl
/**
 * @brief Main entry point.
 */
int main( int argc, char *argv[] )
{
   int failed;
   int rev;
   SDL_version ver;

   /* Get options. */
   parse_options( argc, argv );

   /* Defaults. */
   failed = 0;

   /* Print some text if verbose. */
   SDL_GetVersion( &ver );
   rev = SDL_GetRevision();
   SDL_ATprintVerbose( 1, "Running tests with SDL %d.%d.%d revision %d\n",
         ver.major, ver.minor, ver.patch, rev );

   /* Automatic tests. */
   if (run_platform)
      failed += test_platform();
   if (run_rwops)
      failed += test_rwops();
   if (run_rect)
      failed += test_rect();
   if (run_surface)
      failed += test_surface();
   if (run_render)
      failed += test_render();
   if (run_audio)
      failed += test_audio();

   /* Manual tests. */
   if (run_manual) {
   }

   /* Display more information if failed. */
   if (failed > 0) {
      SDL_ATprintErr( "Tests run with SDL %d.%d.%d revision %d\n",
            ver.major, ver.minor, ver.patch, rev );
      SDL_ATprintErr( "System is running %s and is %s endian\n",
            SDL_GetPlatform(),
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
            "little"
#else
            "big"
#endif
            );
   }

   return failed;
}
예제 #17
0
/**
 * @brief Enables the filter if not already active
 */
void IN_EnableDingFilter()
{
	IN_DisableDingFilter();
	Com_DPrintf("Enabling dingy filter\n");
	if (!LegacyWndProc)
	{
		SDL_SysWMinfo wmInfo;
		SDL_GetVersion(&wmInfo.version);
		SDL_GetWindowWMInfo(mainScreen, &wmInfo);
		LegacyWndProc = (WNDPROC)GetWindowLongPtr(wmInfo.info.win.window, GWLP_WNDPROC);
		SetWindowLongPtr(wmInfo.info.win.window, GWLP_WNDPROC, (LONG_PTR)&WNDDingIgnore);
	}
}
예제 #18
0
파일: main.cpp 프로젝트: zyphrus/Akaro
int main ( int argc, char* argv[] )
{
	{
		SDL_version running;
		SDL_GetVersion( &running );
		SDL_version linked;
		SDL_VERSION( &linked );

		if ( running.patch < linked.patch && running.minor < linked.minor )
		{
			std::cout << "You are running an out of date version of SDL2" << std::endl;
			std::cout << "You can the new version from http://libsdl.org" << std::endl;
		}
	}

	Content content;
	//Load base content
	content.init();

	if (content.Settings()->exists("info" , "printinfo"))
	{
		bool print = false;
		if ( content.Settings()->getBool("info" , "printinfo" , &print ) )
		{
			if (print)
			{
				etc::printSystemInfo();
			}
		} else {
			std::string option;
			content.Settings()->get("info" , "printinfo" , &option);
			std::cout << option << std::endl;
			if (option == "full")
			{
				etc::printSystemInfo(true);
			}
		}
	}

	AkaroWindow gm = AkaroWindow ( &content );

	//Make sure the window init'ed properly
	if ( gm.init ( "Akaro" , etc::toColour( 4, 107, 19 , 100 ) , SDL_WINDOW_OPENGL ) == 0 )
	{
		//14 - Start the game already!
		gm.start();

	}
	content.unload();
	return 0;
}
예제 #19
0
jstring Java_org_libsdl_app_SDLActivity_stringFromJNI( JNIEnv* env, jobject thiz)
{
	SDL_version linked;
	unsigned ver = avutil_version();
	char buf[512] = "", *ptr = buf;
	ptr += sprintf(ptr, "avutil %d.%d.%d ", ver>>16, (ver>>8)&0xff, ver&0xff); 

	SDL_GetVersion(&linked);
    ptr += sprintf(ptr, "sdl: %d.%d.%d.%d (%s)",
           linked.major, linked.minor, linked.patch,
           SDL_GetRevisionNumber(), SDL_GetRevision());

    return (*env)->NewStringUTF(env, buf);
}
예제 #20
0
void MainManager::initSDL()
{
  log_.i("Initializing SDL");
  if (SDL_Init(SDL_INIT_EVERYTHING) == -1)
    throw log_.exception("Failed to initialize SDL", SDL_GetError);
  atexit(SDL_Quit);

  // Write version information to log
  SDL_version compiled;
  SDL_version linked;
  SDL_VERSION(&compiled);
  SDL_GetVersion(&linked);
  logSDLVersion("SDL", compiled, linked, SDL_GetRevision());
}
예제 #21
0
void cmdAbout(const std::string& args) {
	// TODO: replace this with a GUI window
	narf::console->println("");
	narf::console->println("About NarfBlock");
	narf::console->println("Version: " VERSION_STR);
	narf::console->println("");
	narf::console->println("Authors:");
	auto authors = narf::util::tokenize(VERSION_AUTHORS, '\n');
	for (auto& a : authors) {
		narf::console->println(a);
	}
	narf::console->println("");

	auto credits = narf::util::tokenize(EMBED_STRING(extra_credits_txt), '\n');
	for (auto& c : credits) {
		narf::console->println(c);
	}

	narf::console->println("");
	narf::console->println("Library versions:");

	narf::console->println("ENet " + std::to_string(ENET_VERSION_MAJOR) + "." + std::to_string(ENET_VERSION_MINOR) + "." + std::to_string(ENET_VERSION_PATCH));

	SDL_version sdl;
	SDL_GetVersion(&sdl);
	narf::console->println("SDL " + std::to_string(sdl.major) + "." + std::to_string(sdl.minor) + "." + std::to_string(sdl.patch));

	narf::console->println("zlib " + std::string(zlibVersion()));

	auto png = png_access_version_number();
	auto pngMajor = png / 10000;
	auto pngMinor = (png / 100) % 100;
	auto pngRelease = png % 100;
	narf::console->println("libpng " + std::to_string(pngMajor) + "." + std::to_string(pngMinor) + "." + std::to_string(pngRelease));

	FT_Library ftlib;
	FT_Init_FreeType(&ftlib);
	FT_Int ftMajor, ftMinor, ftPatch;
	FT_Library_Version(ftlib, &ftMajor, &ftMinor, &ftPatch);
	FT_Done_FreeType(ftlib);
	narf::console->println("FreeType " + std::to_string(ftMajor) + "." + std::to_string(ftMinor) + "." + std::to_string(ftPatch));

	narf::console->println(opus_get_version_string());

	narf::console->println("");
	narf::console->println("OpenGL information:");
	narf::console->println("OpenGL version " + std::string(display->glVersion));
	narf::console->println("GLSL version " + std::string(display->glslVersion));
	narf::console->println("GL context version " + std::to_string(display->glContextVersionMajor) + "." + std::to_string(display->glContextVersionMinor));
}
예제 #22
0
void GraphicsSDL::print_sdl_version()
{
    SDL_version ver_current;

#ifdef USE_SDL2
    SDL_GetVersion(&ver_current);
#else
    const SDL_version * constptr_ver_current = SDL_Linked_Version(); // dyn. linked version
    ver_current = *constptr_ver_current;
#endif

    printf("[gfx] SDL %d.%d.%d loaded.\n",
           ver_current.major, ver_current.minor, ver_current.patch);
}
예제 #23
0
파일: SDL.c 프로젝트: Tangent128/luasdl2
int EXPORT
luaopen_SDL(lua_State *L)
{
	int i;
	SDL_version ver;

	/* General functions */
	commonNewLibrary(L, functions);

	/* Library categories */
	for (i = 0; libraries[i].functions != NULL; ++i)
		commonBindLibrary(L, libraries[i].functions);

	/* Enumerations */
	for (i = 0; enums[i].values != NULL; ++i)
		commonBindEnum(L, -1, enums[i].name, enums[i].values);

	/* Object oriented data */
	for (i = 0; objects[i].object != NULL; ++i)
		commonBindObject(L, objects[i].object);

	/* Store the version */
	SDL_GetVersion(&ver);

	tableSetInt(L, -1, "VERSION_MAJOR", ver.major);
	tableSetInt(L, -1, "VERSION_MINOR", ver.minor);
	tableSetInt(L, -1, "VERSION_PATCH", ver.patch);

	tableSetInt(L, -1, "VERSION_BINDING", 4);
	tableSetInt(L, -1, "VERSION_BINDING_PATCH", 1);

	lua_newtable(L);
	tableSetInt(L, -1, "major", ver.major);
	tableSetInt(L, -1, "minor", ver.minor);
	tableSetInt(L, -1, "patch", ver.patch);
	lua_setfield(L, -2, "version");

	lua_newtable(L);
	tableSetInt(L, -1, "major", VERSION_BINDING_MAJOR);
	tableSetInt(L, -1, "minor", VERSION_BINDING_MINOR);
	lua_setfield(L, -2, "binding");

	if (ChannelMutex == NULL && (ChannelMutex = SDL_CreateMutex()) == NULL)
		return luaL_error(L, SDL_GetError());

	return 1;
}
예제 #24
0
	void ConsoleCommands::registerCommands(Console& console, AppService& appService, Menu& menu, GameSettings& gameSettings)
	{
		SDL_version sdlVersion;
		std::string verStr = D6_L("version");

		// Print application info
		console.printLine(D6_L("\n===Application information==="));
		console.printLine(Format("{0} {1}: {2}") << APP_NAME << verStr << APP_VERSION);
		SDL_GetVersion(&sdlVersion);
		console.printLine(Format("SDL {0}: {1}.{2}.{3}") << verStr << sdlVersion.major << sdlVersion.minor << sdlVersion.patch);
		const SDL_version* mixVersion = Mix_Linked_Version();
		console.printLine(Format("SDL_mixer {0}: {1}.{2}.{3}") << verStr << mixVersion->major << mixVersion->minor << mixVersion->patch);
		console.printLine(D6_L("Language: english"));

		// Set some console functions
		console.setLast(15);
		console.registerCommand("switch_render_mode", [&gameSettings](Console& con, const Console::Arguments& args) {
			toggleRenderMode(con, args, gameSettings);
		});
		console.registerCommand("show_fps", [&gameSettings](Console& con, const Console::Arguments& args) {
			toggleShowFps(con, args, gameSettings);
		});
		console.registerCommand("gl_info", openGLInfo);
		console.registerCommand("lang", language);
		console.registerCommand("volume", [&appService](Console& con, const Console::Arguments& args) {
			volume(con, args, appService.getSound());
		});
		console.registerCommand("rounds", [&gameSettings](Console& con, const Console::Arguments& args) {
			maxRounds(con, args, gameSettings);
		});
		console.registerCommand("ghosts", [&gameSettings](Console& con, const Console::Arguments& args) {
			ghostMode(con, args, gameSettings);
		});
		console.registerCommand("music", [&menu](Console& con, const Console::Arguments& args) {
			musicOnOff(con, args, menu);
		});
		console.registerCommand("joy_scan", [&menu](Console& con, const Console::Arguments& args) {
			joyScan(con, args, menu);
		});
		console.registerCommand("skin", [&menu](Console& con, const Console::Arguments& args) {
			loadSkin(con, args, menu);
		});
		console.registerCommand("gun", enableWeapon);
		console.registerCommand("start_ammo_range", [&gameSettings](Console& con, const Console::Arguments& args) {
			ammoRange(con, args, gameSettings);
		});
	}
예제 #25
0
static int sdl_init(void)
{
    uint32_t subSystems = SDL_INIT_VIDEO |
                          SDL_INIT_TIMER |
                          SDL_INIT_EVENTS |
                          SDL_INIT_JOYSTICK |
                          SDL_INIT_GAMECONTROLLER;

    SDL_version compiledVers, linkedVers;

    if (SDL_WasInit(subSystems) != subSystems)
    {
        if (SDL_Init(subSystems) != 0)
        {
            SDL_LogCritical(
                SDL_LOG_CATEGORY_APPLICATION,
                "%s: SDL startup error..",
                LITE3D_CURRENT_FUNCTION);
            return LITE3D_FALSE;
        }
    }

    SDL_VERSION(&compiledVers);
    SDL_GetVersion(&linkedVers);

    if (compiledVers.major != linkedVers.major)
    {
        SDL_LogCritical(
            SDL_LOG_CATEGORY_APPLICATION,
            "SDL version mismatch..");

        SDL_Quit();
        return LITE3D_FALSE;
    }

    SDL_LogInfo(
        SDL_LOG_CATEGORY_APPLICATION,
        "SDL Version %d.%d.%d",
        (int) linkedVers.major,
        (int) linkedVers.minor,
        (int) linkedVers.patch);

    return LITE3D_TRUE;
}
예제 #26
0
bool Initialize(const std::string &version)
{
    assert(_productVersion.empty());
    assert(!version.empty());

    logger::Info(L"initializing platform v%s", version.c_str());
    _productVersion = version;

    SDL_version v = { 0 };
    SDL_GetVersion(&v);
    logger::Info(L"initializing SDL v%d.%d.%d...", v.major, v.minor, v.patch);

    if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
    {
        logger::Fatal(L"SDL initialization failed");
        return false;
    }

    return true;
}
예제 #27
0
void IN_Init()
{
	SDL_version linked;

	if( input_inited )
		return;

	in_grabinconsole = Cvar_Get( "in_grabinconsole", "0", CVAR_ARCHIVE );
	in_disablemacosxmouseaccel = Cvar_Get( "in_disablemacosxmouseaccel", "1", CVAR_ARCHIVE );
	in_mousehack = Cvar_Get( "in_mousehack", "0", CVAR_ARCHIVE );

	SDL_GetVersion( &linked );

	SDL_ShowCursor( SDL_DISABLE );

#if SDL_VERSION_ATLEAST(2, 0, 2)
	
	{
		cvar_t *m_raw = Cvar_Get( "m_raw", "1", CVAR_ARCHIVE );
		SDL_SetHint( SDL_HINT_MOUSE_RELATIVE_MODE_WARP, m_raw->integer ? "0" : "1" );
	}
#endif

	mouse_relative = SDL_SetRelativeMouseMode( SDL_TRUE ) == 0;
	if( mouse_relative ) {
		IN_SetMouseScalingEnabled( false );
	}
	else {
		IN_WarpMouseToCenter( NULL, NULL );
	}

	IN_SDL_JoyInit( true );

	input_focus = true;
	input_inited = true;
	input_active = true; // will be activated by IN_Frame if necessary
	mouse_active = true;
	bugged_rawXevents = linked.major == 2 && linked.minor == 0 && linked.patch < 4;

	IN_SkipRelativeMouseMove();
}
예제 #28
0
    void SDLHandler::PrintSoftwareVersions()
    {
        cout << "GLEW version: " << glewGetString(GLEW_VERSION) << endl << endl;

        SDL_version compiled;
        SDL_version linked;

        SDL_VERSION(&compiled);
        SDL_GetVersion(&linked);
        cout << "Compiled against SDL version "  << static_cast<int>(compiled.major) << "." << 
                                                     static_cast<int>(compiled.minor)  << "." <<  
                                                     static_cast<int>(compiled.patch) << endl;
        cout << "Linked against SDL version "  << static_cast<int>(linked.major) << "." << 
                                                   static_cast<int>(linked.minor)  << "." <<  
                                                   static_cast<int>(linked.patch) << endl << endl;

        cout << "OpenGL vendor: " << glGetString(GL_VENDOR) << endl;
        cout << "OpenGL renderer: " << glGetString(GL_RENDERER) << endl;
        cout << "OpenGL version: " << glGetString(GL_VERSION) << endl;
        cout << "GLSL version: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << endl << endl;
    }
예제 #29
0
파일: Game.cpp 프로젝트: xxORVARxx/SDL-Book
// --- Functions ---
bool the_Game::Init( std::string _title )
{
  // Initializing_SDL2:
  if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 ) {
    std::cout << "GAME :: !! Failed to initialize SDL : " << SDL_GetError() << " !!\n";  
    return false;
  }

  m_display_ptr = SDL_CreateWindow( _title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
				    the_World::Instance().Get_display_width(), 
				    the_World::Instance().Get_display_height(), 
				    SDL_WINDOW_RESIZABLE );
  if ( m_display_ptr == nullptr ) {
    std::cout << "GAME :: !! Failed to create window : " << SDL_GetError() << " !!\n";  
    return false;
  }

  m_renderer_ptr = SDL_CreateRenderer( m_display_ptr, -1, SDL_RENDERER_ACCELERATED );
  if ( m_renderer_ptr == nullptr ) {
    std::cout << "GAME :: !! Failed to create renderer : " << SDL_GetError() << " !!\n";  
    return false;
  }

  // SDL Version:
  SDL_version compiled, linked;
  SDL_VERSION( &compiled );
  SDL_GetVersion( &linked );
  std::cout <<"GAME :: We compiled against SDL version: "
	    << (int)compiled.major <<"."<< (int)compiled.minor <<"."<< (int)compiled.patch <<"\n";
  std::cout <<"GAME :: But we are linking against SDL version: " 
	    << (int)linked.major <<"."<< (int)linked.minor <<"."<< (int)linked.patch << "\n";

  // Opening Inputh Handler:
  the_Input_handler::Instance().Initialise_joysticks();

  // The Game State Machine:
  m_state_machine.To_do( SMF_parameters( SMF::CREATE_AT_FRONT, "State1", "", "" ));

  return true;
}
예제 #30
0
파일: CoreEngine.cpp 프로젝트: roig/TD
void	CoreEngine::StartUp()
{

	m_run=true;

	SDL_Init(0);
	SDL_version compiled;
	SDL_version linked;

	SDL_VERSION(&compiled);

	SDL_GetVersion(&linked);





	//CREO ELS SUBSISTEMES EN ORDRE
	m_logmngr 	= new LogManager();
	m_logmngr->m_IsLogEnabled = LOG_ENABLED;
	m_logmngr->StartUp();
	m_rendermngr = new RenderManager();
	m_rendermngr->StartUp();
	//		m_soundmngr = new SoundManager();
	//		m_soundmngr->StartUp();
	//		m_inputmngr = new InputManager();
	//		m_inputmngr->StartUp();
	m_game = new GameManager();
	m_game->StartUp();
	m_timermngr = new CTimer();
	m_timermngr->StartUp();

	m_logmngr->INFO_LOG(LOG_ENGINE,"We compiled against SDL version %i.%i.%i",(unsigned int) compiled.major,(unsigned int) compiled.minor,(unsigned int) compiled.patch);
	m_logmngr->INFO_LOG(LOG_ENGINE,"And we are linking against SDL version %i.%i.%i",(unsigned int)linked.major,(unsigned int)linked.minor,(unsigned int) linked.patch);



	m_logmngr->INFO_LOG(LOG_ENGINE,"Start all subsystems OK");

}