PIXNET Logo登入

遊戲人生 人生遊戲

跳到主文

如果工作是玩樂就太好了

部落格全站分類:攝影寫真

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 5月 18 週三 201113:54
  • Corona object:addEventListener

object:addEventListener
Description:
Adds a listener to the object’s list of listeners. When the named event occurs, the listener will be invoked and be supplied with a table representing the event.
添加一個監聽對象的名單聽眾。當指定的事件發生時,監聽器將被調用,並提供與表代表事件。
Syntax:
object:addEventListener( eventName, listener )
Example:
Listeners can be either functions or table objects.
Listeners可以是函數或表對象。
When a function listener is invoked, it is passed a table representing the event:
當一個函數被調用監聽器,它是通過一個表代表事件:
----------------------
local myListener = function( event )
        print( "Listener called with event of type " .. event.name )
end
Runtime:addEventListener( "touch", myListener )
Runtime:addEventListener( "enterFrame", myListener )
-----------------------
Sometimes a function listener is not convenient because certain variables are not in scope when the listener is triggered (invoked). In these situations, object listeners should be used. Object listeners must have an instance method with a name corresponding to the event name:
有時候,一個函數監聽不方便,因為某些變量沒有範圍時,監聽器被觸發(調用)。在這種情況下,應使用對象聽眾。聽眾必須有一個對象實例的方法名稱與相應的事件名稱:
---------------------------------------------------
-- assume MyClass and MyClass:new() already exist 假設 MyClass and MyClass:new() 已經存在
 
function MyClass:enterFrame( event )
        print( "enterFrame called at time: " .. event.time )
end
 
function MyClass:touch( event )
        print( "touch occurred at ("..event.x..","..event.y..")" )
end
 
local myObject = MyClass:new()
 
Runtime:addEventListener( "touch", myObject )
Runtime:addEventListener( "enterFrame", myObject )
---------------------------------------------------
Parameters:
eventName
String specifying the name of the event to listen for.
字串指定名稱的事件監聽。
listener
If the event's event.name matches this string, listener will be invoked. Event listeners are either functions or objects (a.k.a. table listeners).
如果事件的event.name匹配此字符串,監聽器將被調用。事件監聽器是函數或對象(又稱表位聽眾)。
Returns:
Nothing.
Remarks:
Note: You cannot add an object event listener within the listener event for that object. You should add the listener event outside of the current listener using the timer.performWithDelay() API. Failing to do so will cause the new listener to be called immediately after the current listener returns.
注意:您不能添加一個事件監聽器對象在監聽事件的對象。你應該加入目前監聽器以外的事件監聽器,目前使用timer.performWithDelay()的API。如果不這樣做將導致新的監聽器被稱為當前監聽後立即返回。
Another solution to the problem is using a single event listener for the object and adding a "state" variable to control what function is performed when invoked.
另一種解決問題的辦法是使用一個單獨的事件偵聽器對象,並增加了"狀態"變量來控制函數執行時調用。
--------------------------------
local addListener1, addListener2        -- forward references
 
-- create a large button
local rect = display.newRect( 0, 0, display.contentWidth, display.contentHeight )
rect:setFillColor( 128, 64, 64 )
 
-- state1
function state1Cb( event )
    print("state1")
    rect:removeEventListener( "tap", state1Cb )
    --rect:addEventListener( "tap", state2Cb )  -- ** Don't do this
    timer.performWithDelay( 1, addListener2 )   -- ** Do this instead
    return true   
end
 
-- state2
function state2Cb( event )
    print("state2")
    rect:removeEventListener( "tap", state2Cb )
    --rect:addEventListener( "tap", state1Cb )  -- ** Don't do this
    timer.performWithDelay( 1, addListener1 )   -- ** Do this instead
    return true   
end
 
function addListener2( )
    rect:addEventListener( "tap", state2Cb )
end
 
function addListener1()
    rect:addEventListener( "tap", state1Cb )
end
 
-- start
addListener1()  -- add first listener
------------------------------------------
Supported on operating systems and platforms for build numbers shown:
Mac OS X:Corona SDK 1.0
Windows: Corona SDK 2.0
iOS: Corona SDK 1.0
Android: Corona SDK 2.0
Related:
(繼續閱讀...)
文章標籤

createps 發表在 痞客邦 留言(0) 人氣(284)

  • 個人分類:Corona
▲top
  • 5月 18 週三 201113:39
  • Corona event.phase事件階段

event.phase事件階段
Description:
Specifies the collision phase and can be one of the following values:
指定碰撞階段,可以是以下值:
"began" -- Indicates a collision between two bodies has started initial contact.
"ended" -- Indicates a collision between two bodies has completed.
“開始“- 表示這兩個機構之間的碰撞已經開始初步接觸。
“結束“- 表示這兩個機構之間的碰撞已經完成。
Syntax:
event.phase
Example:
--------------------------------
local crate1 = display.newImage( "crate.png", 100, 200 )
physics.addBody( crate1, { density = 1.0, friction = 0.3, bounce = 0.2 } )
crate1.myName = "first crate"
 
local crate2 = display.newImage( "crate.png", 100, 120 )
physics.addBody( crate2, { density = 1.0, friction = 0.3, bounce = 0.2 } )
crate2.myName = "second crate"
 
local function onCollision( event )
        if ( event.phase == "began" ) then
 
                print( "began: " .. event.object1.myName .. " & " .. event.object2.myName )
 
        elseif ( event.phase == "ended" ) then
 
                print( "ended: " .. event.object1.myName .. " & " .. event.object2.myName )
 
        end
end
 
Runtime:addEventListener( "collision", onCollision )
---------------------------------
Parameters:
None.
Returns:
Nothing.
Remarks:
Note: The objects involved in the collision should not be removed or any of it's properties altered during a collision event. You should use timer.performWithDelay() if they want to modify object position values or other properties within the collision events.
注:參與的對象碰撞不應刪除或它的任何屬性的改變在發生碰撞時。您應該使用timer.performWithDelay()如果他們想修改對象位置值或其他財產在碰撞事件。
Removing the object or modifying the properties in the collision event could cause the simulator to crash.
刪除或修改對象的屬性在發生碰撞時可能會導致模擬器崩潰。
Supported on operating systems and platforms for build numbers shown:
Mac OS X:Build 2010.222
Windows: Build 2010.222
iOS: Build 2010.222
Android: Build 2010.222
Related:
(繼續閱讀...)
文章標籤

createps 發表在 痞客邦 留言(0) 人氣(134)

  • 個人分類:Corona
▲top
  • 5月 17 週二 201122:25
  • Corona physics.addBody

physics.addBody()
Description:
Allows you to turn any Corona display object into a simulated physical object with one line of code, including the assignment of physical properties.
可讓您在任何顯示對象Corona成模擬的物理對象一行代碼,包括分配的物理特性。
If no shape information is specified, then the body boundaries will snap to the rectangular boundaries of the display object used to create the physics body.
如果沒有指定形狀的信息,然後身體邊界將捕捉到的矩形邊界的顯示對象,用於創建物理身體。
If a radius is specified, then the body boundaries will be circular, centered at the middle of the display object used to create the physics body.
如果指定的半徑,那麼身體邊界將被通知,集中在中間的顯示對象,用於創建物理身體。
If a shape is specified, then the body boundaries will follow the polygon provided by the shape. Note that the maximum number of sides per shape is eight, and all angles must be convex. (Specifying a shape will override the radius property, if both radius and shape are specified in the same element.)
如果指定了一個形狀,然後身體邊界將按照所提供的多邊形形狀。請注意,每邊最多的形狀是八,所有的角度必須是凸起。 (指定的形狀將覆蓋半徑屬性,如果兩個半徑和形狀相同的元素中指定。)
A body shape is simply a table of local (x,y) coordinates, relative to the center of the display object; see example below.
一個身材只是一個表地方(的x,y)坐標,相對於中心的顯示對象,見下面的例子。
Finally, a more complex body may be constructed by specifying multiple body elements and shapes. In cases where the overall shape of the object is concave, or the shape has more than eight sides, you can use multiple body elements to construct it.
最後,一個更複雜的身體構造,可通過指定多個體元素和形狀。在情況下,整體造型的對象是凹的,或形狀有超過八個方面,可以使用多種元素來構造它的身體。
Each body element may have its own physical properties, and the body element index is reported as part of each collision event -- so it is possible to detect which part of a complex body was involved in a collision.
每個 body元素可以有自己的物理性質,和身體元素的索引報導的一部分,每一個碰撞事件- 因此它可以檢測哪部分是一個複雜的機構參與了衝突。
For further information, see Physics Bodies.
如需進一步信息,請參閱物理機構。
Syntax:語法
physics.addBody(object, [bodyType,] {density=d, friction=f, bounce=b [,radius=r]})
physics.addBody(object, [bodyType,] {density=d, friction=f, bounce=b [,shape=s]})
-- For a complex body (multiple body elements) 對於一個複雜的身體(身體多個元素)
 
physics.addBody(object, [bodyType,]
   {density=d1, friction=f1, bounce=b1, shape=s1},
   {density=d2, friction=f2, bounce=b2, shape=s2},
   {density=d3, friction=f3, bounce=b3, shape=s3}
)
----------------------------------
Example:
Default (rectangular) bodies
local physics = require( "physics" )
physics.start()
 
local sky = display.newImage( "bkg_clouds.png" )
sky.x = 160; sky.y = 195
 
local ground = display.newImage( "ground.png" )
ground.x = 160; ground.y = 445
 
physics.addBody( ground, "static", { friction=0.5, bounce=0.3 } )
 
local crate = display.newImage( "crate.png" )
crate.x = 180; crate.y = -50; crate.rotation = 5
 
physics.addBody( crate, { density=3.0, friction=0.5, bounce=0.3 } )
Circular bodies
local ball = display.newImage("ball.png")
 
physics.addBody( ball, { density = 1.0, friction = 0.3, bounce = 0.2, radius = 25 } )
Polygon bodies
local pentagon = display.newImage("pentagon.png")
 
pentagonShape = { 0,-37, 37,-10, 23,34, -23,34, -37,-10 }
 
physics.addBody( pentagon, { density=3.0, friction=0.8, bounce=0.3, shape=pentagonShape } )
------------------------------------------------
Parameters:
object
object: A display object.
bodyType
string: The body type may be specified in an optional string parameter before the first body element. The possible types are “static”, “dynamic” and “kinematic”, and the default type is “dynamic” if no value is specified.
字串:身型,可以在一個可選的字符串參數在第一個 body元素。可能的類型是“靜態“,“動態”和“運動“,而默認類型是“動態“如果沒有指定值。
density 密度
number: Multiplied by the area of the body’s shape to determine mass. Based on a standard value of 1.0 for water. Lighter materials (such as wood) have a density below 1.0, and heavier materials (such as stone) have a density greater than 1.0. Default value is 1.0.
數值:乘以面積身體的形狀,以確定質量。基於對標準值1.0的水。更輕的材料(如木材)的密度小於 1.0,和重的材料(如石頭)有密度大於1.0。默認值是1.0。
friction
number: May be any non-negative value; a value of 0 means no friction and 1.0 means fairly strong friction. The default value is 0.3.
摩擦力
數值:可以是任何非負價值;值0意味著沒有摩擦,1.0表示比較強烈的摩擦。默認值是0.3。
bounce
number: Determines how much of an object’s velocity is returned after a collision. The default value is 0.2.
彈跳
數值:確定一個物件的速度發生碰撞後返回的值。默認值是0.2,數字越小,彈跳越小
radius半徑
number: Radius of the bounding circle.
數值:圓的半徑邊界。
shape
number: Shape value in the form of a table with the shape vertices, {x1,y1,x2,y2,...,xn,yn}. For example: squareShape = { -20,-10, 20,-10, 20,10, -20,10 }
形狀
數值:形狀值表的形式與形狀頂點,{x1,y1,x2,y2,...,xn,yn}。例如:squareShape={-20,-10,20,-10,20,10,-20,10}
Returns:
None
沒有回傳值
Remarks:
Supported on operating systems and platforms for build numbers shown:
備註:
支持的操作系統和平台,建立數字所示:
Mac OS X:Build 2010.222
Windows: Build 2010.222
iOS: Build 2010.222
Android: Build 2010.222
(繼續閱讀...)
文章標籤

createps 發表在 痞客邦 留言(0) 人氣(174)

  • 個人分類:Corona
▲top
  • 5月 17 週二 201117:19
  • Corona Physics Joints 物理節點

