Topic: JBlocks: Java Brickset Designer

Hi everyone!

I'm back here! The other day I was playing around with the last version of Open Surge and I remembered old times here. Now I'm practising with Java, and I thought it would be a great idea to design a tool to create bricksets easily.
The old Celdecea's editor wasn't but, but it had some problems. I didn't like the new online brickset tool, so I decided to do this tool. I also want to continue learning Java doing apps and I think I can try with an object designer. I can't promise any, but I want to do it.

In principle, I'm not going to be here as before (my time is really limited), but I'll be here next weeks to give support to this software and that things. However, you will see me sometimes n.n

Well, here you are. TheSeventhEmerald's JBlocks editor! big_smile

LAST UPDATE: 10/ FEB / 2014   CURRENT VERSION: 1.0.4

How to use it

Features

- Create bricks by selecting with the mouse.
- Calculate the brick angle automatically.
- Supports brick animation.
- Zoom.
- Custom grid size and color.
- Create, open and save any brickset.

Changelog

- 1.0.0: Uploaded.
- 1.0.1: Added custom grid, added "New" button. Fixed a bug on brick selection.
- 1.0.2: Fixed bugs on "Update Brick" and writing files. Fixed the bug opening some bricksets. (Read more down)
- 1.0.3: fixed the problem with the images and some bugs with the "Add Brick" button.
- 1.0.4: More bugfixes n.n

Instalation

Simply download the .jar file. Double-click it to open the application. It's a good idea to copy the .jar inside your open surge folder, it will make easier open / save files.

When I double-click the file, nothing happens! In this case, check if you have installed last Java update: Java download. If after installing the last version of Java you can't start the program:

- Open a terminal. Go to the folder where JBlocks.jar is located.
- Type

java -jar JBlocks.jar

- Check if an error occurs. In that case, take a screenshot and post it here to get support. It could be a software bug.
- You can check your current Java version typing in a terminal:

java -showversion

Use

- First, import an image with File > Import image. A dialog will be opened: it shows the folder where JBlock is. Find the image you want to show and click "Open".

- Now, you can start adding bricks. Select a region on the image, and adjust it using the location / width,height spinners. Once you have selected your brick, choose the properties (passable, circular, zindex, etc). After set the properties, click the "Add Brick" button; you'll see a "Brick 1" in the Block List.

-You can zoom the image as you want. The selection rectangle looks like it's not being scaled, but it is xD You only have to make a new rectangle or click the buttons. However, I recommend you to select your preferred zoom level and work always with it.

- To set correctly the angle of a block, click on the button where says "PLANE (0)". A list of angle types will appear. Select the orientation of the angle, and it will be automatically calculated. You can adjust it if you need.

- To set an animated brick, click on the "Animated" property and choose the frame width and height.

- If you want to edit a brick, simply click it on the Block List. You'll see that the selection rectangle gets the brick and its properties will be automatically displayed. You can now edit your brick. After finish, click the "Update Brick" button.

- Click on File > Save as... to save your brickset to a now file. Click on File > Save to overwrite the current file. You also can open a brickset with File > Open. When you open a brickset, the brick list appears and the source image of the brickset will be displayed.

- If you have problems to see the selection rectangle, you can click on Configure > Rectangle Color and change the selection color.

- If you check the Configuration > Use grid button, a dialog will appear. Choose the grid size. Now a grid will appear and the selection will adjust the grid. Uncheck the button to hide the grid. You can change the grid color with Configuration > Grid Color.

- EOF error: you may receive an error opening some bricksets. If a message appears saying you have an "EOF error" simply open (with a text editor) the .brk file and write this comment at the end:

//J_EOF

That should make the trick. In 1.0.3, all problems with images were fixed, I think. If you find some issue, please say.

Bugs / Errors

If you find a bug, please tell me here. I'll do the possible to fix the errors.

KNOWN PROBLEMS:

For now, there's no known errors. If you receive an alert about an EOF error, you only have to read above how to solve it.


And enjoy the app!

Last edited by TheSeventhEmerald (2014-02-10 13:11:06)

Piece of cake...!

Re: JBlocks: Java Brickset Designer

I must say, this is THE MOST AWESOME BRICKSET EDITOR EVER

One tiny little constructive criticism, though: It lacks a grid and as such, also grid snapping.

