Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 3.0 (http://www.flasher.ru/forum/forumdisplay.php?f=83)
-   -   как работает Genome2D? (http://www.flasher.ru/forum/showthread.php?t=181254)

FriOne 19.06.2012 15:56

как работает Genome2D?
 
Хочу попробовать переделать приложение со старлинга на геном,
но не могу понять как у него работает система координат,
вроде все понятно, но отображается какая-то лажа.

Код такой:
Код AS3:

                private function createGenome():void
                {
                        Genome2D.getInstance().onInitialized.addOnce(onGenomeInitialized);
                        Genome2D.getInstance().init(stage, new GContextConfig());
                }       
        private function onGenomeInitialized():void
                {
                        trace("onGenomeInitialized");
                        var genome2D:Genome2D = Genome2D.getInstance();
 
                        _container = GNodeFactory.createNode("container");
                        genome2D.root.addChild(_container);
                        genome2D.onCameraAdded.addOnce(onCameraAdded);
 
                        _cameraNode = GNodeFactory.createNode("camera");
                        var camera:GCamera = _container.addComponent(GCamera) as GCamera;
                        _container.addChild(_cameraNode);
                }
 
                private function onCameraAdded(gCamera:GCamera):void
                {
                        var texture:GTexture = GTextureFactory.createFromBitmapData("texture", new BitmapData(stage.fullScreenWidth, stage.fullScreenHeight, false, 0xFF0000), true);
                        var sprite:GSprite = GNodeFactory.createNodeWithComponent(GSprite, "sprite") as GSprite;
                        sprite.setTexture(texture);
                        _container.addChild(sprite.node);
 
                        texture = GTextureFactory.createFromBitmapData("textureId", (new wallClass() as Bitmap).bitmapData, true);
                        var i:int = 10;
                        var j:int = 10;
                        while (i--)
                        {
                                while (j--)
                                {
                                        sprite = GNodeFactory.createNodeWithComponent(GSprite, "sprite" + i + j) as GSprite;
                                        sprite.setTexture(texture);
                                        sprite.node.onMouseDown.add(onMouseDownHandler);
                                        sprite.node.onMouseMove.add(onMouseMoveHandler);
                                        sprite.node.onMouseUp.add(onMouseUpHandler);
                                        sprite.node.transform.x = i * 64;
                                        sprite.node.transform.y = j * 64;
                                        _container.addChild(sprite.node);
                                }
                                j = 10;
                        }
                }

Фон и остальные кубы с текстурой по идее должны быть в одной координатной плоскости, но нифига..
Бибиотека Генома: https://github.com/pshtif/Genome2D/downloads


Часовой пояс GMT +4, время: 13:43.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.