Physics Joints 物理節點
Joints節點的
Joints are used to assemble more complex game objects from multiple rigid bodes. For example, joints would be used to join the limbs of a ragdoll figure, or the wheels of a car.
接頭是用來組裝更複雜的遊戲對象從多個剛性好兆頭。例如,將用於關節四肢加入一個布娃娃形象,或者是輪子的汽車。
Box2D includes a number of different joint types, each with different parameters and functions. Some joint types can be powered by motors, and others are subject to various physical restrictions in their ranges of motion.
Box2D中包括了一些不同類型的聯合,每一個不同的參數和功能。一些合資類型可以由電動機驅動,和其他人受到各種物理限制其活動範圍的議案。
The simplest joint type is the “pivot” joint, which joins two objects at a single pivot point, and is illustrated in the “Bridge” and “Chains” sample projects.
最簡單的聯合,一種是“支點“的聯合,它連接兩個對象在一個單一的支點,並體現在“Bridge“和“Chains“樣本項目。
To construct a joint, first construct the bodies that will be joined, and then submit those bodies to the desired joint constructor function.
要構造一個關節,首先構造的機構將被加入,然後提交這些機構所需的關節構造函數。
Pivot joint樞軸接頭
A pivot joint (also known as a “revolute joint” in Box2D terms) joins two bodies at an overlapping point. The initial arguments are the two bodies joined, followed by an anchor point in the global coordinates of the world.
一個支點聯合(也稱為“旋轉關節“在Box2D計算)連接兩個機構在一個重疊點。最初的參數是兩個機構的加盟,其次是錨點在全球坐標世界。
Pivot joints can optionally be constrained in their range of rotation. For example, if constructing a “ragdoll” figure, the head/neck joint would have a limited range of angular motion.
樞軸接頭可以選擇受限制的範圍內旋轉。例如,如果構建一個“布娃娃“的人物,頭部/頸部的聯合將有一個有限的範圍內的角運動。
----------------------
myJoint = physics.newJoint( "pivot", crateA, crateB, 200,300 )
-----------------------
Joint motors 聯合馬達
myJoint.isMotorEnabled -- (boolean)
myJoint.motorSpeed
myJoint.motorTorque  -- (get-only)
myJoint.maxMotorTorque  -- (set-only)
By default, joint motors have a fairly weak maximum torque, and therefore setting motorSpeed may appear to have little visible effect. Therefore, you should generally set maxMotorTorque to a high value (such as 100000) if you are trying to move any significant mass, such as rotating a wheel to power a car.
默認情況下,聯合電機有一個比較脆弱的最大扭矩,因此設置 motorSpeed​​可能似乎沒有什麼明顯的影響。因此,你應該設置 maxMotorTorque一般為較高的值(如100000),如果你試圖移動任何重大質量,如旋轉的輪子來驅動汽車。
Rotation limits旋轉限制
Pivot joints can optionally be constrained in their range of rotation. For example, if constructing a "ragdoll" figure, the head/neck joint would have a limited range of angular motion. These rotation limits are specified in degrees:
樞軸接頭可以選擇受限制的範圍內旋轉。例如,如果構建一個“布娃娃“的人物,頭部/頸部的聯合將有一個有限的範圍內的角運動。這些限制指定旋轉度:
---------------------------
myJoint.isLimitEnabled = true -- (boolean)
 myJoint:setRotationLimits( -45, 45 )
a1, a2 = myJoint:getRotationLimits()
--------------------------
Other attributes: 其它屬性
-------------------
myJoint.jointAngle -- (get-only; value in degrees)
myJoint.jointSpeed -- (get only; value in degrees per second)
-------------------
Distance joint距離聯合
A distance joint joins two bodies at a fixed distance. The initial arguments are the two bodies joined, followed by an (x,y) anchor point for each body. Anchor points are declared in the world coordinates.
加入聯合的距離兩個機構在一個固定的距離。最初的參數是兩個機構的加盟,其次是從(x,y)的定位點為每個機構。錨點宣布在世界上的坐標。
-----------------------
myJoint = physics.newJoint( "distance", crateA, crateB, crateA.x,crateA.y, crateB.x,crateB.y )
---------------------
Other attributes:其它屬性
myJoint.length
myJoint.frequency
myJoint.dampingRatio
length is the distance between the anchor points, which should not be zero or very short (you should use a pivot joint if you need to directly anchor one body to another).
長度是定位點之間的距離,不應是零或非常短(你應該使用一個樞軸接頭,如果您需要直接錨一體到另一個)。
frequency is the mass-spring damping frequency (in Hz)
頻率是質量彈簧阻尼頻率(赫茲)
dampingRatio ranges from 0, for no damping, to 1, for critical damping.
dampingRatio範圍為0,沒有阻尼,為 1,臨界阻尼。
Piston joint活塞聯合
A piston joint (also known as a “prismatic joint” in Box2D terms) joins two bodies along a single, restricted axis of motion, like the pistons or a shock absorber in a car. The initial arguments are the two bodies joined, followed by an anchor point in the first body and a vector defining the axis along which motion is allowed.
一個活塞聯合(也稱為“棱柱聯合“在Box2D計算)沿著連接兩個機構單一,限制軸的運動,如活塞或在汽車減震器。最初的參數是兩個機構的加盟,其次是錨點在首體與向量定義軸沿此議案是允許的。
-----------------------------
myJoint = physics.newJoint( "piston", crateA, crateB, crateA.x,crateA.y, axisDistanceX,axisDistanceY )
(Note: at least one of the bodies should be dynamic, with non-fixed rotation.)
-----------------------------
Joint  motors聯合馬達
A piston joint may also be driven by a motor. Unlike the pivot joint, this motion will be linear, along the specified axis, rather than rotational.
一個聯合也可能是活塞驅動電機。不同的是樞軸接頭,這項議案將是線性的,沿指定軸,而不是轉動。
-------------------------------------
myJoint.isMotorEnabled -- (boolean)
myJoint.motorSpeed -- (linear speed, in units of pixels per second)
myJoint.motorForce  -- (get-only)
myJoint.maxMotorForce  -- (set-only)
-------------------------------------
Motion limits極限運動
In addition, limits on its range of linear motion may be specified:
此外,它的範圍限制在直線運動可以指定:
-----------------------
myJoint.isLimitEnabled = true -- (boolean)
myJoint:setLimits( 100, 200 )
p1, p2 = myJoint:getLimits()
-----------------------
Other attributes:其它屬性
-------------------------------
myJoint.jointTranslation -- (get-only; linear value in pixels)
myJoint.jointSpeed -- (get only; value in pixels per second)
-------------------------------
Friction joint聯合摩擦
A friction joint is a special kind of pivot joint that resists motion, and is therefore “sticky”:
摩擦聯合是一種特殊類型的支點聯合抵制運動,因而是“粘“:
-------------------------
myJoint = physics.newJoint( "friction", crateA, crateB, 200,300 )
-------------------------
It exposes only two attributes:
它暴露了只有兩個屬性:
--------------------
myJoint.maxForce
myJoint.maxTorque
--------------------
Weld joint焊接接頭
A weld joint “welds” two bodies together at a specified point in world coordinates:
一個焊接接頭“焊接“兩個機構共同在一個指定的點在世界坐標:
------------------------
myJoint = physics.newJoint( "weld", crateA, crateB, 200,300 )
--------------------------
This joint does not move or rotate at all, and so it exposes no attributes.
However, due to mathematical approximation, this joint may appear slightly “soft” during motion, and so if you want to rigidly bond multiple shapes together, you may want to specify them as multiple body elements within a single complex body, rather than using weld joints.
這一聯合並不在所有移動或旋轉,因此它沒有公開的屬性。
然而,由於數學近似,這一聯合可能出現輕微的“軟”運動期間,因此如果你想多個形狀硬性粘結在一起,你可能要指定它們作為多體元素在一個複雜的機構,而不是用焊接頭。
Wheel joint輪子聯合
A wheel joint (also known as a “line joint” in Box2D terms) combines a piston and a pivot joint, like a wheel mounted on the shock absorber of a car. Most of its properties are inherited from the standard piston joint; the difference is that the body at the end of the axis is allowed to rotate freely.
一個輪聯合(也稱為“行聯合“在Box2D計算)結合了活塞和一個支點聯合,像一個車輪安裝在減震器的汽車。它的大部分特性都繼承自標準活塞關節;所不同的是,該機構在結束軸可以自由旋轉。
-------------------
myJoint = physics.newJoint( "wheel", crateA, crateB, crateA.x,crateA.y, axisDistanceX,axisDistanceY )
---------------------
Joint motors聯合馬達
Like a piston joint, the “shock absorber” portion of a wheel joint may be driven by a joint motor. This motion will be linear, along the specified axis, rather than rotational.
像活塞聯合,“減震器”輪聯合部分可能是由聯合汽車。這項議案將是線性的,沿指定軸,而不是轉動。
--------------------------
myJoint.isMotorEnabled -- (boolean)
myJoint.motorSpeed -- (linear speed, in units of pixels per second)
myJoint.motorForce  -- (get-only)
-- myJoint.maxMotorForce  -- (not currently supported in Box2D library; known bug)
----------------------------
Motion limits極限運動
In addition, limits on its range of linear motion may be specified:
此外,它的範圍限制在直線運動可以指定:
-----------------
myJoint.isLimitEnabled = true -- (boolean)
myJoint:setLimits( 100, 200 )
p1, p2 = myJoint:getLimits()
----------------------------
Other attributes:
-----------------------
myJoint.jointTranslation -- (get-only; linear value in pixels)
myJoint.jointSpeed -- (get only; value in pixels per second)
--------------------------
Pulley joint 滑輪聯合
A pulley joint attaches two bodies with an imaginary rope whose length remains constant: if one body is pulled down, the other one will move up.
滑輪兩個機構聯合重視與一個假想的繩子的長度保持不變:如果一個人身體拉下來,其他人會向上移動。
This constructor is a bit complicated, because it must specify a joint anchor point within each body, and also a stationary anchor point in world coordinates for each side of the “rope” to hang from. Finally, there is a “ratio” property to optionally simulate a block and tackle arrangement, in which one side of the rope moves faster than the other. By default, this ratio is 1.0, which simulates a simple pulley.
此構造是一個有點複雜,因為它必須指定一個聯合機構在每個定位點,也是一個固定的定位點在世界坐標,每一方的“繩索“,以懸掛。最後,有一個“比“屬性有選擇地模擬塊和解決的安排,其中一側的繩索移動速度比其他。默認情況下,這個比例是1.0,它模擬一個簡單的滑輪。
-------------------------
myJoint = physics.newJoint( "pulley", crateA, crateB, anchorA_x,anchorA_y, anchorB_x,anchorB_y, crateA.x,crateA.y, crateB.x,crateB.y, 1.0 )
-------------------------
It exposes the following read-only attributes:
它暴露了以下只讀屬性:
myJoint.length1 -- (get-only; value in pixels)
myJoint.length2 -- (get-only; value in pixels)
myJoint.ratio -- (get-only)
----------------------------
Touch joint觸摸聯合
A touch joint (based on the Box2D “mouse joint”) connects a single object to the current position of an onscreen touch. This connection is an elastic joint with specifiable strength and behavior, but since it is impossible to apply infinite forces to the simulation, the dragged object may "lag behind" a rapidly moving touch. However, this method allows far more realistic behavior than the non-physical drag method demonstrated in the earlier "DragPlatforms" sample.
一個觸摸聯合(基於 Box2D的“鼠標聯合“​​)連接一個對象到目前位置屏幕上的觸摸。這種連接是一種具有彈性關節可指定的力量和行為,但因為它是無窮的力量無法適用於模擬,拖動的對象可能“落後“快速移動的接觸。然而,這種方法允許更為現實的行為比非物理拖動方法表現在早期的“DragPlatforms“樣本。
For an example of touch joints, including their use with multitouch, see the "DebugDraw" sample code.
舉個例子觸摸關節,包括他們使用多點觸控,看到“DebugDraw“示例代碼。
--------------------
myJoint = physics.newJoint( "touch", crate, targetX,targetY )
(繼續閱讀...)
文章標籤

createps 發表在 痞客邦 留言(0) 人氣(401)

  • 個人分類:Corona
▲top
  • 5月 17 週二 201115:03
  • Corona Configuration Options 配置選項

