Allow setting and getting beat bar status per NoteField from Lua
This commit is contained in:
@@ -1475,16 +1475,16 @@ end
|
||||
<pre><code>
|
||||
Def.ActorFrame{
|
||||
Name="AF",
|
||||
|
||||
|
||||
Def.Sprite{ Name="sun", Texture="sun.png" },
|
||||
|
||||
|
||||
Def.ActorFrame{
|
||||
Name="AF2",
|
||||
InitCommand=function(self)
|
||||
-- bounce() will be applied to AF2, airhorn, and catchphrase
|
||||
self:RunCommandsRecursively( function(actor) actor:bounce() end )
|
||||
end,
|
||||
|
||||
|
||||
Def.Sprite{ Name="airhorn", Texture="airhorn.png" },
|
||||
Def.BitmapText{ Name="catchphrase", Font="Common Normal", Text="Yo!" }
|
||||
}
|
||||
@@ -1788,9 +1788,9 @@ Def.ActorFrame{
|
||||
-- bounce() will be applied to sun and AF2
|
||||
self:RunCommandsOnChildren( function(child) child:bounce() end )
|
||||
end,
|
||||
|
||||
|
||||
Def.Sprite{ Name="sun", Texture="sun.png" },
|
||||
|
||||
|
||||
Def.ActorFrame{
|
||||
Name="AF2",
|
||||
Def.Sprite{ Name="airhorn", Texture="airhorn.png" },
|
||||
@@ -1810,9 +1810,9 @@ Def.ActorFrame{
|
||||
-- bounce() will be applied to sun, airhorn, and catchphrase
|
||||
self:runcommandsonleaves( function(leaf) leaf:bounce() end )
|
||||
end,
|
||||
|
||||
|
||||
Def.Sprite{ Name="sun", Texture="sun.png" },
|
||||
|
||||
|
||||
Def.ActorFrame{
|
||||
Name="AF2",
|
||||
Def.Sprite{ Name="airhorn", Texture="airhorn.png" },
|
||||
@@ -3877,6 +3877,7 @@ NETWORK:WebSocket{
|
||||
<Class name='NoteField'>
|
||||
<Description>
|
||||
All functions in this class have camel case equivalents, use whichever naming style you prefer.<br />
|
||||
Camel case functions do not have snake case equivalents, though.<br />
|
||||
</Description>
|
||||
<Function name='did_hold_note' return='' arguments='int column, TapNoteScore tns, bool bright'>
|
||||
Makes the NoteField act as if a hold note was hit in the column, with the given score and bright setting. <br />
|
||||
@@ -3886,9 +3887,15 @@ 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=''>
|
||||
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'>
|
||||
Sets whether beat bars are enabled on this NoteField.
|
||||
</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>
|
||||
@@ -6845,7 +6852,7 @@ for i, diff in ipairs(Difficulty) do
|
||||
local filename = diff .. ".png"
|
||||
|
||||
-- load files like "Difficulty_Beginner.png",
|
||||
-- "Difficulty_Easy.png", etc. from the directory
|
||||
-- "Difficulty_Easy.png", etc. from the directory
|
||||
-- where this code is run, and offset each vertically
|
||||
af[#af+1] = LoadActor( filename )..{
|
||||
InitCommand=function(self) self:y( i * 100 ) end
|
||||
|
||||
+26
-1
@@ -46,6 +46,7 @@ NoteField::NoteField()
|
||||
m_pNoteData = nullptr;
|
||||
m_pCurDisplay = nullptr;
|
||||
m_drawing_board_primitive= false;
|
||||
m_bShowBeatBars = SHOW_BEAT_BARS;
|
||||
|
||||
m_textMeasureNumber.LoadFromFont( THEME->GetPathF("NoteField","MeasureNumber") );
|
||||
m_textMeasureNumber.SetZoom( 1.0f );
|
||||
@@ -96,6 +97,16 @@ void NoteField::Unload()
|
||||
memset( m_pDisplays, 0, sizeof(m_pDisplays) );
|
||||
}
|
||||
|
||||
void NoteField::SetBeatBars(bool active)
|
||||
{
|
||||
m_bShowBeatBars = active;
|
||||
}
|
||||
|
||||
bool NoteField::GetBeatBars()
|
||||
{
|
||||
return m_bShowBeatBars;
|
||||
}
|
||||
|
||||
void NoteField::CacheNoteSkin( const RString &sNoteSkin_ )
|
||||
{
|
||||
RString sNoteSkinLower = sNoteSkin_;
|
||||
@@ -800,7 +811,7 @@ void NoteField::DrawPrimitives()
|
||||
segs[tst] = &(pTiming->GetTimingSegments(tst));
|
||||
|
||||
// Draw beat bars
|
||||
if( ( GAMESTATE->IsEditing() || SHOW_BEAT_BARS ) && pTiming != nullptr )
|
||||
if( ( GAMESTATE->IsEditing() || m_bShowBeatBars ) && pTiming != nullptr )
|
||||
{
|
||||
const std::vector<TimingSegment *> &tSigs = *segs[SEGMENT_TIME_SIG];
|
||||
int iMeasureIndex = 0;
|
||||
@@ -1267,6 +1278,18 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int GetBeatBars(T* p, lua_State* L)
|
||||
{
|
||||
LuaHelpers::Push(L, p->GetBeatBars());
|
||||
return 1;
|
||||
};
|
||||
|
||||
static int SetBeatBars(T* p, lua_State* L)
|
||||
{
|
||||
p->SetBeatBars(BArg(1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
LunaNoteField()
|
||||
{
|
||||
ADD_METHOD(set_step_callback);
|
||||
@@ -1278,6 +1301,8 @@ public:
|
||||
ADD_METHOD(did_tap_note);
|
||||
ADD_METHOD(did_hold_note);
|
||||
ADD_METHOD(get_column_actors);
|
||||
ADD_METHOD(GetBeatBars);
|
||||
ADD_METHOD(SetBeatBars);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -67,6 +67,9 @@ public:
|
||||
// public so that the Lua API can access it. -Kyz
|
||||
std::vector<NoteColumnRenderer> m_ColumnRenderers;
|
||||
|
||||
void SetBeatBars(bool active);
|
||||
bool GetBeatBars();
|
||||
|
||||
protected:
|
||||
void CacheNoteSkin( const RString &sNoteSkin );
|
||||
void UncacheNoteSkin( const RString &sNoteSkin );
|
||||
@@ -126,6 +129,8 @@ protected:
|
||||
BitmapText m_textMeasureNumber;
|
||||
Quad m_rectMarkerBar;
|
||||
Quad m_rectAreaHighlight;
|
||||
|
||||
bool m_bShowBeatBars;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user