mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 13:37:22 +00:00
[client] app: rename up,right,down,left rotation to 0,90,180,270
This commit is contained in:
parent
ff1dc32efe
commit
733bbf5153
@ -59,10 +59,10 @@ LG_RendererSupport;
|
||||
|
||||
typedef enum LG_RendererRotate
|
||||
{
|
||||
LG_ROTATE_UP,
|
||||
LG_ROTATE_DOWN,
|
||||
LG_ROTATE_LEFT,
|
||||
LG_ROTATE_RIGHT
|
||||
LG_ROTATE_0,
|
||||
LG_ROTATE_90,
|
||||
LG_ROTATE_180,
|
||||
LG_ROTATE_270
|
||||
}
|
||||
LG_RendererRotate;
|
||||
|
||||
|
@ -18,25 +18,25 @@ void main()
|
||||
muv.x += mouse.x;
|
||||
muv.y -= mouse.y;
|
||||
|
||||
if (rotate == 0) // up
|
||||
if (rotate == 0) // 0
|
||||
{
|
||||
gl_Position.xy = muv;
|
||||
}
|
||||
else if (rotate == 1) // down
|
||||
else if (rotate == 1) // 90
|
||||
{
|
||||
gl_Position.x = muv.y;
|
||||
gl_Position.y = -muv.x;
|
||||
}
|
||||
else if (rotate == 2) // 180
|
||||
{
|
||||
gl_Position.x = -muv.x;
|
||||
gl_Position.y = -muv.y;
|
||||
}
|
||||
else if (rotate == 2) // left
|
||||
else if (rotate == 3) // 270
|
||||
{
|
||||
gl_Position.x = -muv.y;
|
||||
gl_Position.y = muv.x;
|
||||
}
|
||||
else if (rotate == 3) // right
|
||||
{
|
||||
gl_Position.x = muv.y;
|
||||
gl_Position.y = -muv.x;
|
||||
}
|
||||
|
||||
gl_Position.w = 1.0;
|
||||
uv = vertexUV;
|
||||
|
@ -16,25 +16,25 @@ uniform int cbMode;
|
||||
void main()
|
||||
{
|
||||
highp vec2 ruv;
|
||||
if (rotate == 0) // up
|
||||
if (rotate == 0) // 0
|
||||
{
|
||||
ruv = uv;
|
||||
}
|
||||
else if (rotate == 1) // down
|
||||
else if (rotate == 1) // 90
|
||||
{
|
||||
ruv.x = uv.y;
|
||||
ruv.y = -uv.x + 1.0f;
|
||||
}
|
||||
else if (rotate == 2) // 180
|
||||
{
|
||||
ruv.x = -uv.x + 1.0f;
|
||||
ruv.y = -uv.y + 1.0f;
|
||||
}
|
||||
else if (rotate == 2) // left
|
||||
else if (rotate == 3) // 270
|
||||
{
|
||||
ruv.x = -uv.y + 1.0f;
|
||||
ruv.y = uv.x;
|
||||
}
|
||||
else if (rotate == 3) // right
|
||||
{
|
||||
ruv.x = uv.y;
|
||||
ruv.y = -uv.x + 1.0f;
|
||||
}
|
||||
|
||||
if(nearest == 1)
|
||||
color = texture(sampler1, ruv);
|
||||
|
@ -38,9 +38,7 @@ static bool optSizeParse (struct Option * opt, const char * str);
|
||||
static StringList optSizeValues (struct Option * opt);
|
||||
static char * optSizeToString (struct Option * opt);
|
||||
static char * optScancodeToString(struct Option * opt);
|
||||
static bool optRotateParse (struct Option * opt, const char * str);
|
||||
static StringList optRotateValues (struct Option * opt);
|
||||
static char * optRotateToString (struct Option * opt);
|
||||
static bool optRotateValidate (struct Option * opt, const char ** error);
|
||||
|
||||
static void doLicense();
|
||||
|
||||
@ -241,10 +239,9 @@ static struct Option options[] =
|
||||
.module = "win",
|
||||
.name = "rotate",
|
||||
.description = "Rotate the displayed image",
|
||||
.type = OPTION_TYPE_CUSTOM,
|
||||
.parser = optRotateParse,
|
||||
.getValues = optRotateValues,
|
||||
.toString = optRotateToString
|
||||
.type = OPTION_TYPE_INT,
|
||||
.validator = optRotateValidate,
|
||||
.value.x_int = 0,
|
||||
},
|
||||
|
||||
// input options
|
||||
@ -487,6 +484,14 @@ bool config_load(int argc, char * argv[])
|
||||
params.showAlerts = option_get_bool ("win", "alerts" );
|
||||
params.quickSplash = option_get_bool ("win", "quickSplash" );
|
||||
|
||||
switch(option_get_int("win", "rotate"))
|
||||
{
|
||||
case 0 : params.winRotate = LG_ROTATE_0 ; break;
|
||||
case 90 : params.winRotate = LG_ROTATE_90 ; break;
|
||||
case 180: params.winRotate = LG_ROTATE_180; break;
|
||||
case 270: params.winRotate = LG_ROTATE_270; break;
|
||||
}
|
||||
|
||||
params.grabKeyboard = option_get_bool("input", "grabKeyboard" );
|
||||
params.grabKeyboardOnFocus = option_get_bool("input", "grabKeyboardOnFocus");
|
||||
params.escapeKey = option_get_int ("input", "escapeKey" );
|
||||
@ -677,45 +682,17 @@ static char * optScancodeToString(struct Option * opt)
|
||||
return str;
|
||||
}
|
||||
|
||||
static bool optRotateParse(struct Option * opt, const char * str)
|
||||
static bool optRotateValidate(struct Option * opt, const char ** error)
|
||||
{
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
if (strcasecmp(str, "up" ) == 0) params.winRotate = LG_ROTATE_UP;
|
||||
else if (strcasecmp(str, "down" ) == 0) params.winRotate = LG_ROTATE_DOWN;
|
||||
else if (strcasecmp(str, "left" ) == 0) params.winRotate = LG_ROTATE_LEFT;
|
||||
else if (strcasecmp(str, "right") == 0) params.winRotate = LG_ROTATE_RIGHT;
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static StringList optRotateValues(struct Option * opt)
|
||||
{
|
||||
StringList sl = stringlist_new(false);
|
||||
|
||||
stringlist_push(sl, "UP" );
|
||||
stringlist_push(sl, "DOWN" );
|
||||
stringlist_push(sl, "LEFT" );
|
||||
stringlist_push(sl, "RIGHT");
|
||||
|
||||
return sl;
|
||||
}
|
||||
|
||||
static char * optRotateToString(struct Option * opt)
|
||||
{
|
||||
const char * str;
|
||||
switch(params.winRotate)
|
||||
switch(opt->value.x_int)
|
||||
{
|
||||
case LG_ROTATE_UP : str = "UP" ; break;
|
||||
case LG_ROTATE_DOWN : str = "DOWN" ; break;
|
||||
case LG_ROTATE_LEFT : str = "LEFT" ; break;
|
||||
case LG_ROTATE_RIGHT: str = "RIGHT"; break;
|
||||
default:
|
||||
return NULL;
|
||||
case 0:
|
||||
case 90:
|
||||
case 180:
|
||||
case 270:
|
||||
return true;
|
||||
}
|
||||
|
||||
return strdup(str);
|
||||
*error = "Rotation angle must be one of 0, 90, 180 or 270";
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user