forked from etternagame/etterna
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request etternagame#47 from Nickito12/master
Mouse wheel music wheel and online chat scrolling
- Loading branch information
Showing
11 changed files
with
568 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
local moving = false | ||
local whee | ||
local pressingtab = false | ||
|
||
local function scrollInput(event) | ||
if event.DeviceInput.button == "DeviceButton_tab" then | ||
if event.type == "InputEventType_FirstPress" then | ||
pressingtab = true | ||
elseif event.type == "InputEventType_Release" then | ||
pressingtab = false | ||
end | ||
elseif event.DeviceInput.button == "DeviceButton_mousewheel up" and event.type == "InputEventType_FirstPress" then | ||
moving = true | ||
if pressingtab == true then | ||
whee:Move(-2) | ||
else | ||
whee:Move(-1) | ||
end | ||
elseif event.DeviceInput.button == "DeviceButton_mousewheel down" and event.type == "InputEventType_FirstPress" then | ||
moving = true | ||
if pressingtab == true then | ||
whee:Move(2) | ||
else | ||
whee:Move(1) | ||
end | ||
elseif moving == true then | ||
whee:Move(0) | ||
moving = false | ||
end | ||
end | ||
|
||
local t = Def.ActorFrame{ | ||
BeginCommand=function(self) | ||
whee = SCREENMAN:GetTopScreen():GetMusicWheel() | ||
SCREENMAN:GetTopScreen():AddInputCallback(scrollInput) | ||
self:visible(false) | ||
end, | ||
} | ||
return t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
|
||
local top | ||
local whee | ||
|
||
local border = 5 | ||
|
||
local inputX = THEME:GetMetric("ScreenNetSelectBase","ChatInputX") | ||
local inputY = THEME:GetMetric("ScreenNetSelectBase","ChatInputY") | ||
local inputWidth = THEME:GetMetric("ScreenNetSelectBase","ChatTextInputWidth")*0.4 | ||
local inputHeight = 25 | ||
|
||
|
||
local outputX = THEME:GetMetric("ScreenNetSelectBase","ChatOutputX") | ||
local outputY = THEME:GetMetric("ScreenNetSelectBase","ChatOutputY") | ||
local outputWidth = THEME:GetMetric("ScreenNetSelectBase","ChatTextOutputWidth")*0.3153 | ||
local outputHeight = THEME:GetMetric("ScreenNetSelectBase","ChatOutputLines")*9.25 | ||
|
||
if IsUsingWideScreen() == true then | ||
|
||
local border = 5 | ||
|
||
local inputX = THEME:GetMetric("ScreenNetSelectBase","ChatInputX") | ||
local inputY = THEME:GetMetric("ScreenNetSelectBase","ChatInputY") | ||
local inputWidth = THEME:GetMetric("ScreenNetSelectBase","ChatTextInputWidth")*0.4 | ||
local inputHeight = 25 | ||
|
||
|
||
local outputX = THEME:GetMetric("ScreenNetSelectBase","ChatOutputX") | ||
local outputY = THEME:GetMetric("ScreenNetSelectBase","ChatOutputY") | ||
local outputWidth = THEME:GetMetric("ScreenNetSelectBase","ChatTextOutputWidth")*0.3153 | ||
local outputHeight = THEME:GetMetric("ScreenNetSelectBase","ChatOutputLines")*9.25 | ||
|
||
end | ||
|
||
local function isOverChatbox() | ||
if INPUTFILTER:GetMouseX() > outputX-border and INPUTFILTER:GetMouseX() < outputX + outputWidth+border*2 and INPUTFILTER:GetMouseY() > outputY-border and INPUTFILTER:GetMouseY() < outputY + outputHeight+border*2 then | ||
return true | ||
end | ||
return false | ||
end | ||
|
||
|
||
local function scrollInput(event) | ||
if event.DeviceInput.button == "DeviceButton_tab" then | ||
if event.type == "InputEventType_FirstPress" then | ||
local pressingtab = true | ||
elseif event.type == "InputEventType_Repeat" then | ||
pressingtab = true | ||
elseif event.type == "InputEventType_Release" then | ||
local pressingtab = false | ||
end | ||
elseif event.DeviceInput.button == "DeviceButton_mousewheel up" and event.type == "InputEventType_FirstPress" then | ||
if isOverChatbox() then | ||
top:ScrollChatUp() | ||
else | ||
moving = true | ||
if pressingtab == true then | ||
whee:Move(-2) | ||
else | ||
whee:Move(-1) | ||
end | ||
end | ||
elseif event.DeviceInput.button == "DeviceButton_mousewheel down" and event.type == "InputEventType_FirstPress" then | ||
if isOverChatbox() then | ||
top:ScrollChatDown() | ||
else | ||
moving = true | ||
if pressingtab == true then | ||
whee:Move(2) | ||
else | ||
whee:Move(1) | ||
end | ||
end | ||
elseif moving == true then | ||
whee:Move(0) | ||
moving = false | ||
end | ||
end | ||
|
||
|
||
local t = Def.ActorFrame{ | ||
BeginCommand=function(self) | ||
top = SCREENMAN:GetTopScreen() | ||
whee = top:GetMusicWheel() | ||
top:AddInputCallback(scrollInput) | ||
end, | ||
} | ||
|
||
t[#t+1] = Def.Quad{ | ||
InitCommand=cmd(xy,inputX-border,inputY-border;zoomto,outputWidth+border*2,inputHeight+border*2;halign,0;valign,0;diffuse,color("#00000099");), | ||
TabChangedMessageCommand=function(self) | ||
local top= SCREENMAN:GetTopScreen() | ||
if getTabIndex() == 0 then | ||
self:visible(true) | ||
else | ||
self:visible(false) | ||
end | ||
end, | ||
} | ||
t[#t+1] = Def.Quad{ | ||
InitCommand=cmd(xy,outputX-border,outputY-border;zoomto,outputWidth+border*2,outputHeight+border*2;halign,0;valign,0;diffuse,color("#00000099");), | ||
TabChangedMessageCommand=function(self) | ||
local top= SCREENMAN:GetTopScreen() | ||
if getTabIndex() == 0 then | ||
self:visible(true) | ||
else | ||
self:visible(false) | ||
end | ||
end, | ||
} | ||
|
||
return t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.