Is it possible to add an adjustable grid with snapping? Would make it easier to work with standard sizes like 16*16, 32*32, etc

Also, if you're so eager to make helper apps, a group designer would also be a handy addition smile

Last edited by KZR (2014-01-07 14:40:00)

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: JBlocks: Java Brickset Designer

Happy to see you liked it.

It's a wonderful idea. I didn't think it. It was a easy feature to add, now you have a custom-sizable grid. The selection is adjusted to the grid. It's in the Configure button.

I want to practise doing Java apps, and making helper applications for Open Surge is an excellent idea; my idea was to make a object designer. A group creator could be also good, I'll take note of that smile

Piece of cake...!

Re: JBlocks: Java Brickset Designer

"Open" doesn't work when there are comments above the first brick in the .brk script

You can also add to the suggestion pool a background designer tongue

Last edited by KZR (2014-01-08 21:51:36)

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: JBlocks: Java Brickset Designer

hey TheSeventhEmerald, welcome back!

This looks really good! wow! If I open an existing .brk file, is it possible for the program to load the image automatically?

Re: JBlocks: Java Brickset Designer

Yes, when you load an existing .brk file, it loads the image automacally, or it should xD The only file that doesn't work  is in desert1.brk, where, as KZR said, the file start different.

I'm not reading the file counting characters or lines; the program reads the file until it finds "brick", "type" or other keywords.  In principle, the program ignore commented lines. I had that problem before while coding, but it "magically" got fixed. Looks like "magically" has come again tongue The problem is that the reader passes the end of file and is getting a line as "null" and giving some problems. Now I'm trying to find why is doing that.
However, I think the bricks are loaded correctly (not the image, but the brick). I may make some proves more.

Last edited by TheSeventhEmerald (2014-01-10 16:53:43)

Piece of cake...!

Re: JBlocks: Java Brickset Designer

TheSeventhEmerald,

I like the app. It is very useful for drawing out bricks quickly.

I tried it out on a small brick image, though, and it seemed
to not align the brick rectangles to the image underneath.
Maybe JBlocks is not compensating for the image centering
it does on screen when the image is small?

The problem goes away when I zoom in and the brick image is
bigger than the scroll view.

Since most used brick images are large, you might ignore
the issue anyway. hmm

-- svgmovement

Re: JBlocks: Java Brickset Designer

Mmm, you've reason, I haven't proved  small images. As you said, usually the images are really large;
Well, at least when you zoom the image, it works. I spent a lot of time to make the zoom works good. I was very worried about that feature because it was difficult to integrate. I'm happy with the results big_smile

I'll take a look to that issue after the exams. It's not urgent since you can get rid of the problem zooming the image. However, I want the app to be 100% working and complete.

Thanks for the information!

Piece of cake...!

Re: JBlocks: Java Brickset Designer

UPDATE: I found errors on the 'Update Brick' button so I fixed them.
Also, I fixed the problem with some .brk files. As I thought, it was a problem reading the EOF. I couldn't find why exactly the error appeared, because some bricksets worked well. I wrote the solution to the problem in the original post above.

However, the image sometimes has to be loaded manually. At least,  the error is now completely fixed, I think. If you detect some issue with this, please say.

Piece of cake...!

Re: JBlocks: Java Brickset Designer

Hi, you've inspired me to design a tool to help the brickset creation.. It's to work with your program, use my app first and do the advanced stuff with your app
http://opensnc.sourceforge.net/forum/vi … ?pid=13346

Re: JBlocks: Java Brickset Designer

I'll take a look, as I said in your post, I don't know if they will be compatible.  However that has a really easy solution. smile

Well, update to the update. See what WONDERFUL thing I found on my code:


file = new File("C:\\Users\\(My user)\\opensnc-win-latest\\"+bricks.get(0).imageSource);

That's why the images were not loading on your computers... that only worked on mine! tongue Well, now is fixed. Also fixed another bug on creating bricks. The last problem on updating bricks and this on creating gave lot of problem to the user, but now they should be completely fixed. cool

So, new revision uploaded.

Piece of cake...!

Re: JBlocks: Java Brickset Designer

It works now

It's compatible, at least when I save I can see that your program add all the other stuff:

Edit (bug found): But there is a bug, it doesn't load the last brick, in this file test.png from my app must be 5 bricks and there are only 4