Configuration Options配置選項
Corona projects may be configured with two optional files: config.lua and build.settings, each of which use Lua table syntax and should be located in the project directory. The build.settings file contains instructions for the build process, and config.lua is compiled into your project and accessed at runtime.
Corona項目可能配置了兩個可選文件:config.lua和build.settings,每個表使用Lua語法和應位於項目目錄。該文件包含指令build.settings生成過程,並 config.lua編譯到你的項目和訪問在運行時。
Runtime Configuration: config.lua
運行時配置:config.lua
Several runtime properties can be specified in a config.lua file, which can be included in the project directory. This section discusses the currently available options.
幾個運行時屬性可以指定在一個 config.lua文件,它可以包含在項目目錄。本節討論了目前可用的選項。
Dynamic Content Scaling
動態內容縮放
(For a detailed introduction to this feature, see this blog post.)
(有關詳細介紹了這個功能,看到這個博客帖子。)
Content scaling features are useful for multi-screen development. For example, iPhone projects designed for a 320 pixel wide screen can be upscaled to the 480 pixel wide screen on Android devices, making porting much easier, since code and assets do not need to be revised.
內容縮放功能是有用的多屏的發展。例如,iPhone的項目設計為320像素寬屏幕可放大的480像素的寬屏幕Android設備,使移植容易得多,因為代碼和資產並不需要加以修訂。
Also, Corona now targets iOS 4.0 in iPhone builds (while remaining iOS 3.0-compatible). This means that pre-iPhone 4 content will no longer upscale automatically to the larger iPhone4 screen resolution. As a result, content scaling will generally be required in new iPhone apps.
此外,現在的目標的iOSCorona在iPhone4.0版本(而其餘的iOS3.0兼容)。這意味著,前iPhone4內容將不再自動高檔大iPhone4屏幕分辨率。因此,內容比例一般都需要在新的iPhone應用程序。
The basic idea behind dynamic content scaling is that you can tell Corona that your content was originally authored for a particular screen size. Then you can choose how your app should be scaled if it runs on a device whose physical screen size is different from the original.
背後的基本思想動態內容縮放是你可以告訴您的內容Corona最初創作的一個特定的屏幕尺寸。然後你可以選擇你的程序應該如何縮放,如果它運行在一個物理設備,其屏幕尺寸從原來的有所不同。
To activate dynamic content scaling, create a config.lua file (see below) and use a scale other than "none", as shown below.
要激活動態內容縮放,創建一個 config.lua文件(見下文),並使用其他的規模比“無“,如下圖所示。
Example:
-------------------------------
application =
{
        content =
        {
                width = 320,
                height = 480,
                scale = "letterbox"
        },
} 
-----------------------
Note 注意:
If you are building an application to run on a single device then it is not necessary to specify any content height, width, or scaling options.
如果您正在構建一個應用程序運行在一台設備則沒有必要指定任何內容的高度,寬度或縮放選項。
If your application does support running on devices with different screen dimensions, the width and height MUST be the value of the target device in portrait orientation. 
如果您的應用程序不支持的設備上運行的不同屏幕尺寸,寬度和高度必須是價值目標設備在縱向方向。
These values are not dependent on the orientation mode of your application. If your app runs in landscape mode, you still set these values to the portrait width and height. 
這些值不依賴於你的應用方向模式。如果你的程序運行在橫向模式下,你仍然設置這些值的肖像寬度和高度。
Use the "orientation" setting in the build.settings file to define the orientation modes supported by the application.
使用“方向“設置在build.settings文件來定義的方向所支持的應用模式。
Note 
about trailing commas
In the examples on this page you'll notice that the tables have commas after the last entries. These are referred to as trailing commas. In Lua, trailing commas are optional, but always valid. Source: Programming in Lua, 2nd Edition by Roberto Ierusalimschy
注意:
關於尾隨逗號
在此頁上的例子,你會發現,現在情況發生了逗號後,最後條目。這些被稱為尾隨逗號。在Lua中,尾隨逗號是可選的,但始終有效。來源:編程 Lua中,第二版由Roberto Ierusalimschy
The value of "content" should be a table containing the following key-value pairs:
該值“內容“應該是一個包含以下關鍵值對:
width (number) - the width, in pixels, of the original target device (in portrait orientation)
寬度(數字) -的寬度,以像素為單位,原來的目標設備(縱向)
height (number) - the height, in pixels, of the original target device (in portrait orientation)
高(數字) -的高度,以像素為單位,原來的目標設備(縱向)
scale (string) - the type of auto-scaling, from one of:
量表(字符串)- 類型的自動縮放,從一個:
"none" - turns off dynamic content scaling
“無“- 關閉動態內容縮放
"letterbox" - uniformly scales up content as much as possible, while still showing all content on the screen. 
“信箱“ -統一尺度註冊內容盡可能,而仍然顯示在屏幕上的所有內容。
This is similar to watching a widescreen DVD on a non-widescreen TV set, except that you can use offstage content to fill the "bleed" areas rather than displaying black bars.
這類似於觀看寬屏 DVD在非寬屏電視,但你可以用台下內容來填充“流血“的地區,而不是顯示黑條。
"zoomEven" - uniformly scales up content to fill the screen, while preserving aspect ratio. Some content may appear offscreen, if the new screen has a different aspect ratio
“zoomEven“ -均勻可擴展至內容來填充屏幕上,同時保持高寬比。有些內容可能會出現屏幕外,如果新的屏幕上有一個不同的寬高比
"zoomStretch" - non-uniformly scales up content to fill the screen. All content will remain onscreen, but it may be stretched vertically or horizontally.
“zoomStretch“ -非均勻可擴展至內容來填充屏幕。所有內容將保持在屏幕上,但它可能是水平或垂直拉伸。
The content width and height allow you to choose a virtual screen size that is independent of the physical device screen size. This will generally be the size of your original target device -- which often means the original iPhone dimensions of 320 x 480, as in the SDK code samples.
寬度和高度的內容讓您選擇一個虛擬屏幕大小是獨立於物理設備的屏幕大小。這通常會在你原來的大小目標設備- 這往往意味著原有的iPhone尺寸為 320× 480,作為 SDK中的代碼示例。
You are then free to code as if you are positioning objects to the virtual screen. Touch events (and other hit events) will be remapped to the correct location on all screens when dynamic content scaling is active.
然後,您可以自由地代碼,如果你是定位對象的虛擬屏幕。觸摸事件(和其他襲擊事件)將被重新映射到正確的位置時,屏幕上的所有動態內容縮放活躍。
These virtual (i.e., content) dimensions are accessible via display.contentWidth and display.contentHeight. Because of this, the concept of stage width and height, e.g., display.stageWidth and display.stageHeight, has been deprecated in favor of content width and height.
這些虛擬(即內容)的尺寸都可以通過 display.contentWidth和display.contentHeight。正因為如此,這一概念的舞台寬度和高度,如display.stageWidth和display.stageHeight,已被否決贊成內容的寬度和高度。
By default, if no content size is specified, the content width and height returned will be the same as the physical screen width and height of the device. If you are specify a different content width and height in config.lua, the content width and height will take on those values.
默認情況下,如果沒有指定內容的大小,寬度和高度的內容將返回相同的物理屏幕的寬度和高度的裝置。如果您指定一個不同內容的寬度和高度config.lua,寬度和高度的內容將在這些價值觀。
When a scale is set in config.lua, the content will be rescaled to fit the screen. As far as your code is concerned, however, positions should still be specified in terms of the virtual screen coordinates.
當一個規模是集config.lua,內容將被重新調整以適應屏幕。至於你的代碼來說,然而,職位仍然應該在條款中指定的虛擬屏幕坐標。
For example, in the "Fishies" sample code (SampleCode/Graphics/Fishies), there is a config.lua file in which the content width is 320, the height is 480, and the scale is "zoomEven". If you were to view this in iPad, all the content (including the background image and the images of the fish) would be scaled to fit the iPad's screen size (1024x768) even though the images were intended for the smaller iPhone screen (320x480).
例如,在“Fishies“示例代碼(SampleCode/圖形 / Fishies),有一個 config.lua文件,其中內容的寬度為 320,高度為480個,規模是“zoomEven“。如果你要查看此在iPad,所有的內容(包括背景圖片和圖像的魚)將調整為適合 iPad的屏幕尺寸(1024 × 768),即使這些照片被用於較小的iPhone屏幕(320x480) 。
Depending on which dynamic scaling mode is used, and the aspect ratio of the device used to view the content, some of the original content may be scaled in such a way that portions are offscreen. Therefore, display.viewableContentWidth and display.viewableContentHeight have also been provided. These properties give you the currently viewable area of the screen, within the coordinate system of the original content. The Fishies sample leverages this so that the fish continue to swim only on the visible portions of the virtual screen.
根據哪個動態縮放模式時,和長寬比的設備用於查看的內容,一些原來的內容可能被縮小在這樣一種方式,部分是離屏。因此,display.viewableContentWidth和display.viewableContentHeight也已提供。這些屬性使您目前的屏幕可視區域內的坐標系統中的原始內容。樣品的Fishies利用這一點以便繼續游泳的魚只在可見部分的虛擬屏幕。
Dynamic Content Alignment動態內容的對齊方式
By default, dynamically scaled content is centered when shown on different screens. For example, in "letterbox" scaling mode, any additional screen area will be evenly divided between both sides, and in "zoomEven" mode, the area cropped will be the same on both sides.
默認情況下,中心內容是動態縮放時,顯示在不同的屏幕。例如,在“信箱“縮放模式下,任何額外的屏幕面積將是雙方平分,並在“zoomEven“模式,該地區將出現同樣的兩側。
However, there are cases where you might not want the content to be centered. For example, when scaling from the iPhone to the taller and skinnier screen of the Droid, you may not want the additional screen area at both the top and the bottom. Instead, you may want all of the added area shown the bottom, if your design features a navigation bar that should be aligned with the top of the screen.
然而,在一些情況下,您可能不希望內容居中。例如,在縮放時從 iPhone的屏幕高和瘦對 Droid,你可能不希望在更多的屏幕區域的頂部和底部。相反,你可能需要添加的所有區域中顯示的底部,如果您的設計採用了導航欄,應與頂部的屏幕。
For such cases, you may optionally specify the content alignment in both the x- and y-directions:
對於這種情況,你可以選擇指定內容的對齊方式在x和y方向:
application =
{
        content =
        {
                width = 320,
                height = 480,
                scale = "letterbox",
                xAlign = "left",
                yAlign = "top"
        },
} 
xAlign
A string that specifies the alignment in the x-direction for the position of the reference screen (which may be scaled) relative to the physical screen. It can be one of the following values:
xAlign
一個字符串,指定路線在x方向的位置的​​參考屏幕(可縮放)相對於物理屏幕。它可以是以下值:
*"left"
*"center" (Default)
*"right"
yAlign
A string that specifies the alignment in the y-direction for the position of the reference screen (which may be scaled) relative to the physical screen. It can be one of the following values:
一個字符串,指定路線在y方向的位置的​​參考屏幕(可縮放)相對於物理屏幕。它可以是以下值:
*"top"
*"center" (Default)
*"bottom"
Note
previous versions of Corona defaulted to left/top alignment rather than centered alignment, so you can restore the older behavior by setting xAlign to "left" and yAlign to "top" in your config.lua file.
以前版本的Corona默認為左/頂端對齊,而不是居中對齊,這樣你就可以恢復舊的行為設定 xAlign“左“和yAlign到“頂“在你的config.lua文件。
Dynamic Content Properties動態內容屬性
A number of methods are exposed within Lua to help you work with scaled content:
一個數字的方法暴露在Lua中,以幫助您的工作內容與規模:
display.contentWidth
By default, this is the same as the physical screen width in pixels. If config.lua specifies a reference width, it takes on that value. For example, this would return 320 in the above examples. This is referred to as the "reference screen width" below.
默認情況下,這是一樣的物理屏幕的寬度,以像素。如果config.lua指定一個寬度,它需要這個值。例如,這將返回320以上的例子。這被稱為“參考屏幕寬度“下面。
display.contentHeight
By default, this is the same as the physical screen height in pixels. If config.lua specifies a height it takes on that value. For example, this would return 480 in the above examples. This is referred to as the "reference screen height" below.
默認情況下,這是一樣的物理屏幕的高度,以像素。如果config.lua指定高度需時該值。例如,這將返回480以上的例子。這被稱為“參考屏幕高度“下面。
display.viewableContentWidth
display.viewableContentHeight
Returns the width and height of the viewable content, which may be different than the reference content dimensions if the target screen has a taller or wider aspect ratio.
返回的寬度和高度的可視內容,這可能是不同的尺寸比參考的內容,如果屏幕上有一個更高的目標或更大的寬高比。
Note that these values are expressed in reference screen units: for example, content with a reference size of 320 x 480 upscaled to iPad using "zoomEven" will be cropped at the top and the bottom, and therefore the viewableContentHeight will return a value like 426 rather than the original value of 480. This lets you detect the "safe zone" for your content when deploying across multiple screens.
請注意,這些值是在參考屏幕單位表示:例如,內容與參考尺寸為 320× 480上變換到ipad使用“zoomEven“將出現在頂部和底部,因此viewableContentHeight將返回值,如426而不是原來的值480。這可以讓你發現的“安全區“為您的內容時,部署在多個屏幕上。
Note注意:
There is currently a known bug where these methods may return misleading values in "letterbox" scaling mode; this will be fixed in a future release.
目前有一個已知的錯誤而這些方法可能誤導返回值“letterbox“的縮放模式,這將是固定在以後的版本。
display.screenOriginX
display.screenOriginY
Returns the x-distance and y-distance from the top-left of the reference screen to the top-left of the current screen, in reference screen units. For example, in "letterbox" or "zoomEven" scaling modes, there may be added area (or cropped area) on the current device screen. These methods let you find out how much visible area has been added or removed on the current device.
返回的x和y的距離,距離左上角參考屏幕左上角的當前屏幕,屏幕的單位參考。例如,在“letterbox“或”zoomEven“縮放模式,有可能會增加面積(或裁剪區)對當前設備的屏幕。這些方法讓你了解多少可見區域已被添加或刪除當前設備。
Dynamic Image Resolution動態圖像分辨率
Dynamic image resolution lets you automatically swap in higher-resolution versions of your images on higher-resolution devices, without having to change your layout code.
動態圖像分辨率可以自動交換在更高分辨率的版本上的圖像分辨率更高的設備,而無需改變你的佈局代碼。
The simplest example is the iPhone 4, which has a resolution of 640 x 960, or exactly twice the resolution of the iPhone 3GS, which is 320 x 480. You can use content scaling in your config.lua file to scale up your original 320 x 480 application to fill the iPhone 4's screen. This works well, but does not make full use of the higher resolution — your images will not be as crisp and detailed as they could be, given all the added pixel density available.
最簡單的例子是iPhone 4,它的分辨率為 640 × 960,或究竟兩倍的iPhone 3GS的決議,這是320 × 480。您可以使用內容縮放在config.lua文件,以擴大原來的320 × 480的應用,填補了iPhone 4的畫面。這個效果很好,但不充分利用具有更高的分辨率 - 您的圖片不會像清晰和詳細,因為他們可能是,由於所有增加像素密度。
To address this issue, Apple defined a naming convention for images. Under Apple's method, developers create double-sized versions of their base images and add an "@2" suffix to their filenames, and the double-resolution versions of the images are automatically substituted on the double-resolution iPhone 4.
為了解決這個問題,蘋果定義的命名約定的圖像。根據蘋果公司的方法,開發人員創建雙大小版本的形象和他們的基地添加一個“@ 2”後綴的文件名,和雙決議版本的圖像會自動取代對雙決議 iPhone 4。
However, while Apple's system works for the iPhone 4, which is exactly 2x the resolution of previous iPhones, a more robust system is needed to support full multi-platform development, where different device resolutions do not fall neatly into a 2:1 ratio.
不過,雖然蘋果的系統的工程,iPhone 4,而這正是以前的2倍iPhone的決議,一個更強大的系統需要支持完整的多平台開發,不同的設備分辨率不屬於成一個整齊的比例為 2:1。
Instead, Corona uses a more general method for defining alternate images, which has two advantages:
相反,Corona使用更通用的方法替代圖像定義,它有兩個優點:
Corona lets you select your own image naming patterns. The "@2" convention can be used, but so can any other naming suffixes defined by you.
Corona讓你選擇自己的形象的命名方式。在“@ 2”公約可以使用,但至今不能有任何其他的命名後綴由您定義。
Corona does not require you to know the exact resolution of the target device — which may be unknown, especially for the growing range of Android devices. Instead, you can predefine several image resolution choices, and Corona will automatically find the closest match on each device.
Corona不需要你知道確切的目標設備的決議 - 這可能是未知的,尤其是對範圍日益擴大的Andr​​oid設備。相反,你可以預先定義幾個圖像分辨率選擇,Corona會自動找到最接近的每一個設備。
To define your image naming convention, and the corresponding image resolutions, a table named imageSuffix is added to config.lua, inside the content subtable. Here is an example of a config.lua file that defines four alternative image resolutions:
要定義你的形象的命名規則,以及相應的圖像分辨率,表名為 imageSuffix添加到config.lua,裡面的內容子表。下面是一個例子一config.lua文件定義了四個替代圖像分辨率:
------------------------
application =
{
    content =
    {
        width = 320,
        height = 480,
        scale = "letterbox",
 
        imageSuffix =
        {
            ["@2"] = 2,
            ["@3"] = 3,
            ["-bar"] = 3.3,
            ["-foo"] = 4.5,
        },
    },
}
----------------------------
This is probably more complex than a real-world example would be, but it demonstrates several possibilities for image naming conventions. In this case, the file defines the "@2" suffix as referring to images with 2x the base resolution, and similarly the "@3" suffix as meaning 3x the base resolution. But any names and resolution ratios are allowed, including non-integer values, so the "-bar" suffix is defined as being 3.3x the base resolution, and the "-foo" suffix means 4.5x the base resolution.
這可能是更複雜的比真實世界的例子是,但它演示了幾種可能的圖像命名約定。在這種情況下,該文件定義了“@2“的後綴,它是指圖像分辨率和2倍的基礎,以及類似的“@3“後綴的含義3倍基決議。但是,任何名稱和分辨率比是允許的,包括非整數值,因此,“-bar“後綴被定義為3.3x決議的基礎,而“-foo“後綴是指4.5倍的基礎決議。
With the above defined, the corresponding set of images would be created as follows. Assuming a base image named myImage.png, with a size of 100 x 100 pixels, the alternate images would be:
有了上述定義,設置相應的圖像將被創建如下。假設一個名為 myImage.png基地形象,有大小100 ×100像素,圖像的替代將是:
myImage@2.png (200 x 200 pixels)
myImage@3.png (300 x 300 pixels)
myImage-bar.png (330 x 330 pixels)
myImage-foo.png (450 x 450 pixels)
With the alternative assets in place, simply use display.newImageRect() rather than display.newImage(), setting the target height and width to the dimensions of your base image:
隨著另類資產到位,只需使用display.newImageRect()而不是display.newImage(),設置目標的高度和寬度的尺寸你的基地的形象:
display.newImageRect( "myImage.png", 100, 100 )
Corona will then choose the closest matching suffix, defined as the one whose scale is equal to or smaller than the current content scale factor, and then map that image file into the given 100 x 100 area (defined in base coordinates).
Corona將選擇最匹配的後綴,定義為一個其規模等於或小於當前內容的比例因子,然後映射到給定的圖像文件100× 100區(定義在基坐標)。
Currently, the largest possible range of scaling factors between different devices is about 2.4 to 1, so the above example is somewhat exaggerated. Today's most common case will likely be double-resolution alternate images for use with iPhone 4 and iPad, rather than this set of higher values. In the future, the range of possible cases is likely to be greater, as iOS and Android devices multiply.
目前,最大的可能範圍內不同的設備之間換算係數大約為 2.4比1,因此上面的例子是有些誇大。當今最常見的情況可能會是雙圖像分辨率交替使用與 iPhone4和iPad,而比這一套更高的價值。在未來,可能案件的範圍可能會更大,因為 IOS和Android設備繁殖。
Note that you do not need to provide all (or any) of the alternate images for every case. When you use display.newImageRect(), Corona will automatically look for the best match available for the target screen, and when that image is unavailable, it will work its way down the list of lower-resolution choices, finally falling back to the base image filename if no other choice is available.
請注意,您並不需要提供全部(或任何)的替代圖像的每一個案件。當您使用display.newImageRect(),Corona會自動尋找可用的最佳匹配為目標的屏幕,而當這種形象是不可用,其工作方式將在列表中向下較低分辨率的選擇,終於回落到基圖像文件名,如果沒有其他選擇可用。
It is likely that some images in your application are more prominent or important than others, so you can selectively add higher-resolution versions in the cases where it matters most. The caveat is that the base image called in display.newImageRect() must always exist, even if none of the alternate choices do.
很可能有些圖片在你的應用較為突出或重要的不是別人,這樣你可以有選擇地添加更高分辨率的版本,它的情況下,最重要的。需要說明的是,該基地的形象稱為 display.newImageRect()必須始終存在,即使沒有做的替代選擇。
Frame rate control
By default, the frame rate is 30 fps. We now allow you to optionally set the frame rate to 60 fps by adding the fps key to config.lua:
幀速率控制
默認情況下,幀頻為 30幀。我們現在讓你選擇設置幀頻為 60 fps的幀中加入關鍵 config.lua:
------------------------
application =
{
    content =
        {
            fps = 60,
        },
}
-----------------------
Note
To avoid image tearing, the screen refresh rate in Corona is now locked to the hardware refresh rate on the iPhone, which is 60 fps. Therefore, the Corona framerate must be a number that divides evenly into 60. We are currently assuming that setting a rate below 30 fps is not a priority, which leaves two possible choices: 30 fps and 60 fps. Values other than 60 in this setting will be ignored.
注意:
為了避免圖像撕裂,屏幕刷新率鎖定在Corona是現在的硬件更新速度的iPhone,這是60幀。因此,Corona幀率必須是一個數字的鴻溝平均分為 60。目前,我們正在制定一個假設率低於30 FPS是不是一個優先事項,這讓兩種可能的選擇:30 fps和60 fps的。 60以外的值在此設置將被忽略。
Anti-aliasing
反鋸齒
Corona uses software anti-aliasing for its vector objects. Previously, this anti-aliasing was on by default. It is now off by default, which will greatly improve performance of vector objects, and should make little visual difference on the latest high-dpi devices.
Corona使用軟件的抗混疊的矢量對象。在此之前,這種反鋸齒,是在以默認。現在是默認關閉的,這將大大提高性能的矢量對象,並應使視覺差異不大的最新高DPI設備。
To turn it on again, you must create a config.lua file and add an antialias key:
要再次打開它,你必須創建一個 config.lua文件,並添加了抗混疊的關鍵:
---------------------------------
application =
{
        content =
        {
                antialias = true,
        },
}
---------------------------------
Build Configuration: build.settings
Build-time properties can be provided in an optional build.settings file, which uses Lua syntax. An example of a build.settings file:
構建時特性可以提供一個可選 build.settings文件,它使用Lua的語法。一個例子一build.settings文件:
-----------------------------
settings =
{
        orientation =
        {
                default = "portrait",
        },
 
        iphone =
        {
                plist =
                {
                        UIRequiredDeviceCapabilities = "magnetometer",
                        UIPrerenderedIcon = true,
                },
        },
 
        build =
        {
                custom = "a1234",
        }
}
---------------------------------
You can also use dot syntax instead of a Lua table constructor to define your build settings. This alternate syntax is required for some device-specific plist keys that contain special characters, like the tilde (~). The following build.settings file demonstrates how to include both dot and table constructor syntax:
您也可以使用點語法,而不是一個 Lua表的構造來定義生成設置。這種替代語法一些設備需要特定plist中包含特殊字符鍵,如波形符(〜)。下面build.settings文件演示如何包括點和表構造語法:
------------------------------
settings =
{
    orientation =
    {
        default = "portrait",
        supported =
        {
            "portrait", "portraitUpsideDown", "landscapeRight", "landscapeLeft"
        }
    },
    
    
    iphone =
    {
        plist =
        {
            UIInterfaceOrientation = "UIInterfaceOrientationLandscapeRight",
 
            UISupportedInterfaceOrientations =
            {
                "UIInterfaceOrientationLandscapeLeft",
                "UIInterfaceOrientationLandscapeRight"
            },
            
            UIApplicationExitsOnSuspend = true,
            UIStatusBarHidden = true,
            UIPrerenderedIcon = true
            
        }
    }
}
 
 
settings.iphone.plist["UIInterfaceOrientation~ipad"] = "UIInterfaceOrientationPortrait"
settings.iphone.plist["UISupportedInterfaceOrientations~ipad"] = 
{
    "UIInterfaceOrientationPortrait",
    "UIInterfaceOrientationPortraitUpsideDown"
}
------------------------------------------
The build.settings file is used to set application orientation and auto-rotation behavior, along with a variety of platform-specific build parameters.
該 build.settings文件用於設置應用程序定位和自動旋轉行為,以及各種特定於平台的構建參數。
In addition, there is a custom build parameter for creating device builds with specific test versions of Corona. Currently, the only publicly available option is the temporary Beta 3 compatibility setting (which will be deprecated in the future), but others may be announced in the future.
此外,還有一個自定義生成參數創建設備建立與特定的測試版本的Corona。目前,唯一的公開的選擇是暫時的Beta 3的兼容性設置(這將在未來被廢棄),但其他人可能在將來公佈。
Info.plist Values (iOS)
Within build.settings, the optional “plist” table, within the “iphone” table (as shown above), can be used to set values in the compiled application’s Info.plist file. This has a number of uses, such as specifying device requirements or capabilities for the App Store. In the above example, the UIRequiredDeviceCapabilities key is set to “magnetometer”, which is required for apps using the Compass API to indicate to the App Store that they require devices with a compass. Also, the UIPrenderedIcon key is set to true, which prevents the iPhoneOS from adding the “shiny” highlight to the application icon.
在build.settings,可選“plist中“表,在“iPhone“表(如上所示),可以用來設定值在編譯的應用程序的Info.plist文件。這一個數字的用途,如指定設備的需求或功能的應用程序商店。在上面的例子中,UIRequiredDeviceCapabilities項設置為“磁力“,這是應用程序所需的API來使用羅盤指示的App Store,他們需要的設備和一個指南針。此外,UIPrenderedIcon項設置為 true,這可防止iPhone操作系統從加入“閃亮“突出顯示應用程序圖標。
For boolean values in Info.plist keys, use Lua-style booleans (true and false, without quotes) rather than Objective-C style booleans (“YES” and “NO”).
對於布爾值Info.plist中鍵,使用Lua風格的布爾值(true和false,不帶引號),而不是目的,C風格的布爾值(“是”和“NO“)。
The table name “iphone” refers to the iOS platform, which also includes the iPad.
該表命名為“iPhone“是指內部監督辦公室的平台,其中也包括在IPAD。
See the Apple developer documentation for more information on supported Info.plist values and what you can do with them.
看看蘋果開發者文檔的更多信息,價值觀和支持Info.plist中你可以與他們無關。
更多資訊請看 Apple developer documentation的supported Info部分,你可以對有關plist的value如何操作
Orientation Support (iOS) 定向支援辦公室(IOS)
The build.settings file can be used to set application orientation, including auto-orientation with the accelerometer.
該 build.settings文件可以被用來設置應用方向,包括自動方向與加速度計。
On iPhone and iPad, it is important to understand that there are actually three different things that are subject to orientation:
在iPhone和iPad,重要的是要明白,其實有三個不同的東西,受的方向:
The splash screen image初始屏幕圖像
The native UI elements, such as the keyboard and alert popups
本機用戶界面元素,如鍵盤和警報彈出窗口
The Corona canvas itself畫布本身Corona
In many cases, you may want (2) and (3) to have the same orientation, but note that there are also cases in which you want to orient them separately.
在許多情況下,您可能希望(2)及(3)有相同的方向,但是請注意,也有個案要分開的方向。
For example, you might create an iPad game with no “correct” orientation, but still want the iPhoneOS notification dialogs to appear right side up from the current player’s point of view. Alternatively, you might want to lock the orientation of the Corona canvas, because you are performing your own orientation changes using Corona animation (as shown in the Fishies sample code), but you still want the native UI elements to appear in the current orientation.
例如,您可以創建一個 iPad的遊戲,沒有“正確“的方向,但仍然希望iPhone操作系統通知對話框出現右側從目前球員的觀點。或者,您可能要鎖定方向的Corona帆布,因為你是你自己的方向的變化進行使用Corona動畫(Fishies所示的示例代碼),但你仍然希望本地UI元素出現在目前的方向。
To control these various possible scenarios, there are now three optional key/value pairs within the orientation table in build.settings: default, supported, and content. The following scenarios demonstrate usage by example.
要控制這些 various可能發生的情況,現在有三個可選的鍵 /值雙,方向表build.settings:默認,支持和內容。以下方案說明用法範例。
Auto-rotation自動旋轉
To auto-rotate to all four orientations, you could use the following build.settings file:
要自動旋轉到所有四個方向,你可以使用下面的build.settings文件
--------------------------------------------------
settings =
{
        orientation =
        {
                default = "landscapeRight",
                supported =
                {
                        "landscapeLeft", "landscapeRight", "portrait", "portraitUpsideDown",
                },
        },
}
--------------------------------------------------
The default orientation setting determines the initial launch orientation on the iPhone, and also the initial orientation of the Corona simulator.
默認的方向設置確定首次推出的iPhone的方向,也是初始取向的Corona模擬器。
Note注意:
On Android, the default orientation setting has no effect. The orientation is initialized to the actual orientation of the device (unless only one orientation is specified). Also, the only supported orientations are landscapeRight and portrait. On a device, you can flip to either landscapeRight or landscapeLeft, but the OS only reports one flavor of landscape, and Corona's orientation event chooses landscapeRight.
在Android,默認的方向設置不起作用。初始化的方向與實際方向的設備(除非只有一個方向是指定)。此外,僅支持方向是landscapeRight和肖像。在設備上,您可以翻轉要么landscapeRight或landscapeLeft,但操作系統只報告一種味道的風景,和Corona的方向選擇 landscapeRight事件。
When you change the device or simulator orientation, the Corona view will auto-rotate, within the orientations supported. In addition, native UI (on the device) will auto-rotate. The auto-rotation is such that to the user, the content appears "upright". Also, the position (0,0) within Corona will correspond to the upper left-hand corner of the current screen orientation.
當您更改設備或模擬器方向,Corona視圖將自動旋轉,在方向的支持。此外,本機用戶界面(在設備)會自動旋轉。自動旋轉,這樣給用戶,內容顯示為“正氣“。此外,位置(0,0)在Corona將對應到上左角當前屏幕的方向。
Note that the iPad ignores the default setting, and attempts to launch in the current physical orientation of the device, assuming that orientation is found on the supported list. To avoid unexpected orientation display issues, it's recommended that your project's build.settings specify allowed orientations for all iPad projects.
請注意,在IPAD忽略了默認設置,並嘗試推出在當前的物理定位裝置,假設方向上找到支持列表。為了避免意外的方向顯示問題,建議該項目的build.settings指定允許的方向iPad的所有項目。
If you are writing an iPad app that supports multiple orientations, you should also provide a splash screen for each of the orientations, or the App Store reviewers may reject your app. The iPad supports the following naming conventions for orientation-specific splash screen files:
如果你正在編寫一個應用程序,支持多種 iPad的方向,你也應該提供一個啟動畫面的每個方向,或App Store的評論可能會拒絕你的應用程序。在IPAD支持以下命名約定為取向的特定啟動畫面文件:
Default-Portrait.png
Default-PortraitUpsideDown.png
Default-Landscape.png
Default-LandscapeLeft.png
Default-LandscapeRight.png
Note that the "Portrait" and "Landscape" splash screens in the list above will automatically handle two types of orientation each, unless you decide to provide more specialized files, such as "LandscapeLeft". Also, all splash screen graphics provided should be internally upright -- one common misunderstanding is that the "PortraitUpsideDown" graphic should actually be created upside down, which is incorrect.
請注意,“肖像“和“山水“撲通屏幕上述的名單將自動處理兩種類型的每個方向,除非你決定提供更專業化的文件,如“LandscapeLeft“。此外,所有閃屏圖形應提供內部直立- 一個常見的誤解是,“PortraitUpsideDown“圖形實際上應該是建立上下顛倒,這是不正確的。
Landscape orientation橫向
To support a single orientation (for example, landscape-only), build.settings should look like this:
為了支持一個方向(例如,只有景觀),build.settings應該是這樣的:
---------------------------------
settings =
{
        orientation =
        {
                default = "landscapeRight",
                supported =
                {
                        "landscapeLeft", "landscapeRight"
                },
        },
}
------------------------------------
In this sample, both of the equivalent landscape orientations are supported (landscapeRight and landscapeLeft). It has become fairly common for iPhone apps to only support one orientation, but Apple now encourages iPad developers to support all equivalent orientations: for example, a landscape app should support both landscapeLeft and landscapeRight, and a portrait app should support both portrait and portraitUpsideDown.
在此示例,這兩個方向的等效景觀支持(landscapeRight和landscapeLeft)。它已成為相當普遍的iPhone應用程序只支持一個方向,但蘋果現在鼓勵 iPad的開發者支持所有等效方向:例如,一個景觀的應用程序應該支持landscapeLeft和landscapeRight,以及應用程序應該支持肖像肖像和portraitUpsideDown。
Again, the position (0,0) within Corona will correspond to the upper left-hand corner of each screen orientation.
同樣,位置(0,0)在Corona將對應於左上方角落,每個屏幕的方向。
Orientation of native UI only只有定位本地UI
There are scenarios in which you want the native UI elements to auto-rotate, or to be oriented in a specific way, but you also want to maintain a fixed coordinate system within Corona (which matches the previous behavior in Corona SDK 1.x).
有些情況要在其中本地用戶界面元素的自動旋轉,或將要面向一個特定的方式,但你也希望保持一個固定的坐標系統內Corona(這在以前的行為相匹配的SDK1.x的Corona) 。
For example, you may have a multiplayer game where any orientation is equally valid, or you may want to manually define the animation that occurs on orientation change (e.g., animate a dissolve and/or rotation between the sideways and upright interface layouts). The only way to do this is through a fixed Corona coordinate system where you manage your own rotation behavior in Lua. Because Corona renders its graphics to an OpenGL canvas that is separate from the other native elements, it is possible to control the rotation behavior of this canvas independently.
例如,你可能有一個多人遊戲,任何方向上同樣有效,或者您可能需要手動定義動畫方向上發生變化(例如,動畫一溶解和/或旋轉之間的橫向和垂直界面佈局)。只有這樣,才能做到這一點是通過一個固定的坐標系統,其中Corona您管理自己的旋轉行為在Lua。由於Corona呈現其圖形的OpenGL畫布獨立於其他本土元素,它是可以控制這個畫布旋轉行為獨立。
To lock Corona’s orientation while allowing native iPhone UI elements to rotate, add a content parameter in build.settings:
要鎖定Corona的方向,同時允許本地iPhone UI元素進行旋轉,添加內容參數 build.settings:
-----------------------------
settings =
{
        orientation =
        {
                default = "portrait",
                content = "portrait",
                supported =
                {
                        "landscapeLeft", "landscapeRight", "portrait", "portraitUpsideDown",
                },
        },
}
------------------------------
Similarly, to lock Corona’s internal coordinate system to portrait orientation (e.g., for compatibility with your older Corona code) while locking iPhone UI elements to landscape orientation, you could do the following in build.settings:
同樣,要鎖定Corona的內部協調制度,以縱向(例如,為了兼容性與您的舊Corona代碼),而鎖定 iPhone的UI元素,橫向,你可以做以下的build.settings:
------------------------------
settings =
{
        orientation =
        {
                default ="landscapeRight",
                content = "portrait",
                supported =
                {
                        "landscapeRight",
                },
        },
}
---------------------------------
Orientation naming conventions定位命名約定
Orientations follow the UIInterfaceOrientation conventions on the iPhone (not to be confused with UIDeviceOrientation). These are defined as follows:
按照UIInterfaceOrientation公約取向上的iPhone(不要混淆UIDeviceOrientation)。這些定義如下:
*portrait - device in the upright position with the Home button on the bottom
*landscapeRight - device in the sideways position with the Home button on the right
*landscapeLeft - device in the sideways position with the Home button on the left
*portraitUpsideDown - device in the upside down position with the Home button on the top
portrait- 設備處於直立狀態的主頁按鈕在底部
landscapeRight-裝置在橫向位置的主頁按鈕在右邊
landscapeLeft-裝置在橫向位置上的主頁按鈕在左側
portraitUpsideDown-設備處於倒掛位置與Home按鈕頂部
About combining dynamic scaling and auto-rotation
關於結合的動態縮放和自動旋轉
As discussed in Dynamic Content Scaling, Corona lets you develop content for a single "virtual" screen size which is automatically scaled up (or down) on devices with different screen sizes. However, not all dynamic scaling options will work perfectly with auto-rotation of the Corona canvas. In particular, you should avoid using the zoomStretch scaling option unless you also disable auto-rotation for the Corona canvas. For more information about disabling auto-rotation of the Corona canvas, see Orientation of native UI only.
正如在動態內容縮放,讓您開發Corona內容單一的“虛擬“屏幕大小自動調整是向上(或向下)的設備上使用不同的屏幕尺寸。然而,並非所有動態縮放選項將完全與自動旋轉畫布的Corona。特別是,你應該避免使用zoomStretch縮放選項,除非您還禁用自動輪換Corona畫布。有關更多信息有關禁用自動旋轉的Corona帆布,看到取向本地UI而已。
Detecting current device orientation目前的檢測設備方向
The current device orientation can be read from system.orientation. This property will return one of six possible string values, from a set consisting of the four orientations above plus faceUp and faceDown.
目前設備的方向可以讀出system.orientation。此屬性將返回六分之一的可能的字符串值,從一組由四個方向上面加faceUp和面朝下。
To get more detailed information about the device’s specific x, y, and z angle in space, see the section on accelerometer events in the API Reference.
要獲得更詳細的信息有關該設備的特定的X,Y和Z角的空間,看到一節加速度事件的API參考。
Orientation Support (Android)定向支持(Android)
The Android platform supports two orientations: portrait and landscapeRight (defined as above). The orientations “landscapeLeft” and “portraitUpsideDown” have no effect on Android. Also, auto-rotation is not currently supported on Android.
Android平台的支持兩個方向:縱向和landscapeRight(定義如上)。在面向“landscapeLeft“和”portraitUpsideDown“沒有對 Android操作系統。此外,自動旋轉目前不支持Android上。
Here is an example of an Android-specific build.settings file (you may also combine Android and iPhone settings in the same file):
下面是一個例子,一個 Android特定build.settings文件(您可能還結合 Android和iPhone的設置在同一個文件):
--------------------------------------
settings =
{
        android =
        {
                versionCode = "3"
        },
    
        androidPermissions =
        {
                "android.permission.ACCESS_FINE_LOCATION",
                "android.permission.INTERNET"
        },
    
        orientation =
        {
                default = "landscape"
        },
}
-------------------------------------
Version Code (Android)版本代碼(Android)
The version code can be set within an optional “android” table in build.settings. See the code above for an example.
該版本的代碼可以設定在一個可選的“Android“表build.settings。見上面的代碼中的例子。
For more information, see android:versionCode on this page. Note that this version code is an internal number used to distinguish application releases for the Android Marketplace, and is different than the version given in the Corona build dialog. The latter determines the version number displayed to the end user, also known as android:versionName.
有關詳細信息,請參閱Android:versionCode在此頁。請注意這個版本的代碼是一個內部編號來區分應用程序釋放為 Android市場,並給予不同的版本相比,在電暈建立對話。後者決定了版本號顯示給最終用戶,也被稱為Android:versionName。
Application Permissions (Android)
應用程序的權限(Android)
Finally, an optional “androidPermissions” table can be used to specify permissions, using string values as given in the Android Manifest Reference. For example, ACCESS_FINE_LOCATION and INTERNET permissions are specified in the code above.
最後,一個可選的“androidPermissions“表可用於指定的權限,使用字符串值中給出了Android清單參考。例如,ACCESS_FINE_LOCATION權限和INTERNET上面的代碼中指定。
Developers should choose the permissions that match what their application requires. In particular, set the INTERNET permission for any Android application that requries network access.
開發者應該選擇什麼權限,其應用要求相匹配。特別設置 Internet權限 Android的應用程序的任何requries網絡訪問。
(繼續閱讀...)
文章標籤

