This is a simple project that will change the viewable/clickable area to that of another ios device. Just add this as a dependency and add this global at the top of Main:
DEVICE = "iPhone4"
--DEVICE can be iPhone3, iPhone4, iPhone5, iPad, iPadRetina
Code:
--# Main
-- Universal
-----------------------------------------------------------------
--Add DEVICE = "NAME" as a global to your project. At the top of Main.
--Where NAME can be set to iPhone3,iPhone4,iPhone5,iPad,iPadRetina
------------------------------------------------------------------
DEVICE = "iPhone4"
function setup()
displayMode(FULLSCREEN)
end
function draw()
background(0, 0, 0, 255)
spriteMode(CORNER)
sprite("SpaceCute:Background",0,0,WIDTH,HEIGHT)
end
function touched(touch)
print("Touched")
end
--# BootStrap
-- bootstrap
local o_setup
local o_draw
local o_orientationChanged
local o_Width
local o_Height
local o_touched
------------------------
--Create Bootstrap
-------------------------
debug.sethook(function(e)
if setup and DEVICE then
debug.sethook()
o_setup = setup
o_draw = draw
if touched then
o_touched = touched
else
o_touched = function() end
end
o_Width = WIDTH
o_Height = HEIGHT
if orientationChanged then
o_orientationChanged = orientationChanged
else
o_orientationChanged = function() end
end
setup = function()
iDevice.load()
o_setup()
iDevice.load()
end
draw = function()
o_draw()
iDevice.draw(o_Width,o_Height)
end
orientationChanged = function()
iDevice.changed()
o_orientationChanged()
end
touched = function(touch)
if touch.x > WIDTH or touch.y > HEIGHT then
--do nothing
else
o_touched(touch)
end
end
end
end, "r")
--# iDevice
iDevice = {iPhone3 = {Portrait = vec2(320,480),Landscape = vec2(480,320)},
iPhone4 = {Portrait=vec2(640,960),Landscape=vec2(960,640)},
iPhone5 = {Portrait=vec2(640,1136),Landscape=vec2(1136,640)},
iPad= {Portrait =vec2(768,1024),Landscape=vec2(1024,768)},
iPadRetina = {Portrait=vec2(1536,2048),Landscape=vec2(2048,1536)}
}
iDevice.load = function()
local orient
local device = DEVICE
if CurrentOrientation == LANDSCAPE_LEFT or CurrentOrientation == LANDSCAPE_RIGHT then
orient = "Landscape"
else
orient = "Portrait"
end
WIDTH = iDevice[device][orient].x
HEIGHT = iDevice[device][orient].y
end
iDevice.draw = function(w,h)
pushStyle()
fill(162, 162, 162, 255)
noStroke()
rect(0,HEIGHT,h,h)
rect(WIDTH,0,h,h)
popStyle()
end
iDevice.changed = function()
iDevice.load()
end