Edit 2: And why there are some 0kb files generated? Is saved 'test.brk' and 'test'

//=========================================
//  This file have been created with     //
//  TheSeventhEmerald JBlocks app        //
//=========================================



brick 0
{
    type                    OBSTACLE
    behavior                DEFAULT
    angle                   0
    zindex                  0.5

    sprite
    {
        source_file             images\test.png
        source_rect             381 4 169 167
        frame_size              169 167
        animation               
        {                       
            repeat                  TRUE
            fps                     8
            data                    0
        }                       
    }
}



brick 1
{
    type                    OBSTACLE
    behavior                DEFAULT
    angle                   0
    zindex                  0.5

    sprite
    {
        source_file             images\test.png
        source_rect             202 7 169 167
        frame_size              169 167
        animation               
        {                       
            repeat                  TRUE
            fps                     8
            data                    0
        }                       
    }
}



brick 2
{
    type                    OBSTACLE
    behavior                DEFAULT
    angle                   0
    zindex                  0.5

    sprite
    {
        source_file             images\test.png
        source_rect             313 190 169 167
        frame_size              169 167
        animation               
        {                       
            repeat                  TRUE
            fps                     8
            data                    0
        }                       
    }
}



brick 3
{
    type                    OBSTACLE
    behavior                DEFAULT
    angle                   0
    zindex                  0.5

    sprite
    {
        source_file             images\test.png
        source_rect             96 191 169 167
        frame_size              169 167
        animation               
        {                       
            repeat                  TRUE
            fps                     8
            data                    0
        }                       
    }
}

Last edited by lainz (2014-02-08 14:00:25)

Re: JBlocks: Java Brickset Designer

Now the software should recognize all your bricks. I forgot a +1 xD
Also fixed the problem of the 0kb files.

Piece of cake...!

14

Re: JBlocks: Java Brickset Designer

Jobro please make this sticky wink

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

15

Re: JBlocks: Java Brickset Designer

sorry for double posting, i have a bug report:

*grid does not scale when image is zoomed in/out
*on Linux (Ubuntu 14.04 Gnome desktop) the image turned black and white when i zoomed. On Windows i never had this problem.

https://dl.dropboxusercontent.com/u/20216605/Screenshot%20from%202014-04-13%2020%3A28%3A49.png

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: JBlocks: Java Brickset Designer

Ok. Looks like I forgot to update the grid size when scaling...
But I have no idea why it's happening the problem with colors.  I'll try to fix it, but I'm not sure if I will be able to fix.

Thanks!

Piece of cake...!

Re: JBlocks: Java Brickset Designer

Announcement: I've added JBlocks on user-made tools section in the wiki. I put there all the info in this topic and a download link.

Here's is the page: http://opensnc.sourceforge.net/wiki/index.php/JBlocks

Piece of cake...!

Re: JBlocks: Java Brickset Designer

thanks lol

Re: JBlocks: Java Brickset Designer

I've had two issues while using this program

1). When you save your work to a .brk file, any further changes you make and save don't get overwritten to the .brk file, even though if you make changes the program doesn't prompt you to save changes. I first saved it when I made brick 34 and then proceeded to make about 150 more bricks, and none of them got written to the file even though I did Ctrl+S multiple times, and I'm kind of pissed off by that.

2). Opening existing .brk files made with JBlocks doesn't do anything. (i.e., going to File>Open>example.brk closes the file window but doesn't load the brickset)

Last edited by S32X (2016-03-27 22:47:11)

Re: JBlocks: Java Brickset Designer

S32X wrote:

I've had two issues while using this program

1). When you save your work to a .brk file, any further changes you make and save don't get overwritten to the .brk file, even though if you make changes the program doesn't prompt you to save changes. I first saved it when I made brick 34 and then proceeded to make about 150 more bricks, and none of them got written to the file even though I did Ctrl+S multiple times, and I'm kind of pissed off by that.

2). Opening existing .brk files made with JBlocks doesn't do anything. (i.e., going to File>Open>example.brk closes the file window but doesn't load the brickset)


1). If I remember well, I haven't added ANY shortcuts to the app, so Ctrl+S currently does nothing. You have to File > Save any time you want to save.

2). Really? I'm sure I proved that feature carefully. I'll give another look to that, but I need some time to do it.

Piece of cake...!