Skip to content

Commit

Permalink
force app to bottom on csp 023+
Browse files Browse the repository at this point in the history
  • Loading branch information
C1XTZ committed Jul 24, 2024
1 parent 8dfb0d3 commit 1d131db
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mobilephone/manifest.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[ABOUT]
NAME = Mobilephone
AUTHOR = C1XTZ, CheesyManiac
VERSION = 1.6
VERSION = 1.61
DESCRIPTION = A phone that displays ingame chat, time and the current song.

[WINDOW_...]
Expand Down
23 changes: 22 additions & 1 deletion mobilephone/mobilephone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ local settings = ac.storage {
chatKeepSize = 50,
chatOlderThan = 15,
chatScrollSpeed = 2,
forceBottom = true,
}

local spaceTable = {}
Expand Down Expand Up @@ -628,6 +629,19 @@ function updateTime()
if settings.badTime then time.final = convertTime(time.final) end
end

local appWindow = ac.accessAppWindow("IMGUI_LUA_Mobilephone_main")
local windowHeight, appBottom
function forceAppToBottom()
if not appWindow:valid() then return end

windowHeight = ac.getSim().windowHeight
appBottom = windowHeight - appWindow:size().y

if appWindow:position().y ~= appBottom and not ui.isMouseDragging(ui.MouseButton.Left, 0) then
appWindow:move(vec2(appWindow:position().x, appBottom))
end
end

--#endregion

--#region APP EVENTS
Expand Down Expand Up @@ -739,6 +753,12 @@ function script.windowMainSettings(dt)
end

ui.tabItem('Display', function()
if ac.getPatchVersionCode() >= 3044 then
if ui.checkbox('Force App to Bottom', settings.forceBottom) then settings.forceBottom = not settings.forceBottom end
else
settings.forceBottom = false
end

if ui.checkbox('Custom Color', settings.customColor) then
settings.customColor = not settings.customColor
if not settings.customColor then
Expand Down Expand Up @@ -942,9 +962,10 @@ end
local VecTR = vec2(app.padding.x, phone.size.y - phone.size.y - app.padding.y)
local VecBL = vec2(phone.size.x + app.padding.x, phone.size.y - app.padding.y)
function script.windowMain(dt)
if settings.forceBottom then forceAppToBottom() end
updateChatMovement(dt)

local phoneHovered = ui.rectHovered(0, app.size)
local phoneHovered = ui.windowHovered(ui.HoveredFlags.ChildWindows)
if (phoneHovered or chat.activeInput) then moveChatUp() end

if settings.notifSound or settings.joinNotifSound then
Expand Down

0 comments on commit 1d131db

Please sign in to comment.