Lightweight - Has only 4 functions and 4 properties while for qDevice, it has 12 functions [13 in experimental]
Properties - Instead of having just functions, it also contains properties
Enum-Based - The functions return Enum instead of string but for qDevice, It mainly returns string, but one returns Enum.ScreenOrientation because of a suggestion
IMPORTANT: I AM NOT SAYING THAT THIS IS BETTER THAN QDEVICE, YOU CAN USE WHATEVER YOU WANT, I DON’T CARE IF YOU’RE NOT GOING TO USE THIS
that module is just one function and two properties, but this has more features than PlatformProvider
Source Code
Since the module is only 59 lines long, Here is the attached source code
Source Code
--[[
vDevice
@TimeFrenzied - icon
@RobIoxArenaEvents - idea, methods and name
@VSCPlays - module
]]
local GuiService = game:GetService("GuiService")
local UserInputService = game:GetService("UserInputService")
local screenSize = workspace.CurrentCamera.ViewportSize
local vDevice = {}
function vDevice:GetOrientation()
return (screenSize.X > screenSize.Y and Enum.ScreenOrientation.LandscapeSensor) or Enum.ScreenOrientation.Portrait
end
function vDevice:GetConsoleType()
if vDevice.isConsole then
local buttonA = UserInputService:GetStringForKeyCode(Enum.KeyCode.ButtonB)
if buttonA == "ButtonB" then
return Enum.Platform.XBoxOne
elseif buttonA == "ButtonCircle" then
return Enum.Platform.PS4
end
end
return Enum.Platform.None
end
function vDevice:IsMobile()
if UserInputService.TouchEnabled and UserInputService.GyroscopeEnabled and UserInputService.AccelerometerEnabled then
if not vDevice.isPC and vDevice.isConsole or vDevice.isVR then
return true
end
end
return false
end
function vDevice:GetMobileType()
if vDevice:IsMobile() then
if vDevice:GetOrientation() == Enum.ScreenOrientation.LandscapeSensor then
return (screenSize.X < 600 and Enum.DeviceType.Phone) or Enum.DeviceType.Tablet
elseif vDevice:GetOrientation() == Enum.ScreenOrientation.Portrait then
return (screenSize.Y < 600 and Enum.DeviceType.Phone) or Enum.DeviceType.Tablet
end
end
return Enum.DeviceType.Unknown
end
vDevice.isConsole = GuiService:IsTenFootInterface()
vDevice.isVR = UserInputService.VREnabled
vDevice.isPC = (not vDevice.isVR or vDevice.isConsole or vDevice:IsMobile())
vDevice.PController = (vDevice.isPC and UserInputService.GamepadEnabled)
return vDevice
Apologies if the icon is bad, I honestly do suck at drawing by mouse and this is drawn by mouse, I am better at drawing in iPad than in Laptop
also I’d thank Cameron [@cxmeels] for the “GET IT ON ROBLOX” button, and break-core [@RobIoxArenaEvents] for the idea, also MiaGobble [@iGottic] motivated me by his own reply, below this text is not written by me
I see myself using this over others now since I don’t use the extra functionality of external libraries and prefer a straightforward approach to set up a game with ease.
also this is posted while someone was posting NSFW pictures in the developer forum and exposing it to everyone, hopefully you survived it [which I did]
I kind of disagree. Take a look at TopbarPlus for example, It has a ton of functions that almost no one uses, so UIShelf was created to solve that issue
also more features = more performance impacted soo yep