mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 17:47:12 -04:00
Adjust for a much better texture (Thanks Goodly)
This commit is contained in:
parent
e777be1e90
commit
c5eb3593cf
@ -1955,7 +1955,7 @@ static void TouchScreen_HacksChanged(void* screen) {
|
|||||||
/* must destroy graphics resources BEFORE that */
|
/* must destroy graphics resources BEFORE that */
|
||||||
Screen_ContextLost(s);
|
Screen_ContextLost(s);
|
||||||
TouchScreen_InitButtons(s);
|
TouchScreen_InitButtons(s);
|
||||||
Gui_Refresh(s);
|
Gui_Refresh((struct Screen*)s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TouchScreen_ContextLost(void* screen) {
|
static void TouchScreen_ContextLost(void* screen) {
|
||||||
@ -2068,7 +2068,7 @@ static void TouchScreen_Layout(void* screen) {
|
|||||||
Widget_Layout(&s->btns[i]);
|
Widget_Layout(&s->btns[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget_SetLocation(&s->thumbstick, ANCHOR_MIN, ANCHOR_MAX, 30, 70);
|
Widget_SetLocation(&s->thumbstick, ANCHOR_MIN, ANCHOR_MAX, 30, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TouchScreen_Free(void* s) {
|
static void TouchScreen_Free(void* s) {
|
||||||
|
@ -2506,35 +2506,41 @@ void SpecialInputWidget_Create(struct SpecialInputWidget* w, struct FontDesc* fo
|
|||||||
*----------------------------------------------------ThumbstickWidget-----------------------------------------------------*
|
*----------------------------------------------------ThumbstickWidget-----------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
#ifdef CC_BUILD_TOUCH
|
#ifdef CC_BUILD_TOUCH
|
||||||
static void ThumbstickWidget_BuildMesh(void* widget, struct VertexTextured** vertices) {
|
#define DIR_YMAX (1 << 0)
|
||||||
|
#define DIR_YMIN (1 << 1)
|
||||||
|
#define DIR_XMAX (1 << 2)
|
||||||
|
#define DIR_XMIN (1 << 3)
|
||||||
|
|
||||||
|
static void ThumbstickWidget_BuildGroup(void* widget, struct Texture* tex, struct VertexTextured** vertices) {
|
||||||
struct ThumbstickWidget* w = (struct ThumbstickWidget*)widget;
|
struct ThumbstickWidget* w = (struct ThumbstickWidget*)widget;
|
||||||
struct Texture tex = { 0 };
|
float tmp;
|
||||||
|
tex->X = w->x;
|
||||||
|
|
||||||
tex.X = w->x; tex.Y = w->y;
|
tex->Y = w->y + w->height / 2;
|
||||||
tex.Width = w->width; tex.Height = w->height;
|
Gfx_Make2DQuad(tex, PACKEDCOL_WHITE, vertices);
|
||||||
tex.uv.U2 = 0.5f; tex.uv.V2 = 1;
|
|
||||||
Gfx_Make2DQuad(&tex, PACKEDCOL_WHITE, vertices);
|
|
||||||
|
|
||||||
/* The 4 sides.. not done */
|
tex->Y = w->y;
|
||||||
/* Side 1 */
|
tmp = tex->uv.V1; tex->uv.V1 = tex->uv.V2; tex->uv.V2 = tmp;
|
||||||
tex.Width /= 2;
|
Gfx_Make2DQuad(tex, PACKEDCOL_WHITE, vertices);
|
||||||
tex.uv.U1 = 0.75f;
|
|
||||||
tex.uv.U2 = 1.00f;
|
/* TODO: The two X sides */
|
||||||
Gfx_Make2DQuad(&tex, PACKEDCOL_WHITE, vertices);
|
tex->X += w->width;
|
||||||
/* Side 2 */
|
Gfx_Make2DQuad(tex, PACKEDCOL_WHITE, vertices);
|
||||||
tex.X += tex.Width;
|
Gfx_Make2DQuad(tex, PACKEDCOL_WHITE, vertices);
|
||||||
tex.uv.U1 = 1.00f;
|
|
||||||
tex.uv.U2 = 0.75f;
|
|
||||||
Gfx_Make2DQuad(&tex, PACKEDCOL_WHITE, vertices);
|
|
||||||
Gfx_Make2DQuad(&tex, PACKEDCOL_WHITE, vertices);
|
|
||||||
Gfx_Make2DQuad(&tex, PACKEDCOL_WHITE, vertices);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Replace with FACE_XMIN_BIT */
|
static void ThumbstickWidget_BuildMesh(void* widget, struct VertexTextured** vertices) {
|
||||||
#define DIR_XMIN (1 << FACE_XMIN)
|
struct ThumbstickWidget* w = (struct ThumbstickWidget*)widget;
|
||||||
#define DIR_XMAX (1 << FACE_XMAX)
|
struct Texture tex;
|
||||||
#define DIR_YMIN (1 << FACE_YMIN)
|
|
||||||
#define DIR_YMAX (1 << FACE_YMAX)
|
tex.Width = w->width; tex.Height = w->height / 2;
|
||||||
|
tex.uv.U1 = 0.0f; tex.uv.U2 = 1.0f;
|
||||||
|
|
||||||
|
tex.uv.V1 = 0.0f; tex.uv.V2 = 0.5f;
|
||||||
|
ThumbstickWidget_BuildGroup(widget, &tex, vertices);
|
||||||
|
tex.uv.V1 = 0.5f; tex.uv.V2 = 1.0f;
|
||||||
|
ThumbstickWidget_BuildGroup(widget, &tex, vertices);
|
||||||
|
}
|
||||||
|
|
||||||
static int ThumbstickWidget_CalcDirs(struct ThumbstickWidget* w) {
|
static int ThumbstickWidget_CalcDirs(struct ThumbstickWidget* w) {
|
||||||
int i, dx, dy, dirs = 0;
|
int i, dx, dy, dirs = 0;
|
||||||
@ -2558,16 +2564,16 @@ static int ThumbstickWidget_CalcDirs(struct ThumbstickWidget* w) {
|
|||||||
|
|
||||||
static int ThumbstickWidget_Render2(void* widget, int offset) {
|
static int ThumbstickWidget_Render2(void* widget, int offset) {
|
||||||
struct ThumbstickWidget* w = (struct ThumbstickWidget*)widget;
|
struct ThumbstickWidget* w = (struct ThumbstickWidget*)widget;
|
||||||
int flags = ThumbstickWidget_CalcDirs(w);
|
int i, base, flags = ThumbstickWidget_CalcDirs(w);
|
||||||
|
|
||||||
if (Gui.TouchTex) {
|
if (Gui.TouchTex) {
|
||||||
Gfx_BindTexture(Gui.TouchTex);
|
Gfx_BindTexture(Gui.TouchTex);
|
||||||
Gfx_DrawVb_IndexedTris_Range(4, offset);
|
for (i = 0; i < 4; i++) {
|
||||||
|
base = (flags & (1 << i)) ? 0 : THUMBSTICKWIDGET_PER;
|
||||||
if (flags & DIR_XMIN) Gfx_DrawVb_IndexedTris_Range(4, offset + 4);
|
Gfx_DrawVb_IndexedTris_Range(4, offset + base + (i * 4));
|
||||||
if (flags & DIR_XMAX) Gfx_DrawVb_IndexedTris_Range(4, offset + 8);
|
}
|
||||||
}
|
}
|
||||||
return offset + 20;
|
return offset + THUMBSTICKWIDGET_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct WidgetVTABLE ThumbstickWidget_VTABLE = {
|
static const struct WidgetVTABLE ThumbstickWidget_VTABLE = {
|
||||||
|
@ -284,7 +284,8 @@ CC_NOINLINE void SpecialInputWidget_SetActive(struct SpecialInputWidget* w, cc_b
|
|||||||
|
|
||||||
#ifdef CC_BUILD_TOUCH
|
#ifdef CC_BUILD_TOUCH
|
||||||
struct ThumbstickWidget { Widget_Body };
|
struct ThumbstickWidget { Widget_Body };
|
||||||
#define THUMBSTICKWIDGET_MAX (4 * 5)
|
#define THUMBSTICKWIDGET_PER (4 * 4)
|
||||||
|
#define THUMBSTICKWIDGET_MAX (THUMBSTICKWIDGET_PER * 2)
|
||||||
|
|
||||||
void ThumbstickWidget_Init(struct ThumbstickWidget* w);
|
void ThumbstickWidget_Init(struct ThumbstickWidget* w);
|
||||||
void ThumbstickWidget_GetMovement(struct ThumbstickWidget* w, float* xMoving, float* zMoving);
|
void ThumbstickWidget_GetMovement(struct ThumbstickWidget* w, float* xMoving, float* zMoving);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user