Posted: 22nd Nov 2021 23:58
Hi,

If I run the following code:
+ Code Snippet
Global DeviceName$

Global SBL, SBT, SBR, SBB // SCREEN BOARDER VARIABLES

Global DW, DH  // DEVICE WIDTH AND HEIGHT VARIABLES
Global DDPI

SBL = GetScreenBoundsLeft()   // LEFT BOARDER
SBT = GetScreenBoundsTop()    // TOP BOARDER
SBR = GetScreenBoundsRight()  // RIGHT BOARDER
SBB = GetScreenBoundsBottom()  // BOTTOM BOARDER

DW = GetDeviceWidth()
DH = GetDeviceHeight()

DDPI = GetDeviceDPI()

DeviceName$ = GetDeviceBaseName()

do
    
	DeviceMenuSize()
    Print(DeviceName$)
    
	Print( ScreenFPS() )
    Sync()
loop


Function DeviceMenuSize()
	
	If DeviceName$ = "iPhone" Or "android"
		
		    DrawBox(SBL, SBT, SBR, SBB, MakeColor(10, 0, 150),	 MakeColor(10, 0, 150), MakeColor(10, 0, 150), MakeColor(10, 0, 150), 1)
		Else
			DrawBox(SBL - 50, SBT - 50, SBR - 50, SBB- 50, MakeColor(10, 0, 150),	 MakeColor(10, 0, 150), MakeColor(10, 0, 150), MakeColor(10, 0, 150), 1)
	
	Endif		

EndFunction


I get this error:

main.agc:57: error: Incompatible types "Integer" and "String"

I can't figure out why

If I take the "android" out it compiles fine, maybe I need to check for each one seperately?
Posted: 23rd Nov 2021 0:20
You should replace line 33, If DeviceName$ = "iPhone" Or "android" in your snippet with If DeviceName$ = "iPhone" Or DeviceName$ = "android". It should work then.
Posted: 23rd Nov 2021 0:20
kinda:
+ Code Snippet
 If DeviceName$ = "iPhone" Or DeviceName$ = "android"
Posted: 23rd Nov 2021 1:35
"


Thank you JosephB

Thank you Virtual Nomad
Changing the code to what both of you suggested worked
Posted: 23rd Nov 2021 11:50
I have a function setup for detecting device and setting the resolution (among other things) so I can just test things without changing any code, simple but effective

+ Code Snippet
Function IsDeviceType(a$, b$, c$) 
	x$ = GetDeviceBaseName()
	if (a$ = x$) or (b$ = x$) or (c$ = x$)
		ExitFunction 1
	endif
EndFunction 0
 
if IsDeviceType("ios", "android", "")
	SetVirtualResolution(960, 540)
elseif IsDeviceType("windows", "mac", "linux")
	SetWindowSize(1024, 768, 0)
	SetVirtualResolution(1024, 768)
elseif IsDeviceType("html5", "", "")
	SetVirtualResolution(800, 600)
endif
Posted: 23rd Nov 2021 12:02
@PTC
You can simplify that code with select...case and do it all inside a single function call
+ Code Snippet
function SetScreen()
	select GetDeviceBaseName()
		case "ios", "android"
			SetVirtualResolution(960, 540)
		endcase
		case "windows", "mac", "linux"
			SetVirtualResolution(1024, 768)
			SetWindowSize(1024, 768, 0)
		endcase
		case "html5"
			SetVirtualResolution(800, 600)
		endcase
	endselect
endfunction
Posted: 23rd Nov 2021 15:14
I know, but ...

(among other things)


Posted: 24th Nov 2021 4:29
Thank you Scraggle and PartTimeCoder, I'll give both of your snippets a try