vDevice – An module for getting user devices

vDevice

What makes this different from qDevice?

  • 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

What makes this different from PlatformProvider?

Thanks to @xChris_vC for bringing this up

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
Would you use this?
  • yes
  • no
  • later

0 voters

How would you rate this?
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

0 voters

Credits

to contribute you can either reply or join my group

13 Likes

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]

1 Like

Omg can I hire you as a icon designer for my personal projects!?!? The icon is sooo good! // sarcasm (sorry <3)

Also how is this better than qDevice? Won’t having more functions mean more usability and in turn meaning its better than any say “clone”.

2 Likes

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

1 Like

Okay okay okay. If so then how is this better than manually doing it?

Its not too hard to type GuiService:IsTenFootInterface(). or UIS.VREnabled or UIS.KeyboardEnabled, is it?

Its also not too hard to see if a device is a tablet or mobile and I highly doubt anyone would do that.

Same goes for ConsoleType, unless your trying to show that said player is on console, tablet, mobile, pc bla bla bla bla.

Same goes for the :GetOrientation() function as IMO see no game using that.

But I guess some people aren’t as messy as me so whateva’.

2 Likes

I will update it based on your reply, but I will make an script archive

1 Like

Did it work? I don’t see my picture changed.

Yep, thanks! Bye vsc, cya later.

Pretty much this module will save some time, nice job.

what

1 Like

Someone was posting NSFW photos in random categories and we flagged a lot until the mods did something

2 Likes

Amazing module, I agree that less functions is better. Also how do you make the GET IT ON ROBLOX button?

I didn’t make it, @cxmeels or Cameron did, Here is the gist

1 Like

i can make a better icon

3 Likes

Nah bro I’d win

4 Likes

Is that wrong? Maybe you’re wrong.

1 Like

Is that right? Maybe you’re right.
External Media

Why are you fighting about the logo?

@TimeFrenzied wins

1 Like

This logo is getting progressively overcomplicated

Btw u can use mine for the plugin if u want

Oh u already did lol

Someone is gonna one up me in about an hour anyway and im gonna have to make a better one because logo war mentality

1 Like

I remember back at november, I was being harsh about a plugin’s logo because it was taken from google

1 Like

I’d probably do the same thing present day, I mean, thats sorta like taking someone else’s work

But nobody really cares since its just a plugin lol

1 Like