1 / 18

A játékfejlesztés alapjai a

A játékfejlesztés alapjai a. keretrendszerrel. Lőrincz Vilmos Webstar Csoport Kft. 2013.04.25. Kiválasztás. Előnyök, hátrányok. Objective C. ✔. ✘. Komponensek. ✔. Editor támogatás. ✔. é s támogatás. ✔. Kényelmes. ✔. ✘. ARC nincs. ✘. Felépítés. UIKit.framework.

tait
Download Presentation

A játékfejlesztés alapjai a

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A játékfejlesztés alapjai a keretrendszerrel Lőrincz Vilmos Webstar Csoport Kft. 2013.04.25.

  2. Kiválasztás

  3. Előnyök, hátrányok Objective C ✔ ✘ Komponensek ✔ Editor támogatás ✔ és támogatás ✔ Kényelmes ✔ ✘ ARC nincs ✘

  4. Felépítés UIKit.framework CCDirector:UIViewController UIWindow UINavigationController CCScene CCScene CCScene CCLayer CCLayerColor CCMenu CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite CCSpriteBatchNode CCMenuItem CCMenuItem CCMenuItem CCMenuItem CCParticleSystem CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite :CCNode

  5. CCScene a gyakorlatban CCSprite CCMenu CCLayer CCMenuItem CCMenuItem CCSpriteBatchNode CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite CCSprite

  6. Update és draw update update update update update update draw draw draw draw draw draw draw draw draw draw draw draw CCNode idő

  7. Actions • forgatás • mozgatás • torzítás • átlátszóság • színezés • animáció • …

  8. Action példa CCSprite *sprite = [CCSprite spriteWithFile:@”ball.png”]; [spriterunAction: [CCRepeatForever actionWithAction: [CCSequence actions: [CCEaseIn actionWithAction: [CCRotateBy actionWithDuration:0.5angle:30.0] rate:2], [CCEaseOut actionWithAction: [CCRotateBy actionWithDuration:0.5angle:-30.0] rate:2], nil ] ] ];

  9. 1.x  OpenGLES 1.1 • összes iPhone, • összes iPod Touch, • összes iPad • 2.x  OpenGLES 2.0 • iPhone 3GS-től, • iPod Touch 3. generációtól, • összes iPad

  10. Egy sprite létrehozása Cocos2D CCSprite *sprite = [CCSprite spriteWithFile:@”ball.png”];

  11. Egy sprite létrehozása OpenGLES 2.0 glGenVertexArrays(1, &_vao); glBindVertexArray(_vao); glGenBuffers(1, &_vbo); glBindBuffer(GL_ARRAY_BUFFER, _vbo); glBufferData(GL_ARRAY_BUFFER, sizeof(ccV2F_C4B_T2F) * _bufferCapacity, _buffer, GL_STREAM_DRAW); glEnableVertexAttribArray(kCCVertexAttrib_Position); glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, sizeof(ccV2F_C4B_T2F), (GLvoid *) offsetof(ccV2F_C4B_T2F, vertices)); glEnableVertexAttribArray(kCCVertexAttrib_Color); glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ccV2F_C4B_T2F), (GLvoid *) offsetof(ccV2F_C4B_T2F, colors)); glEnableVertexAttribArray(kCCVertexAttrib_TexCoords); glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, sizeof(ccV2F_C4B_T2F), (GLvoid *) offsetof(ccV2F_C4B_T2F, texCoords)); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); ... glActiveTexture( GL_TEXTURE0 + textureUnit ); glBindTexture(GL_TEXTURE_2D, textureId ); glGenerateMipmap(GL_TEXTURE_2D); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); ... ccColor4B color = (ccColor4B){255, 255, 255, 255}; vertices[0] = {{ 0.0, 100.0}, color, {0.0, 1.0}}; vertices[1] = {{ 0.0, 0.0}, color, {0.0, 0.0}}; vertices[2] = {{100.0, 100.0}, color, {1.0, 1.0}}; vertices[3] = {{ 0.0, 0.0}, color, {0.0, 0.0}}; vertices[4] = {{100.0, 100.0}, color, {1.0, 1.0}}; vertices[5] = {{100.0, 0.0}, color, {1.0, 0.0}};

  12. Sprite-manipuláció • Cocos2D • elforgatás, • kicsinyítés, nagyítás, • eltolás, • nyírás (skew) • átlátszóság, • textúra színezése, torzítása • OpenGLES 2.0 • mátrixtranszformáció • shader-ek és blending

  13. Forgatás OpenGLES alatt OpenGLES 1.1 glRotatef(m_currentAngle, 0, 0, 1); OpenGLES 2.0 float radians = m_currentAngle * Pi / 180.0f; float s = sinf(radians); float c = cosf(radians); float zRotation[16] = { c, s, 0, 0, -s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; GLint modelviewUniform = glGetUniformLocation(m_simpleProgram, "CC_MVPMatrix"); glUniformMatrix4fv(modelviewUniform, 1, 0, &zRotation[0]);

  14. OpenGL Shading Language OpenGLES 2.0 alatt Vertex shader Fragment shader varying vec4 v_fragmentColor; varying vec2 v_texCoord; uniform sampler2D CC_Texture0; void main() { lowp vec4 color = v_fragmentColor * texture2D(CC_Texture0, v_texCoord); gl_FragColor = color; } uniform mat4 CC_MVPMatrix; attribute vec4 a_position; attribute vec2 a_texCoord; attribute vec4 a_color; varying lowp vec4 v_fragmentColor; varying mediump vec2 v_texCoord; void main() { gl_Position = CC_MVPMatrix * a_position; v_fragmentColor = a_color; v_texCoord = a_texCoord; }

  15. Ami kimaradt… • Cocos2D • particle-ök • hangkezelés • fontkezelés • texture map kezelés • egyszerű formák rajzolása • Cocos2D Android és HTML5 alatt • CocosBuilder • OpenGL • szinte minden 

  16. Kérdések?

  17. Köszönöm a figyelmet!

More Related