createps 發表在 痞客邦 留言(0) 人氣(1,017)

  • 個人分類:Corona
▲top
  • 5月 13 週五 201115:44
  • Corona Physics Bodies

Physics Bodies 物理機構
Bodies機構
The physics world is based on the interactions of rigid bodies. These physical bodies can be bound to Corona display objects in a one-to-one relationship, and Corona will automatically handle all position updates and other synchronization tasks.
物理世界是基於剛體的相互作用。這些物理機構可以綁定Corona 顯示對象在一比一的關係,和Corona 會自動處理所有位置更新和其他同步任務。
In fact, our goal is that you should be able to consider the physical bodies as literally part of the visible display objects. Therefore, the body constructor physics.addBody does not return a new object, but instead “extends” an existing display object with physical properties.
事實上,我們的目標是,你應該可以考慮物理機構,因為從字面上的一部分,可見顯示對象。因此,身體構造 physics.addBody不會返回一個新的對象,而是“延伸“一現有的顯示對象的物理特性。
Therefore, standard object read/write attributes like x, y and rotation should continue to work normally on a physical body, although if the bodyType is “dynamic”, the physics engine may “fight back” against your attempts to move the object manually, since the target object will be under the constant effect of gravity and other forces.
因此,標準對象的讀 /寫屬性,如X,Y和旋轉應該繼續正常工作在物理機構上,但如果在bodyType是“動態“的,物理引擎可能“抵抗“針對您嘗試手動移動對象,由於目標對象將是重力和其他力量的常數影響下。
The “DragPlatforms” sample code shows one method for changing body types to “kinematic” during dragging, which temporarily removes them from the influence of external forces. 
在“DragPlatforms“示例代碼演示了一種方法改變身體類型為“運動“在拖動時,這暫時移除它們從外部勢力的影響。
In contrast, the "DebugDraw" sample shows a method for dragging objects using "touch joints" that does not remove them from external forces. 
與此相反,“DebugDraw“示例顯示了一個方法拖動對象使用“觸摸關節“,這並不能從外部力量消除他們。
The second method is probably more useful in physics-based games, but you can compare the two examples to see the difference between "kinematic" and "dynamic" object behavior.
第二種方法可能更有益的物理為基礎的比賽,但是你可以比較兩個例子,看到的區別““運動“和”動態“對象的行為。
A display object that has physical properties can be deleted in the normal way, using object:removeSelf(). It will be automatically removed from both the visible screen and the physical simulation. 
一個顯示對象,具有物理屬性可以以正常方式刪除,使用 object:removeSelf()。它會被自動刪除無論從可視屏幕和物理模擬。
Note: You cannot remove the Physics properties of an object -- you can only remove the entire object.
注意:您不能刪除一個對象的物理特性- 您只能刪除整個對象。
Simple body construction簡單的機身結構
(繼續閱讀...)
文章標籤

