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