Pixas has been added to wonderfl.net Libraries

Pixas has been added to wonderfl.net online building Libraries, which means from now on you can import the pixas classes when building applications on wonderfl.net
Cheers, thanks to mash and sugi!

Check how it behaves here:
http://wonderfl.net/search?q=com.risonhuang.pixas

This is an examle:

And here’s the code:

package 
{
	import com.bit101.components.*;
	import com.risonhuang.pixas.dimensions.CubeDms;
	import com.risonhuang.pixas.colors.CubeColor;
	import com.risonhuang.pixas.objects.PixelObject;
	import com.risonhuang.pixas.objects.primitives.Cube;
    import flash.display.Sprite;
    import flash.events.Event;
    
    /**
     * @author max.huang
     * @see http://code.google.com/p/pixas/
     */
    public class Main extends Sprite 
    {
        private var vBox:VBox;
        private var vBoxColor:VBox;
        private var vBoxBorder:VBox;
        private var sliX:HUISlider;
        private var sliY:HUISlider;
        private var sliZ:HUISlider;
        private var colorChooser:ColorChooser;
        private var cb:CheckBox;
		private var outPO:PixelObject;
        
        public function Main():void 
        {
            outPO = new PixelObject();
            outPO.x = Math.floor(stage.stageWidth / 2);
            outPO.y = Math.floor(stage.stageHeight / 2);
            addChild(outPO);
            
            //control menu
            vBox = new VBox(this , 5, 4);
            var lableA:Label = new Label(vBox, 0, 0, "Cube dimension:");
            sliX = new HUISlider(vBox, 0, 0, "X", updateCube);
            sliY = new HUISlider(vBox, 0, 0, "Y", updateCube);
            sliZ = new HUISlider(vBox, 0, 0, "Z", updateCube);
            var s:HUISlider;
            for each(s in [sliX, sliY, sliZ])
            {
                s.setSliderParams( 6, 220, 100);
                s.tick = 2;
                s.labelPrecision = 0;
            }
            sliZ.tick = 1;            
            vBoxColor = new VBox(this , 5, 110);
            var lableB:Label = new Label(vBoxColor, 0, 0, "Cube top side color:");
            colorChooser = new ColorChooser(vBoxColor, 0, 0, 0xE6E8E9, updateCube);
            colorChooser.usePopup = true;
                        
            vBoxBorder = new VBox(this , 5, 180);
            cb = new CheckBox(vBoxBorder, 0, 0, "Cube border", updateCube);
            cb.selected = true;
                        
            updateCube();
        }
        
        private function updateCube(e:Event = null):void
        {
            while (outPO.numChildren > 0)
            {
                outPO.removeChildAt(0);
            }
			var dms:CubeDms = new CubeDms(sliX.value, sliY.value, sliZ.value);
			var color:CubeColor = CubeColor.getByHorizontalColor(colorChooser.value);
            var cube:Cube = new Cube(dms , color, cb.selected);
			outPO.addChild(new PixelObject(cube));
        }
    }
}
Advertisements

6 responses to “Pixas has been added to wonderfl.net Libraries”

  1. Colin says :

    Hello,

    I have been using your library to create a simple isometric object builder (and perhaps a game in the future!)

    One thing I have noticed is that in your ColorGeom class, in your ‘applyBrightness’ function, when applying brightness, you don’t preserve the alpha value.
    To fix this, in the applyBrightness function, I have added in the following lines:

    var a: int = (color >>> 24) & 0x000000FF;

    (at the top, where you split the hex colour into r,g,b)

    And then your return becomes:

    return (a << 24) | (r << 16) | (g << 8) | b;

    Well, I'm sure you know the code anyway, but I like to try and help!

    You've created a wonderful tool, and I look forward to seeing it grow :)

    Oh, one request, would you be able to add in sloping tiles? (such as these: http://www.openspace-engine.com/images/support/manuals/editor/tileEditor_2.png)

    Thank you for all of your hard work :) Good luck in the future!

    • max says :

      Hi.Colin,thanks for your contributing. I’ve published the new version.
      I am also working on an ismetric object builder these days, but I found it quite hard to complete because too many features have to be deployed. Anyway I will release it out when most parts are finished.
      Then after it, i will definitely add the sloping tiles you mentioned:) It won’t be long.

      • Colin says :

        I see you’ve added a section for your Pixas Editor.
        How is this coming along? What challenges have you faced with it?

        I’ve built my own editor, which I will share with you soon. It includes a top-down view, a side-view, rotation, ‘perfect’ sorting of objects, collision checking and the all-important ‘paradox’ fix. (Where object A is behind object B, which is behind object C, which is behind object A!)

        Let me see if I can find a quick screenshot for you… – I’ll get one later when I’m home from work :)

        I hope to add in an ‘export/import’ tool, which will dump the objects created to a string, perhaps to a database to build a library of objects. I am also hoping to add in the concept of ‘frames’, to build animated isometric objects.

        Then my next plan is to be able to build isometric ‘worlds’ from these blocks, and hopefully even make them fully destructible! (Well, that’s the dream)

        Is there anything you need help with on your Pixas Editor?

      • max says :

        Thanks a lot Colin, my building editor is almost done, all is well since now and it will be release in days. Anyway, it is just an editor basically for designer I suppose. You can add object onto the canvas as a layer, operate the layers, manipulate all of the properties of the objects. I’ve finished the export/import function, and the draw data can be saved to local disk.

        Was curious how could you implement the collision checking and rotation for these pixel objects. Looking forward to your version:)

  2. Colin says :

    I dreamed up a solution to the rotation which worked pretty well, I’m going to write it up in full on my blog in the next couple of days so I will keep you posted, I’ll do the same with the collision checking as well, but I need to tidy up my code a bit first! I went through so many versions trying to get things working and it’s a bit of a mess.

    I have a demo of my object builder here:
    http://pixeldiff.com/portfolio/pixas-object-builde/
    It’s still a work in progress though, so I’m sure it has a few bugs! (There are also keyboard controls, but I need to refine those) My builder was originally built for iOS, but I’m going to update the layout and the user interface so it’s more friendly for desktop :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s