mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-28 01:40:41 +00:00
- menu transitions are working again.
This commit is contained in:
parent
968fe10de7
commit
8caaf4fa64
8 changed files with 29 additions and 4 deletions
|
@ -439,6 +439,9 @@ void F2DDrawer::AddTexture(FGameTexture* img, DrawParms& parms)
|
||||||
std::swap(v1, v2);
|
std::swap(v1, v2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto osave = offset;
|
||||||
|
if (parms.nooffset) offset = { 0,0 };
|
||||||
|
|
||||||
if (parms.rotateangle == 0)
|
if (parms.rotateangle == 0)
|
||||||
{
|
{
|
||||||
double x = parms.x - parms.left * xscale;
|
double x = parms.x - parms.left * xscale;
|
||||||
|
@ -521,6 +524,7 @@ void F2DDrawer::AddTexture(FGameTexture* img, DrawParms& parms)
|
||||||
dg.mIndexCount += 6;
|
dg.mIndexCount += 6;
|
||||||
AddIndices(dg.mVertIndex, 6, 0, 1, 2, 1, 3, 2);
|
AddIndices(dg.mVertIndex, 6, 0, 1, 2, 1, 3, 2);
|
||||||
AddCommand(&dg);
|
AddCommand(&dg);
|
||||||
|
offset = osave;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -561,6 +565,9 @@ void F2DDrawer::AddShape(FGameTexture* img, DShape2D* shape, DrawParms& parms)
|
||||||
shape->dirty = false;
|
shape->dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto osave = offset;
|
||||||
|
if (parms.nooffset) offset = { 0,0 };
|
||||||
|
|
||||||
double minx = 16383, miny = 16383, maxx = -16384, maxy = -16384;
|
double minx = 16383, miny = 16383, maxx = -16384, maxy = -16384;
|
||||||
for ( int i=0; i<dg.mVertCount; i++ )
|
for ( int i=0; i<dg.mVertCount; i++ )
|
||||||
{
|
{
|
||||||
|
@ -599,6 +606,7 @@ void F2DDrawer::AddShape(FGameTexture* img, DShape2D* shape, DrawParms& parms)
|
||||||
AddIndices(dg.mVertIndex, 3, shape->mIndices[i], shape->mIndices[i+1], shape->mIndices[i+2]);
|
AddIndices(dg.mVertIndex, 3, shape->mIndices[i], shape->mIndices[i+1], shape->mIndices[i+2]);
|
||||||
}
|
}
|
||||||
AddCommand(&dg);
|
AddCommand(&dg);
|
||||||
|
offset = osave;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -703,6 +703,7 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
|
||||||
parms->rotateangle = 0;
|
parms->rotateangle = 0;
|
||||||
parms->flipoffsets = false;
|
parms->flipoffsets = false;
|
||||||
parms->indexed = false;
|
parms->indexed = false;
|
||||||
|
parms->nooffset = false;
|
||||||
|
|
||||||
// Parse the tag list for attributes. (For floating point attributes,
|
// Parse the tag list for attributes. (For floating point attributes,
|
||||||
// consider that the C ABI dictates that all floats be promoted to
|
// consider that the C ABI dictates that all floats be promoted to
|
||||||
|
@ -914,6 +915,10 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
|
||||||
parms->flipoffsets = ListGetInt(tags);
|
parms->flipoffsets = ListGetInt(tags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DTA_NoOffset:
|
||||||
|
parms->nooffset = ListGetInt(tags);
|
||||||
|
break;
|
||||||
|
|
||||||
case DTA_SrcX:
|
case DTA_SrcX:
|
||||||
parms->srcx = ListGetDouble(tags) / img->GetDisplayWidth();
|
parms->srcx = ListGetDouble(tags) / img->GetDisplayWidth();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -131,6 +131,7 @@ enum
|
||||||
DTA_FlipOffsets, // Flips offsets when using DTA_FlipX and DTA_FlipY, this cannot be automatic due to unexpected behavior with unoffsetted graphics.
|
DTA_FlipOffsets, // Flips offsets when using DTA_FlipX and DTA_FlipY, this cannot be automatic due to unexpected behavior with unoffsetted graphics.
|
||||||
DTA_Indexed, // Use an indexed texture combined with the given translation.
|
DTA_Indexed, // Use an indexed texture combined with the given translation.
|
||||||
DTA_CleanTop, // Like DTA_Clean but aligns to the top of the screen instead of the center.
|
DTA_CleanTop, // Like DTA_Clean but aligns to the top of the screen instead of the center.
|
||||||
|
DTA_NoOffset, // Ignore 2D drawer's offset.
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -198,6 +199,7 @@ struct DrawParms
|
||||||
bool burn;
|
bool burn;
|
||||||
bool flipoffsets;
|
bool flipoffsets;
|
||||||
bool indexed;
|
bool indexed;
|
||||||
|
bool nooffset;
|
||||||
int8_t fsscalemode;
|
int8_t fsscalemode;
|
||||||
double srcx, srcy;
|
double srcx, srcy;
|
||||||
double srcwidth, srcheight;
|
double srcwidth, srcheight;
|
||||||
|
|
|
@ -230,7 +230,7 @@ bool MenuTransition::Draw()
|
||||||
double now = I_GetTimeNS() * (120. / 1'000'000'000);
|
double now = I_GetTimeNS() * (120. / 1'000'000'000);
|
||||||
if (now < start + length)
|
if (now < start + length)
|
||||||
{
|
{
|
||||||
double factor = 120 * screen->GetWidth() / screen->GetHeight();
|
double factor = screen->GetWidth()/2;
|
||||||
double phase = (now - start) / double(length) * M_PI + M_PI / 2;
|
double phase = (now - start) / double(length) * M_PI + M_PI / 2;
|
||||||
DVector2 origin;
|
DVector2 origin;
|
||||||
|
|
||||||
|
@ -241,6 +241,8 @@ bool MenuTransition::Draw()
|
||||||
origin.X = factor * dir * (sin(phase) + 1.);
|
origin.X = factor * dir * (sin(phase) + 1.);
|
||||||
twod->SetOffset(origin);
|
twod->SetOffset(origin);
|
||||||
current->CallDrawer();
|
current->CallDrawer();
|
||||||
|
origin = { 0,0 };
|
||||||
|
twod->SetOffset(origin);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (destroyprev && previous) previous->Destroy();
|
if (destroyprev && previous) previous->Destroy();
|
||||||
|
@ -977,6 +979,7 @@ DEFINE_FIELD(DMenu, mMouseCapture);
|
||||||
DEFINE_FIELD(DMenu, mBackbuttonSelected);
|
DEFINE_FIELD(DMenu, mBackbuttonSelected);
|
||||||
DEFINE_FIELD(DMenu, DontDim);
|
DEFINE_FIELD(DMenu, DontDim);
|
||||||
DEFINE_FIELD(DMenu, DontBlur);
|
DEFINE_FIELD(DMenu, DontBlur);
|
||||||
|
DEFINE_FIELD(DMenu, AnimatedTransition);
|
||||||
|
|
||||||
DEFINE_FIELD(DMenuDescriptor, mMenuName)
|
DEFINE_FIELD(DMenuDescriptor, mMenuName)
|
||||||
DEFINE_FIELD(DMenuDescriptor, mNetgameMessage)
|
DEFINE_FIELD(DMenuDescriptor, mNetgameMessage)
|
||||||
|
@ -1002,6 +1005,7 @@ DEFINE_FIELD(DListMenuDescriptor, mAutoselect)
|
||||||
DEFINE_FIELD(DListMenuDescriptor, mFont)
|
DEFINE_FIELD(DListMenuDescriptor, mFont)
|
||||||
DEFINE_FIELD(DListMenuDescriptor, mFontColor)
|
DEFINE_FIELD(DListMenuDescriptor, mFontColor)
|
||||||
DEFINE_FIELD(DListMenuDescriptor, mFontColor2)
|
DEFINE_FIELD(DListMenuDescriptor, mFontColor2)
|
||||||
|
DEFINE_FIELD(DListMenuDescriptor, mAnimatedTransition)
|
||||||
DEFINE_FIELD(DListMenuDescriptor, mCenter)
|
DEFINE_FIELD(DListMenuDescriptor, mCenter)
|
||||||
DEFINE_FIELD(DListMenuDescriptor, mVirtWidth)
|
DEFINE_FIELD(DListMenuDescriptor, mVirtWidth)
|
||||||
DEFINE_FIELD(DListMenuDescriptor, mVirtHeight)
|
DEFINE_FIELD(DListMenuDescriptor, mVirtHeight)
|
||||||
|
|
|
@ -213,6 +213,7 @@ public:
|
||||||
bool mBackbuttonSelected;
|
bool mBackbuttonSelected;
|
||||||
bool DontDim;
|
bool DontDim;
|
||||||
bool DontBlur;
|
bool DontBlur;
|
||||||
|
bool AnimatedTransition;
|
||||||
static int InMenu;
|
static int InMenu;
|
||||||
|
|
||||||
DMenu(DMenu *parent = NULL);
|
DMenu(DMenu *parent = NULL);
|
||||||
|
@ -223,7 +224,7 @@ public:
|
||||||
bool CallMenuEvent(int mkey, bool fromcontroller);
|
bool CallMenuEvent(int mkey, bool fromcontroller);
|
||||||
void CallTicker();
|
void CallTicker();
|
||||||
void CallDrawer();
|
void CallDrawer();
|
||||||
bool canAnimate() { return false; }
|
bool canAnimate() { return AnimatedTransition; }
|
||||||
};
|
};
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
|
@ -348,6 +348,7 @@ enum DrawTextureTags
|
||||||
DTA_FlipOffsets, // Flips offsets when using DTA_FlipX and DTA_FlipY, this cannot be automatic due to unexpected behavior with unoffsetted graphics.
|
DTA_FlipOffsets, // Flips offsets when using DTA_FlipX and DTA_FlipY, this cannot be automatic due to unexpected behavior with unoffsetted graphics.
|
||||||
DTA_Indexed, // Use an indexed texture combined with the given translation.
|
DTA_Indexed, // Use an indexed texture combined with the given translation.
|
||||||
DTA_CleanTop, // Like DTA_Clean but aligns to the top of the screen instead of the center.
|
DTA_CleanTop, // Like DTA_Clean but aligns to the top of the screen instead of the center.
|
||||||
|
DTA_NoOffset, // Ignore 2D drawer's offset.
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ class ListMenuDescriptor : MenuDescriptor native
|
||||||
native int mFontColor;
|
native int mFontColor;
|
||||||
native int mFontColor2;
|
native int mFontColor2;
|
||||||
native bool mCenter;
|
native bool mCenter;
|
||||||
|
native bool mAnimatedTransition;
|
||||||
native int mVirtWidth, mVirtHeight;
|
native int mVirtWidth, mVirtHeight;
|
||||||
|
|
||||||
native void Reset();
|
native void Reset();
|
||||||
|
@ -51,6 +52,7 @@ class ListMenu : Menu
|
||||||
{
|
{
|
||||||
Super.Init(parent);
|
Super.Init(parent);
|
||||||
mDesc = desc;
|
mDesc = desc;
|
||||||
|
AnimatedTransition = mDesc.mAnimatedTransition;
|
||||||
if (desc.mCenter)
|
if (desc.mCenter)
|
||||||
{
|
{
|
||||||
double center = 160;
|
double center = 160;
|
||||||
|
|
|
@ -94,6 +94,7 @@ class Menu : Object native ui version("2.4")
|
||||||
native bool mBackbuttonSelected;
|
native bool mBackbuttonSelected;
|
||||||
native bool DontDim;
|
native bool DontDim;
|
||||||
native bool DontBlur;
|
native bool DontBlur;
|
||||||
|
native bool AnimatedTransition;
|
||||||
|
|
||||||
native static int MenuTime();
|
native static int MenuTime();
|
||||||
native static Menu GetCurrentMenu();
|
native static Menu GetCurrentMenu();
|
||||||
|
@ -116,6 +117,7 @@ class Menu : Object native ui version("2.4")
|
||||||
mBackbuttonSelected = false;
|
mBackbuttonSelected = false;
|
||||||
DontDim = false;
|
DontDim = false;
|
||||||
DontBlur = false;
|
DontBlur = false;
|
||||||
|
AnimatedTransition = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -241,11 +243,11 @@ class Menu : Object native ui version("2.4")
|
||||||
int y = (!(m_show_backbutton&2))? 0:screen.GetHeight() - h;
|
int y = (!(m_show_backbutton&2))? 0:screen.GetHeight() - h;
|
||||||
if (mBackbuttonSelected && (mMouseCapture || m_use_mouse == 1))
|
if (mBackbuttonSelected && (mMouseCapture || m_use_mouse == 1))
|
||||||
{
|
{
|
||||||
screen.DrawTexture(tex, true, x, y, DTA_CleanNoMove, true, DTA_ColorOverlay, Color(40, 255,255,255));
|
screen.DrawTexture(tex, true, x, y, DTA_CleanNoMove, true, DTA_ColorOverlay, Color(40, 255,255,255), DTA_NOOFFSET, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen.DrawTexture(tex, true, x, y, DTA_CleanNoMove, true, DTA_Alpha, BackbuttonAlpha);
|
screen.DrawTexture(tex, true, x, y, DTA_CleanNoMove, true, DTA_Alpha, BackbuttonAlpha, DTA_NOOFFSET, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue