Allow setting the alpha of the beatbars

This commit is contained in:
teejusb
2024-03-03 00:08:55 -08:00
parent becd375544
commit 0c1115350d
3 changed files with 35 additions and 7 deletions
+7 -3
View File
@@ -3887,15 +3887,19 @@ NETWORK:WebSocket{
Makes the NoteField act as if a tap note was hit in the column, with the given score and bright setting. <br />
The callback for did_tap_note will not be called.
</Function>
<Function name='GetBeatBars' return='bool' arguments=''>
<Function name='GetBeatBars' return='bool' arguments='' since='ITGmania 0.8.0'>
Returns whether beat bars are enabled on this NoteField.
</Function>
<Function name='get_column_actors' return='{NoteColumnRenderer}' arguments=''>
Returns a table of the actors for the columns. This means that each column is an actor, so you can move it around or animate it like an actor. See the NoteColumnRenderer class for a list of special functions for the column's actor.
</Function>
<Function name='SetBeatBars' return='bool' arguments='bool enabled'>
<Function name='SetBeatBars' return='bool' arguments='bool enabled' since='ITGmania 0.8.0'>
Sets whether beat bars are enabled on this NoteField.
</Functions>
<Function name='SetBeatBarsAlpha' return='bool' arguments='float measure, float fourth, float eighth, float sixteenth' since='ITGmania 0.8.0'>
Sets the alpha for the beat bars on this NoteField.
Specify the alpha for the measure, fourth, eighth, and sixteenth beat bars at the same time.
</Functions>
<Function name='set_did_hold_note_callback' return= '' arguments='function callback'>
Same as SetDidTapNoteCallback, but for hold notes. Uses HoldNoteScore instead of TapNoteScore.
</Function>
@@ -5908,7 +5912,7 @@ local args = {
<Function name='SongToPreferredSortSectionName' return='string' arguments='Song s'>
Returns the preferred sort section name for the specified Song.
</Function>
<Function name='GetPreferredSortSongsBySectionName' return='{Song}' arguments='string sSectionName'>
<Function name='GetPreferredSortSongsBySectionName' return='{Song}' arguments='string sSectionName' since='ITGmania 0.8.0'>
Returns a table containing all songs in the specified preferred sort section.
</Function>
<Function name='WasLoadedFromAdditionalCourses' return='bool' arguments='Course c'>
+23 -4
View File
@@ -47,6 +47,10 @@ NoteField::NoteField()
m_pCurDisplay = nullptr;
m_drawing_board_primitive= false;
m_bShowBeatBars = SHOW_BEAT_BARS;
m_fBarMeasureAlpha = BAR_MEASURE_ALPHA;
m_fBar4thAlpha = BAR_4TH_ALPHA;
m_fBar8thAlpha = BAR_8TH_ALPHA;
m_fBar16thAlpha = BAR_16TH_ALPHA;
m_textMeasureNumber.LoadFromFont( THEME->GetPathF("NoteField","MeasureNumber") );
m_textMeasureNumber.SetZoom( 1.0f );
@@ -107,6 +111,14 @@ bool NoteField::GetBeatBars()
return m_bShowBeatBars;
}
void NoteField::SetBeatBarsAlpha(float measure, float fourth, float eighth, float sixteenth)
{
m_fBarMeasureAlpha = measure;
m_fBar4thAlpha = fourth;
m_fBar8thAlpha = eighth;
m_fBar16thAlpha = sixteenth;
}
void NoteField::CacheNoteSkin( const RString &sNoteSkin_ )
{
RString sNoteSkinLower = sNoteSkin_;
@@ -397,7 +409,7 @@ void NoteField::DrawBeatBar( const float fBeat, BeatBarType type, int iMeasureIn
if( bIsMeasure )
{
fAlpha = BAR_MEASURE_ALPHA;
fAlpha = m_fBarMeasureAlpha;
iState = 0;
}
else
@@ -417,15 +429,15 @@ void NoteField::DrawBeatBar( const float fBeat, BeatBarType type, int iMeasureIn
DEFAULT_FAIL( type );
case measure: // handled above
case beat:
fAlpha = BAR_4TH_ALPHA;
fAlpha = m_fBar4thAlpha;
iState = 1;
break;
case half_beat:
fAlpha = SCALE(fScrollSpeed,1.0f,2.0f,0.0f,BAR_8TH_ALPHA);
fAlpha = SCALE(fScrollSpeed,1.0f,2.0f,0.0f,m_fBar8thAlpha);
iState = 2;
break;
case quarter_beat:
fAlpha = SCALE(fScrollSpeed,2.0f,4.0f,0.0f,BAR_16TH_ALPHA);
fAlpha = SCALE(fScrollSpeed,2.0f,4.0f,0.0f,m_fBar16thAlpha);
iState = 3;
break;
}
@@ -1290,6 +1302,12 @@ public:
return 0;
}
static int SetBeatBarsAlpha(T* p, lua_State* L)
{
p->SetBeatBarsAlpha(FArg(1), FArg(2), FArg(3), FArg(4));
return 0;
}
LunaNoteField()
{
ADD_METHOD(set_step_callback);
@@ -1303,6 +1321,7 @@ public:
ADD_METHOD(get_column_actors);
ADD_METHOD(GetBeatBars);
ADD_METHOD(SetBeatBars);
ADD_METHOD(SetBeatBarsAlpha);
}
};
+5
View File
@@ -69,6 +69,7 @@ public:
void SetBeatBars(bool active);
bool GetBeatBars();
void SetBeatBarsAlpha(float measure, float fourth, float eighth, float sixteenth);
protected:
void CacheNoteSkin( const RString &sNoteSkin );
@@ -131,6 +132,10 @@ protected:
Quad m_rectAreaHighlight;
bool m_bShowBeatBars;
float m_fBarMeasureAlpha;
float m_fBar4thAlpha;
float m_fBar8thAlpha;
float m_fBar16thAlpha;
};
#endif