Archive for 'Png'

Getting Bounds of an Display Object in corona sdk

you can get the display object bounds using object.contentBounds

Example:

Incoming search terms:

  • corona sdk content bounds
  • corona sdk xMax

For performing a dissolve transition, we need two images

–second image

A simple code snippet in corona for drag and drop

A simple code snippet in corona  for drag and drop:

local function onTouch( event )

local t = event.target
local phase = event.phase

if “began” == phase then

t.isFocus = true
t.x0 = event.x – t.x
t.y0 = event.y – t.y

elseif t.isFocus then

if “moved” == phase then

t.x = event.x – t.x0
t.y = event.y – t.y0

elseif “ended” == phase or “cancelled” == phase then

display.getCurrentStage():setFocus( nil )
t.isFocus = false
t.setFillColor( 0, 255, 0 )

end
end

return true

end

local function onComplete( event )
print “Completed”
end

local rect = display.newRect( 50, 50, 100, 100)
rect:setFillColor( 255, 0, 0 )
rect:addEventListener( “touch”, onTouch )

local circle = display.newCircle(100, 70, 30)
circle:setFillColor( 0, 255, 0 )
circle:addEventListener( “touch”, onTouch )

local abc = display.newImage(“button.png”)
abc.x = display.contentWidth / 2
abc.y = display.contentHeight / 2

abc:addEventListener( “tap”, abc )

function abc:tap( event )
print “button clicked”
end

Incoming search terms:

  • drag and drop corona
  • corona drag and drop example
  • corona drag button
  • simple drag and drop image in android with example
  • ejemplo drag and drop android
  • drang and drop sample games for corona
  • drag drop corona
  • drag and drop corona code
  • Corona Drag ps
  • simple drag and drop in corona

Convert UIImage to NSData

Incoming search terms:

  • NSData *dataObj = UIImageJPEGRepresentation(img 1 0);
  • writetofile
  • writeToFile encoding nsstring

Creating Body in Corona

It is useful,if we make an objects into a group. so that we can easily add and remove the objects from a group and it will not affect other objects.The following code will add the objects into a group.

Incoming search terms:

  • corona sdk remove object from group

Adding body to the image in corona sdk

We can add body to an image using the following code

enabling retina display mode in corona sdk

for enabling retina display in corona add the following lines in config.lua

and include images with twice and 1.5 larger than the original and named as image-x2.png and image-x15.png in the project folder

Incoming search terms:

  • corona sdk forums retina display

Enabling Retina Display mode

You should enable RetinaDisplay mode ONLY if you want to use HighRes images on an iPhone4. Remember that an iPhone4 also works in “low res” mode.

// Add this code in your Application Delegate, right after initializing the director

then keep both normal and hd images (with extension image-hd.png).

Incoming search terms:

  • check uiimage size kb iphone
  • fileattributesatpath in magento
  • how to get a file size programmatically in ios
  • ipad image path programmatically
Page 2 of 41234