mirror of
https://github.com/jorio/Pomme.git
synced 2024-11-19 10:30:50 +00:00
Graphics: optional MSAA
This commit is contained in:
parent
b7ee239eb2
commit
e7a7ca9663
@ -6,6 +6,7 @@
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <SDL.h>
|
||||
#include <SDL_opengl.h>
|
||||
|
||||
using namespace Pomme;
|
||||
using namespace Pomme::Graphics;
|
||||
@ -100,7 +101,11 @@ CGrafPtr Pomme::Graphics::GetScreenPort(void)
|
||||
return &screenPort->port;
|
||||
}
|
||||
|
||||
void Pomme::Graphics::Init(const char* windowTitle, int windowWidth, int windowHeight)
|
||||
void Pomme::Graphics::Init(
|
||||
const char* windowTitle,
|
||||
int windowWidth,
|
||||
int windowHeight,
|
||||
int msaaSamples)
|
||||
{
|
||||
if (0 != SDL_Init(SDL_INIT_VIDEO))
|
||||
{
|
||||
@ -113,6 +118,12 @@ void Pomme::Graphics::Init(const char* windowTitle, int windowWidth, int windowH
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
||||
#endif
|
||||
|
||||
if (msaaSamples != 0)
|
||||
{
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, msaaSamples);
|
||||
}
|
||||
|
||||
gSDLWindow = SDL_CreateWindow(
|
||||
windowTitle,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
|
@ -66,11 +66,11 @@ void HideCursor()
|
||||
//-----------------------------------------------------------------------------
|
||||
// Our own init
|
||||
|
||||
void Pomme::Init(const char* windowName)
|
||||
void Pomme::Init(const InitParams& params)
|
||||
{
|
||||
Pomme::Time::Init();
|
||||
Pomme::Files::Init();
|
||||
Pomme::Graphics::Init(windowName, 640, 480);
|
||||
Pomme::Graphics::Init(params.windowName, params.windowWidth, params.windowHeight, params.msaaSamples);
|
||||
Pomme::Sound::Init();
|
||||
Pomme::Input::Init();
|
||||
}
|
||||
|
@ -41,7 +41,11 @@ namespace Pomme::Graphics
|
||||
{ return (UInt32*) &data.data()[4 * (y * width + x)]; }
|
||||
};
|
||||
|
||||
void Init(const char* windowTitle, int windowWidth, int windowHeight);
|
||||
void Init(
|
||||
const char* windowTitle,
|
||||
int windowWidth,
|
||||
int windowHeight,
|
||||
int msaaSamples = 0);
|
||||
|
||||
void Shutdown();
|
||||
|
||||
|
@ -9,7 +9,15 @@ namespace Pomme
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
void Init(const char* applName);
|
||||
struct InitParams
|
||||
{
|
||||
const char* windowName;
|
||||
int windowWidth;
|
||||
int windowHeight;
|
||||
int msaaSamples;
|
||||
};
|
||||
|
||||
void Init(const InitParams& params);
|
||||
|
||||
void Shutdown();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user