Add antialiasing command line option
This commit is contained in:
@@ -11,7 +11,8 @@ int main(string[] argv)
|
||||
{
|
||||
bool nodirectmode;
|
||||
string inputfile;
|
||||
auto helpInformation = getopt(argv, "no-direct-mode", &nodirectmode, "file", &inputfile);
|
||||
bool antialiasing;
|
||||
auto helpInformation = getopt(argv, "no-direct-mode", &nodirectmode, "file", &inputfile, "anti-aliasing", "Enable antialiasing.", &antialiasing);
|
||||
if (helpInformation.helpWanted)
|
||||
{
|
||||
defaultGetoptPrinter("Some information about the program.",
|
||||
@@ -21,7 +22,7 @@ int main(string[] argv)
|
||||
//try
|
||||
{
|
||||
auto pc = new PetitComputer();
|
||||
pc.run(nodirectmode, inputfile);
|
||||
pc.run(nodirectmode, inputfile, antialiasing);
|
||||
}
|
||||
/*(Throwable t)
|
||||
{
|
||||
|
||||
@@ -72,6 +72,10 @@ class GraphicPage
|
||||
GLuint glTexture;
|
||||
GLenum textureFormat;
|
||||
void createTexture(SDL_Renderer* renderer)
|
||||
{
|
||||
createTexture(renderer, GraphicPage.textureScaleMode);
|
||||
}
|
||||
void createTexture(SDL_Renderer* renderer, GLenum textureScaleMode)
|
||||
{
|
||||
ubyte r,g,b,a;
|
||||
SDL_GetRGBA(*cast(uint*)surface.pixels, surface.format, &r, &g, &b, &a);
|
||||
@@ -526,7 +530,7 @@ class PetitComputer
|
||||
writeln(SDL_GetError.to!string);
|
||||
return;
|
||||
}
|
||||
console.GRPF.createTexture(renderer);
|
||||
console.GRPF.createTexture(renderer, textureScaleMode);
|
||||
chScreen(0, 0, 400, 240);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -546,7 +550,7 @@ class PetitComputer
|
||||
DerelictGL3.reload();
|
||||
foreach(g; graphic.GRP)
|
||||
{
|
||||
g.createTexture(renderer);
|
||||
g.createTexture(renderer, textureScaleMode);
|
||||
g.createBuffer();
|
||||
}
|
||||
//glEnable(GL_BLEND);
|
||||
@@ -763,8 +767,17 @@ class PetitComputer
|
||||
Object buttonLock;
|
||||
Slot[] slot;
|
||||
bool isRunningDirectMode = false;
|
||||
void run(bool nodirectmode = false, string inputfile = "")
|
||||
GLenum textureScaleMode;
|
||||
void run(bool nodirectmode = false, string inputfile = "", bool antialiasing = false)
|
||||
{
|
||||
if (antialiasing)
|
||||
{
|
||||
textureScaleMode = GL_LINEAR;
|
||||
}
|
||||
else
|
||||
{
|
||||
textureScaleMode = GL_NEAREST;
|
||||
}
|
||||
buttonLock = new Object();
|
||||
slot = new Slot[5];
|
||||
keybuffer = new Key[128];
|
||||
|
||||
Reference in New Issue
Block a user