createps 發表在 痞客邦 留言(0) 人氣(589)

  • 個人分類:Corona
▲top
  • 5月 12 週四 201118:16
  • Corona Collision Filters "Helper Chart"


Collision Filters "Helper Chart"
碰撞過濾器“幫手圖“
Hello all,大家好
I'm posting the following explanation about Collision Filters as a help to the community in general, as a result of my own experiments. Some users, especially recent converts, have not yet used collision filters but it's an essential aspect to almost any game design. I created the attached "Collision Helper Chart" which I use for my own game designs... hopefully it can assist others too! The blank document can be downloaded from my website (link at the end of this post).
我下面的解釋張貼關於碰撞過濾器的幫助,對社會一般,因此我自己的實驗。有些用戶,特別是最近的轉換,還沒有使用過濾器的碰撞,但它是一個重要的方面幾乎所有的遊戲設計。我創建了附加“碰撞助手圖“,我用我自己的遊戲設計...希望它能夠幫助別人呢!空白文件可從我的網站(鏈接在結束這篇文章)。
-----
So, what are Collision Filters? Simply put, they're a method to determine what objects combine with other objects, or perhaps more importantly, what objects do not collide with others in a game. The official documentation explains Corona's method of accomplishing this, which varies from other SDKs, but I created a chart to assist in the issue.
那麼,什麼是碰撞過濾器?簡而言之,他們是一個方法來確定哪些對象與其他對象相結合,或者更重要的是,哪些對象不與他人發生碰撞在遊戲中。官方文檔解釋Corona的方法實現這一點,從其他SDK而異,但我創建了一個圖表,以協助問題。
Here's a chart and list of steps following the classic "Asteroids" game example...
這裡有一個圖表,列出以下步驟經典的“小行星“的遊戲例子...
STEPS:
1.Observe the "bits" (numbers) in the very top row. 1 to 512, in binary numbers. You can go as high as "32768" (16 places) but I stopped the chart at 512 which should be enough for most people. These "bits" are how Corona determines collision filters.
遵守“位元“(數字)排在最高層。 1到512,在二進制數字。你可以去高達“32768“(16處),但我停在512的圖表應足以讓大多數人。這些“位元“是如何確定Corona碰撞過濾器。
2.Observe the first row. It has two sub-rows: "catg." and "cl.w/". These mean "category" and "collides with" respectively.
遵守第一行。它有兩個子行:“catg。“和“cl.w/“。這意味著"category"和"collides with"分別。
3.For each object type in your game (i.e. "asteroid", pick one bit number. Place a circled X in that column. This bit number should be unique and not repeated for other objects under most circumstances! (There are probably advanced situations where you might duplicate category bits or even assign more than one to an object, but don't worry about it now)
對於每個對象類型在你的遊戲(即“小行星“,選擇一個位元的數字。放置一個圈X的在該列。該位元號碼應該是唯一的,而不是重複其他對象在大多數情況下!(有可能是先進的情況下,您可能會重複類別位元,甚至超過一個指定的對象,但不用擔心了)
4.Next, ask yourself: "can this object collide with others of its type?" If yes, then place an X directly below in the "collides with" row. In the example, notice that asteroids can collide with other asteroids.
4.接下來,問自己:“這個對象可以與他人發生衝突的類型?“如果是的話,然後直接在 "collides with"那行 放一個X 。在這個例子中,可以發現小行星碰撞與其他小行星。
5.Move down the rows of other objects in your game. For every object that "asteroids" can collide with, place an X in the "collides with" row for that object. Asteroids can collide with player_ship and alien_ship, so both of those get an X in their respective row/column. If it's not obvious already, keep the columns ordered: Asteroids have bit "2" as their category, so stay within that column for anything asteroids should collide with (I colored the chart entries to make it clearer).
5.向下行的其他對象在你的遊戲。對於每一個對象,“小行星“可以碰撞,放置一個 X在“collides with“行該對象。小行星可能撞到player_ship和alien_ship,所以這些都得到了X在各自的行/列。如果它已經不很明顯,繼續列下令:小行星有位元“2“,其類別,所以留在該列中任何小行星會撞上(我彩色圖表,使之更清晰的條目)。
6.Move to the next game object and repeat. IMPORTANT! You must work back UP the chart, not just down! If two objects are intended to collide, both must be marked properly or the collision will not function! 
6.移動到下一個遊戲對象和重複。重要!您必須備份圖表,而不僅僅是下來!如果兩個對象是為了碰撞,都必須標明正確或碰撞將無法正常工作!
So, take the item pair of asteroid and player_ship, which should always collide: "asteroid: category" is marked in "player_ship: collide with" AND "player_ship: category" is marked in "asteroid: collide with". If you fail to mark both corresponding factors, the collision will not happen!
因此,採取項目對小行星和player_ship,這應該永遠碰撞:“小行星:category“標記在“player_ship:collide with“及”player_ship:category“標記在“小行星:collide with“。如果你沒有標出對應的因素,不會發生碰撞!
7.When you've done all of your objects, simply add the bits across every row to determine sums.
7.當你已經做了所有你的對象,只需添加位元在每行,以確定的數額。
8.For each collision filter, you need these sums as follows, near the top of your main.lua file.
8.對於每一個碰撞過濾器,你需要這些款項如下,頂部附近你main.lua文件。
---------------
local asteroidCollisionFilter = { categoryBits = 2, maskBits = 7 }
local playerCollisionFilter = { categoryBits = 1, maskBits = 6 }
local alienCollisionFilter = { categoryBits = 4, maskBits = 7 }
------------------------
categoryBits is the sum from the "category" row for that object. 
categoryBits是總結從“類別“行該對象。
maskBits is the sum from the "cl.w/" row for that object.
maskBits是總結從“cl.w/“行該對象。
9.Later, in your physics body declarations, specify the collision filter. Obviously, define the proper filter for every object in your game, as declared near the top of your game code.
9.後來,在你的物理身體聲明,指定過濾器的碰撞。顯然,確定適當的過濾器,每一個對象在你的遊戲,這一點已接近頂部的你的遊戲的代碼。
--------------
local asteroid = display.newImageRect( [displayGroup], "asteroid.png", 32, 32 )
physics.addBody( asteroid, { density=2.9, friction=0.5, bounce=0.3, radius=16, filter=asteroidCollisionFilter } )
-------------
That's it! Remember the basic rules of collisions and body types. "Dynamic" bodies react physically with other "dynamic" or "static" bodies, but not with "kinematic" bodies. While confusing at first, it will soon make complete sense.
就是這樣!記住的基本規則和身體碰撞類型。 “動態“身體反應,身體上的其他“動態“或“靜態“的機構,但不符合“運動“組織。雖然一開始混亂,它很快就會作出完整意義上的。
Anyway, hopefully this helps some new Corona users, or even gives veterans a more visual way to calculate collision filters. If anybody at Ansca or in the community sees any errors in my description, please let me know! I'm not an Ansca staff member or Corona expert; all of this is just a result of my own personal testing and experimentation. :)
無論如何,希望這有助於一些新的Corona用戶,甚至給退伍軍人更直觀的方式來計算碰撞過濾器。如果有人在Ansca還是在社區中看到任何錯誤,我的描述,請讓我知道!我不是一個 Ansca工作人員或Corona的專家,所有這一切,僅僅是一個結果我個人的測試和試驗。 :)
And here's a link to the blank "chart" document in PDF format. You can download it from my website and print it for your own use: Collision Filter Helper Chart (PDF)
下面是一個鏈接到空白的“圖表“文件的PDF格式。你可以從我的網站下載並打印供自己使用:碰撞過濾助手圖(PDF)
(繼續閱讀...)
文章標籤

createps 發表在 痞客邦 留言(0) 人氣(126)

  • 個人分類:Corona
▲top
  • 5月 12 週四 201118:11
  • Corona Collision Detection

Collision Detection 碰撞檢測
Collision events 碰撞事件
Physics engine collision events are exposed through the standard Corona event-listener model, with three new event types. For general collision detection, you should listen for an event named "collision". The "collision" event includes phases for "began" and "ended", which signify the moments of initial contact and broken contact. These phases exist for both normal two-body collisions and body-sensor collisions. If you do not implement a "collision" listener, this event will not fire.
物理引擎,碰撞事件暴露通過標準Corona事件偵聽器模型,有三個新的事件類型。對於一般的碰撞檢測,你應該聽的事件名為“碰撞”。在“碰撞“事件,包括階段為“開始“和“結束“,這意味著對初次接觸的瞬間和破碎接觸。這些階段存在正常兩體碰撞和身體碰撞傳感器。如果你沒有實施“碰撞“監聽,這一事件不會觸發。
In addition to "collision" events, two other event types are optionally available whenever two bodies (not sensors) collide. Previously, these were also phases of the "collision" event type, but they have now been separated into unique event types, since they have more specialized uses.
除了“碰撞”事件,另外兩個事件類型可供用戶選擇每當兩個機構(不傳感器)發生碰撞。以前,這些也是階段的“碰撞”事件的類型,但是他們現在已經分成獨特的事件類型,因為他們有更多的專門用途。
"preCollision": an event type that fires right before the objects start to interact. Depending on your game logic, you may wish to detect this event and conditionally override the collision.
“preCollision”:一個正確的觸發事件類型的對象開始之前進行交互。根據你的遊戲邏輯,你不妨檢測此事件,並有條件地覆蓋碰撞。
For example, in a platform game, you may wish to construct “one-sided” platforms that the character can jump vertically through, but only in one direction. You might do this by comparing the character and platform position to see if the character is below the platform, and then using a short timer to make "isSensor" body property temporarily true for the character object so that it passes through the platform. If you do not implement a "preCollision" listener, this event will not fire.
例如,在一個平台上的遊戲,你不妨構建“一邊倒”的平台,垂直跳躍的字符可以通過,但只能在一個方向。你可以這樣做比較的性質和平台的位置,看看下面的字符是平台,然後用很短的計時器,以使“isSensor”身體暫時真實屬性的Character對象,使其穿過平台。如果你不實行“preCollision”聽眾,這一事件不會觸發。
"postCollision": an event type that fires right after the objects have interacted. This is the only event in which the collision force is reported. See the “Collision forces” section below for more on this topic. If you do not implement a "postCollision" listener, this event will not fire.
“postCollision”:一個事件之後觸發類型的對象有互動。這是唯一的事件,其中碰撞力的報導。參見“碰撞力”一節獲得更多關於這個主題。如果你不實行“postCollision”聽眾,這一事件不會觸發。
Note that the “preCollision” events are quite noisy, and may report many times per contact. Therefore, you should only listen for these events if you need pre-collision warnings, and we also recommend that you use local listeners within the objects of interest, rather than listening globally to all "preCollision" events in the world.
請注意,“preCollision”事件是相當嘈雜,可能會報告很多次,每次接觸。因此,你應該只偵聽這些事件,如果您需要預碰撞警告,我們還建議您使用本地聽眾的興趣範圍內的對象,而不是聽全球所有“preCollision”事件在世界上。
Collisions are reported between pairs of objects, and they can be detected either globally, using a Runtime listener, or locally within an object, using a table listener. See the "CollisionDetection" sample code for working examples of global and local collision listeners.
之間的碰撞是對報告的對象,他們可以在全球任何檢測,使用運行時監聽器,或在本地內的對象,使用一個表的傾聽者。參見“CollisionDetection”示例代碼示例工作全局和局部衝突的聽眾。
Global collision listeners全域碰撞監聽
When detected as a Runtime event, each collision event includes event.object1 and event.object2, which contain the table IDs of the two Corona display objects involved.
當作為運行時檢測到的事件,每次碰撞事件包括event.object1和event.object2,其中包含了兩個表IDCorona顯示對象參與。
Because Corona display objects behave like Lua tables, you may freely add any arbitrary data to these tables, such as names, category designators, point values, or even stored functions, and then retrieve this data at collision time. This is similar to the userData attribute in Box2D, but it is essentially unlimited, since you can assign as many custom attributes as you like.
由於Corona顯示對象的Lua的表像,你可以自由添加任意的數據到這些表,如名稱,類別代號,點值,甚至存儲功能,然後檢索這些數據在碰撞時間。這是類似於在Box2D用戶數據屬性,但它本質上是無限的,因為你可以指定多個自定義屬性,你喜歡。
For example, you may wish to store object names in an easily-accessible string format:
例如,您可能希望在一個存儲對象的名稱易於獲取字符串的格式:
-----------------------
local crate1 = display.newImage( "crate.png", 100, 200 )
physics.addBody( crate1, { density = 1.0, friction = 0.3, bounce = 0.2 } )
crate1.myName = "first crate"
 
local crate2 = display.newImage( "crate.png", 100, 120 )
physics.addBody( crate2, { density = 1.0, friction = 0.3, bounce = 0.2 } )
crate2.myName = "second crate"
 
local function onCollision( event )
        if ( event.phase == "began" ) then
 
                print( "began: " .. event.object1.myName .. " & " .. event.object2.myName )
 
        elseif ( event.phase == "ended" ) then
 
                print( "ended: " .. event.object1.myName .. " & " .. event.object2.myName )
 
        end
end
 
Runtime:addEventListener( "collision", onCollision )
--------------------------
Local collision listeners 本地碰撞監聽
When detected with a table listener within an object, each collision event includes event.other, which contains the table ID of the other Corona display object involved in the collision. Again, you may wish to store each object’s name in string format and retrieve it during the collision event:
當檢測到一個表在一個監聽對象,每次碰撞事件包括event.other,其中包含了表中的ID其他Corona顯示對象參與了碰撞。同樣,你可能想存儲每個對象的名稱,字符串格式和檢索它在碰撞事件:
-------------------
local crate1 = display.newImage( "crate.png" )
physics.addBody( crate1, { density=3.0, friction=0.5, bounce=0.3 } )
crate1.myName = "first crate"
 
local crate2 = display.newImage( "crate.png" )
physics.addBody( crate2, { density=3.0, friction=0.5, bounce=0.3 } )
crate2.myName = "second crate"
 
local function onLocalCollision( self, event )
        if ( event.phase == "began" ) then
 
                print( self.myName .. ": collision began with " .. event.other.myName )
 
        elseif ( event.phase == "ended" ) then
 
                print( self.myName .. ": collision ended with " .. event.other.myName )
 
        end
end
 
crate1.collision = onLocalCollision
crate1:addEventListener( "collision", crate1 )
        
crate2.collision = onLocalCollision
crate2:addEventListener( "collision", crate2 )
-------------------
See the "CollisionDetection" sample code for examples of both of these methods. (Run the project using Corona Terminal to see the output of the collisions.)
參見“CollisionDetection“示例代碼例子,這兩種方法。 (運行該項目利用 Corona 終端看到輸出的衝突。)
Collisions with multi-element bodies碰撞的多元素機構
Collision events involving a multi-element body (see "Complex Body Construction") also return the specific body part involved in the collision. This allows for more finely-tuned game logic: for example, you may decide that colliding with the nose of a rocket does more damage than colliding with its tailfins.
碰撞事件涉及多元素機構(見“複合體的建構“)也返回特定的身體部分參與了碰撞。這樣就可以更精細調校的遊戲邏輯:例如,你可以決定撞到火箭的前端比碰撞尾翼 造成的損害還多。
Body elements are identified by a numerical index, where the first element added to the body is given the number 1, the second one is number 2, the third is number 3, and so on.
Body元素是確定一個數字索引,其中第一個元素添加到身體給出數字 1,第二個是數字 2,第三個是3號,依此類推。
For global collision events, two additional integer values are now returned:
對於全球碰撞事件,另外兩個現已返回整數值:
---------------
event.element1
event.element2
---------------
These numerical properties are equal to the index of the elements in object1 and object2 that were involved in the collision. For example, object1 might a rocket with three body elements: nose, body and tail. If the collision is with its tail, the value of event.element1 would be 3; if the collision is with its body, the value of event.element1 would be 2. Again, this number is simply determined by the order in which you declared the elements of the body during its construction.
這些數值性質等同於指數中元素的object1和object2的參與了碰撞。例如,object1可能一火箭三體要素:鼻子,身體和尾巴。如果碰撞是它的尾巴,其價值 event.element1將是3,如果碰撞是與它的身體,其價值 event.element1是2。同樣,這個數字僅僅是確定的順序在其中聲明的元素在其體內的建設。
When collisions involve single-element bodies, both of the above values will always be 1.
當衝突涉及的單元素機構,無論上述值將始終為 1。
Similarly, local collision events (table listeners) now have additional fields:
同樣,本地的碰撞事件(表監聽)現在有額外的字段:
----------------
event.selfElement
event.otherElement
------------------
As above, these values will be 1 in the case of single-element bodies, and in multi-element bodies will range from 1 to the total number of elements in the body, numbered by the order in which the elements were added to the body.
如上所述,這些值將有1例在單元素的體,多元素機構將範圍從 1到總數的元素在體內,編號的順序被添加元素對身體。
Collision forces碰撞力
Once a collision has occurred, you can obtain the direct force of the collision, along with the sideways force between the two objects, which is effectively a frictional force. For example, you may have game objects that should be destroyed only if a collision is sufficiently forceful.
一旦發生碰撞,你可以直接獲得的碰撞力,側向力隨兩個物體之間,這實際上是一個摩擦力。例如,您可能有遊戲對象應該只被銷毀,如果有足夠的有力碰撞。
The direct force of the collision is reported within the "postCollision" event as event.force, and the frictional force is available as event.friction.
直接碰撞力報導在“postCollision“事件為 event.force和摩擦力可作為 event.friction。
-----------------
local function onPostCollision( event )
        if ( event.force > 1.0 ) then
                print( "Collision force: " .. event.force .. " Friction: " .. event.friction )
        end
end
 
Runtime:addEventListener( "postCollision", onPostCollision )
------------------
In the example above, very small forces are screened out. Also, a global listener is used here to simplify the example.
在上面的例子,非常小的力量篩選出。另外,一個全球性的監聽器是用在這裡是簡化的例子。
Since the postCollision event stream from the physics engine can be quite noisy (it registers a series of increasingly tiny forces as objects "settle"), you will probably want to choose your own threshold for ignoring some of it. See the "CollisionDetection" sample project for an example of how to do this (run the project using Corona Terminal to see the output of the collisions.)
由於 postCollision事件流的物理引擎可以很吵鬧(它註冊了一系列微小的力量越來越為對象,“定居“),你可能想選擇自己的門檻,無視它的一些。參見“CollisionDetection“示例項目為例,如何做到這一點(運行該項目利用Corona碼頭看到輸出的衝突。)
(Technical note: Box2D is actually reporting collision impulses, which are forces multiplied by the elapsed time of each world step, but since this time interval is always the same, this distinction can be ignored for the purposes of game logic.)
(技術說明:Box2D的報告實際上是碰撞的衝動,這是部隊所用的時間乘以每個世界同步,但由於這個時間間隔是一樣的,這種區別可以忽略而言的遊戲邏輯。)
Collision categories, masking, and groups碰撞類別,掩蔽和組
By default, all bodies collide with all other bodies, but you may want to fine-tune this behavior. For example, in the classic arcade game Asteroids, none of the asteroids collide with other asteroids, but all of them should collide with the player and with the enemy spaceships. There are two ways to accomplish this.
默認情況下,所有機構和所有其他機構的碰撞,但您可能要微調此行為。例如,在經典的街機遊戲小行星外,並無其他小行星與小行星碰撞,但他們都應該與球員發生碰撞,並與敵人的太空船。有兩種方法可以做到這一點。
First, you can assign categoryBits and maskBits to your objects via a "collision filter" definition, which is an optional table assigned during body construction. An object will only collide with other objects if their categoryBits are among its assigned maskBits. Normally, an object will only have one category bit assigned, but may have one or more mask bits depending on what other things it should collide with.
首先,你可以指定categoryBits和maskBits到你的對象通過“碰撞過濾器“的定義,這是一個可選的期間分配表體建設。對象將只與其他物體相撞,如果他們是在其指定的categoryBits maskBits。通常,一個對象只能有一個類別位分配,但可以有一個或多個掩碼位取決於什麼其他的事情就應該碰撞。
(Update: see the helpful collision filter worksheet and discussion posted here.)
(更新:請參閱表濾波器的有益碰撞與討論張貼在這裡。)
In the example below, the red balloon has a maskBits value of 3, so it would collide with any objects in category bits 2 and 1, which in this case would include other red balloons (category bit 2) or the wall objects (category bit 1). Meanwhile, it will pass through any blue balloons (category bit 4), since bit 4 is not included in its maskBits value.
在下面的例子中,紅色的氣球有maskBits值為 3,所以它與任何物體相撞類別2和1位,在這種情況下,將包括其他的紅氣球(類第2位),或在牆上的對象(類別位1)。同時,將通過任何藍色氣球(類別第4位),因為位4,不包含在其maskBits值。
--------------------------
borderCollisionFilter = { categoryBits = 1, maskBits = 6 } 
-- border collides with (4 & 2) only
 
borderBody = { friction=0.4, bounce=0.8, bodyType="static", filter=borderCollisionFilter }
 
local borderTop = display.newRect( 0, 0, 320, 1 )
physics.addBody( borderTop, borderBody )
 
local borderBottom = display.newRect( 0, 479, 320, 1 )
physics.addBody( borderBottom, borderBody )
 
local borderLeft = display.newRect( 0, 1, 1, 480 )
physics.addBody( borderLeft, borderBody )
 
local borderRight = display.newRect( 319, 1, 1, 480 )
physics.addBody( borderRight, borderBody )
 
local redCollisionFilter = { categoryBits = 2, maskBits = 3 } 
-- red collides with (2 & 1) only
 
local blueCollisionFilter = { categoryBits = 4, maskBits = 5 } 
-- blue collides with (4 & 1) only
 
local redBody = { density=0.2, friction=0, bounce=0.95, radius=43.0, filter=redCollisionFilter }
local blueBody = { density=0.2, friction=0, bounce=0.95, radius=43.0, filter=blueCollisionFilter }
 
redBalloon = display.newImage( "red_balloon.png" )
physics.addBody( redBalloon, redBody )
 
blueBalloon = display.newImage( "blue_balloon.png" )
physics.addBody( blueBalloon, blueBody )
--------------------------------------------------------
Note that categoryBits and maskBits are binary values that are currently assigned using decimal numbers. This is convenient for lower bits like 1, 2, 4 and 8, but not so convenient for higher bits -- since there are 16 possible categoryBits, the highest bit value is 32768. Therefore, future versions of this API may use a different bit assignment syntax, such as binary or hexadecimal values.
請注意,categoryBits和maskBits是二進制值是當前分配使用十進制數字。這是非常方便的低位元,如1,2,4和8,但不是很方便更高位 -因為有16種可能categoryBits,最高位的值是32768。因此,未來版本的該 API可能會使用不同的位分配語法,如二進制或十六進制值。
The second method is to assign a groupIndex to each object, via the same filter definition shown above. This value can be a positive or negative integer, and is a simpler way of specifying collision rules: objects with the same positive groupIndex value will always collide with each other, and objects with the same negative groupIndex value will never collide with each other.
第二種方法是分配一個 groupIndex每個對象,通過相同的過濾器定義上面。這個值可以是正或負的整數,是一個簡單的方式指定碰撞規則:對象與同樣積極的groupIndex值將始終相互碰撞,和對象具有相同的負 groupIndex值不會互相碰撞。
--------------------------
local greenCollisionFilter = { groupIndex = -2 }
--------------------------
If both groupIndex and collisionBits/maskBits are assigned to an object, the groupIndex has higher precedence.
如果同時 groupIndex和collisionBits/ maskBits被分配到一個對象,groupIndex 具有較高的優先 。
See the "CollisionFilter" sample code for an example of collision filtering.
參見“CollisionFilter“示例代碼示例碰撞過濾。
Collision event propagation rules碰撞事件傳播規律
Collision events in Corona now have a propagation model similar to touch events. You can use this to further optimize your game performance by limiting the number of events that are created.
碰撞事件的Corona現在有一個傳播模式類似觸摸事件。你可以用它來進一步優化你的遊戲的性能限制數量的事件所創建的。
By default, a collision between two objects will fire a local event for the first object, then a local event for the second object, then a global event in the Runtime object (assuming all have active listeners enabled). However, you may only be interested in some of this information. For example, in a game with one player character and lots of enemies, you may only be interested in what the player has collided with.
默認情況下,兩個物體之間的碰撞將觸發本地事件的第一個對象,然後是本地事件的第二個對象,然後是全球性事件中的運行時對象(假設所有監聽有積極的啟用)。但是,您可能只在一些有興趣的這些信息。例如,在一場比賽中與一名球員性格和大量的敵人,你可能只關心什麼球員相撞。
As of Alpha 3, any collision event handler that returns true will stop further propagation of that collision event, even if there are further listeners that would otherwise have received it. This allows you to further limit the number of events that are created and passed to the Lua side. While individual events are not very expensive, large numbers of them can affect overall performance, so limiting event propagation is a good practice.
作為 Alpha 3,任何碰撞事件處理程序返回true會停止進一步的傳播,碰撞事件,即使有進一步的監聽,否則已收到。這使您可以進一步限制數量的事件是創建並傳遞到 Lua 的一面。雖然個別事件不是很昂貴,大量可以影響他們的整體表現,因此限制了事件的傳播是一個很好的做法。
(繼續閱讀...)
文章標籤

createps 發表在 痞客邦 留言(1) 人氣(420)

  • 個人分類:Corona
▲top
  • 5月 12 週四 201111:30
  • Corona Physics Engine The Corona Physics API

Overview 概述
Corona makes it very easy to add physics to your games, even if you've never worked with a physics engine before. While the underlying engine is built around the well-known Box2D, we've taken a radically different design approach that eliminates most of the coding that is traditionally required.
Corona使得它很容易添加到您的物理遊戲,即使你從來沒有同一個物理引擎之前。雖然基礎引擎是建立在著名的Box2D的,我們已經採取了完全不同的設計方法,消除了最傳統的編碼是必需的。
More Information
For more information see the Corona Physics guide.
更多信息
欲了解更多信息,請參閱Corona物理指南。
Physics Engine The Corona Physics API
Corona makes it very easy to add physics to your games, even if you've never worked with a physics engine before. While the underlying engine is built around the well-known Box2D, we've taken a radically different design approach that eliminates most of the coding that is traditionally required.
Corona使得它很容易添加到您的物理遊戲,即使你從來沒有同一個物理引擎之前。雖然基礎引擎是建立在著名的Box2D的,我們已經採取了完全不同的設計方法,消除了最傳統的編碼是必需的。
In addition, we've tied physics seamlessly into mobile development: for example, using our new "gameUI" library, any physics object can now be made multitouch-draggable with one additional line of code.
此外,我們已經綁物理無縫移動開發:例如,用我們的新的“gameUI“庫,任何物理對象現在可以多點,拖動一個額外的一行代碼。
To work with the Corona physics engine, you begin with familiar Corona objects. Corona treats physical body properties as an extension of its graphics objects: any standard display object, including images, vector drawings, or animated sprites, can be “made physical”, and will automatically begin to interact with other objects in the simulation.
若要使用Corona物理引擎,你就開始熟悉的Corona對象。Corona處理的身體屬性,擴展其圖形對象:任何標準的顯示對象,包括圖片,向量圖,或動畫精靈,可以“做物理“,將自動開始與其他對象進行交互的模擬。
Our design goal is to allow users to think primarily in terms of visible game elements wherever possible, as opposed to constructing an invisible physical world and then attaching visible sprites afterwards.
我們的設計目標是讓用戶認為主要是在可見的遊戲元素方面盡可能,而不是構建一個無形的物質世界,然後附加可見精靈之後。
Also, Corona automatically translates between its familiar onscreen units and the internal metric units of the physical simulation. All position values are exposed in pixels, which are converted internally to meters at a default ratio of 30 pixels per meter (this ratio is user-settable with physics.setScale).
此外,Corona之間的自動轉換屏幕上熟悉的單位和公制單位的內部的物理模擬。所有位置值都暴露在像素,這是轉換內部米默認比例每米30像素(這個比例是用戶可設置與 physics.setScale)。
For consistency with the rest of the Corona SDK, all angular values are exposed in degrees, rather than radians, and position (0,0) remains at the upper left-hand corner of the screen, with the y-axis pointing downwards. Shape definitions should declare their points in clockwise order.
為了保持一致性,其餘的Corona SDK中,所有的角值都暴露度,而不是弧度而且位置(0,0)仍然在左上角在屏幕右下角,與 Y軸指向下方。形狀定義應申報點順時針順序。
Physics world setup物理世界格局
This line makes the physics engine features available under the “physics” namespace:
這條線使物理引擎可用功能下的“物理學“命名空間:
-------------
local physics = require "physics"
-------------
(繼續閱讀...)
文章標籤

createps 發表在 痞客邦 留言(0) 人氣(362)

  • 個人分類:Corona
▲top
  • 5月 11 週三 201116:07
  • Corona Animation and Motion Basic Motion and Transitions Part2


Advanced Animation Using Sprites先進的動畫使用精靈
What are Sprite Sheets?精靈是什麼表?
Sprite sheets are 2D animations packed as multiple frames into a single texture image. This allows a much more efficient use of texture memory, which is highly limited on mobile devices, and also minimizes loading time.
精靈表是二維動畫包裝成多個幀到一個單一的紋理圖像。這使得更有效地利用紋理內存,這是非常有限的移動設備,並最大限度地減少加載時間。
Corona supports two types of sprite sheets: those whose animation frames are all sized and positioned uniformly, and those whose frames have non-uniform sizes and positions. In the former case, you simply provide Corona with the width and height of each frame in the sprite sheet image file to create a new internal representation of the sprite sheet. The image below (from the JungleScene sample project that ships with Corona SDK) is an example of a sprite sheet with uniformly-sized frames.
Corona支持兩種類型的精靈表:那些動畫幀大小和位置都均勻,那些畫面有非均勻的的大小和位置。在前一種情況下,您只需提供Corona的寬度和高度每幀圖像中的精靈表文件來創建一個新的內部表示的Sprite表。下面的圖片(從 JungleScene示例項目,船舶與Corona SDK)是一個例子,一個精靈片均勻大小的幀。
(繼續閱讀...)
文章標籤

createps 發表在 痞客邦 留言(0) 人氣(289)

  • 個人分類:Corona
▲top
«1...56720»

最新文章

  • 中華電信、無線IP分享器和網路交換器如何連接
  • 把大容量的照片縮小, 圖片壓縮
  • 如何在Facebook建立應用程式
  • C# 網卡實體位置 record
  • C# 透過 WMI 取得硬碟序號 ( 物理 / 邏輯磁碟) record
  • C# ComboBox的MaxDropDownItems 沒反應 record
  • XNA 3D動畫,模型變型 record
  • C# 讀取大的圖檔時發生記憶體不足的問題。(轉載) record
  • C# 取得檔案類型 record
  • C# 是否為JPG檔案 record

文章精選

個人資訊

createps
暱稱:
createps
分類:
攝影寫真
好友:
累積中
地區:

熱門文章

  • (37,170)C# 取亂數 record
  • (20,934)C# 十進制轉各進制,再轉回來 record
  • (16,199)C# Dictionary用法 record
  • (15,017)C# lock record
  • (11,660)C# 字串變數, 如何包含雙引號或反斜線 record
  • (8,748)C# 取得目前時間:年 月 日 record
  • (5,849)C# ListView record
  • (2,213)C# 開啟執行檔 record
  • (1,266)VB和C# 字串比較 record
  • (253)用1-52數字表示撲克牌的每一張牌 record

文章分類

  • 網路硬體 (1)
  • Facebook (1)
  • 懷孕 (1)
  • 程式使用 (1)
  • XNA 4.0 (2)
  • DirectX (15)
  • Corona (29)
  • Lua (2)
  • Unity3D (3)
  • OS (2)
  • 輸入法 (1)
  • 大易 (1)
  • VB.NET (2)
  • Shader (1)
  • 技巧 (2)
  • 笑話 (1)
  • 創業 (4)
  • FTP (2)
  • SQL (1)
  • 歌曲 (4)
  • 物理 (1)
  • Apple (3)
  • Game (1)
  • Game (1)
  • C++ (4)
  • XNA (12)
  • GRD3 (1)
  • 喜歡的歌 (1)
  • C# (87)
  • 國外旅遊 (2)
  • 未分類文章 (1)

最新留言

  • [22/06/15] 訪客 於文章「中華電信、無線IP分享器和網路交換器如何...」留言:
    你好 為什麼我根據你的接法使用後 Wi-fi能使用 但是在交...
  • [22/04/15] 訪客 於文章「C# 大樂透對獎程式...」留言:
    回饋您這方面資訊,我是從 PTT搜尋引擎的排名,看...
  • [18/05/31] dwchen52 於文章「C# 讀取大的圖檔時發生記憶體不足的問題...」留言:
    謝謝你的建議,讓解決我的問題....
  • [18/05/11] y257574 於文章「把大容量的照片縮小, 圖片壓縮 ...」留言:
    x5PKD9ozVGQUIn5R1奢侈品仿牌,保固說到做到,...
  • [15/09/01] 菁 於文章「iphone 在首頁新增資料夾...」留言:
    謝謝您!...
  • [15/08/16] 訪客 於文章「C# 大樂透對獎程式...」留言:
    你好,我剛剛做出來了,原來我犯了一個很不該犯的錯誤… 因為...
  • [15/08/16] 訪客 於文章「C# 大樂透對獎程式...」留言:
    是的,我也是這麼想的,用f11看了幾次程式跑的流程… 很抱...
  • [15/08/15] 訪客 於文章「C# 大樂透對獎程式...」留言:
    你好,目前我在學寫程式 老師上課的範例 在中了幾號碼那邊...
  • [15/03/08] 俴 誏 ? 闚 於文章「把大容量的照片縮小, 圖片壓縮 ...」留言:
    比們地要點重他一並開物我不工問得到時多點要為上 氣~質...
  • [15/02/25] 訪客 於文章「C# 大樂透對獎程式...」留言:
    大大可以私密教我寫兌獎嗎?我剩下兌獎了 其他都好了...

文章搜尋

誰來我家

參觀人氣

  • 本日人氣:
  • 累積人氣: