Preview of "RICcreator", yet another RIC editor

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Preview of "RICcreator", yet another RIC editor

Post by afanofosc »

There isn't a spec for RICScript that I am aware of. I created it all on my own so I doubt that there is a spec that I am not aware of. Have a look at ricscript_api.txt.

http://bricxcc.svn.sourceforge.net/view ... iew=markup

You can see the entire parsing code in the BricxCC SVN repository.

http://bricxcc.svn.sourceforge.net/view ... iew=markup

http://bricxcc.svn.sourceforge.net/view ... iew=markup

Whitespace is treated like it is in a C program. C/C++ comment styles are supported also. If you have any questions just ask.


John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

Re: Preview of "RICcreator", yet another RIC editor

Post by spillerrec »

New version is up, RICcreator rev.130 - win32.zip

More details on my blog:
RICcreator – September update (This includes updates in rev.127)
Loading RIC files from a byte stream

Changes:
Adaptive thresholding is added. A bit more tricky to get good results with, so global thresholding is still default.
Image
Global to the left, adaptive to the right

It is now possible to internally read/write ricfiles to both files and byte arrays, previously only files where possible. Because of this following changes where made:
  • Default font is now embedded into the program.
  • Export to C header containing a char array added. (needs polishing though)
This addition is going to be more relevant in the future, check the second blog post for details.

CopyBits now automatically finds the nearest sprite and change its size to fit it when added.

A command line interface for converting supported file types to another is now added. Check the first blog post for details. Sadly I can't get it to write error messages back to the console on incorrect syntax, it appears to be blocked since it is a GUI application...

A couple of bug fixes.

Up next
I will create an abstract interface between the main window and the tab widgets. This is partially because it will be needed anyway for when I need to make a special RIC font editor and a simple editor, but also because communication between the two right now is implemented in a stupid way.
So first after this have been improved I will start on RICScript. Most likely only exporting to RICScript at first, but perhaps also parsing, we will see.
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: Preview of "RICcreator", yet another RIC editor

Post by muntoo »

Portability issue. This line:

Code: Select all

unsigned char file_data[ bytes ];
Gives the error in VS2010:

Code: Select all

src\riclib\nxtIO.cpp(36): error C2057: expected constant expression
Try:

Code: Select all

#include <vector>
std::vector<unsigned char> file_data (bytes);
(You'll need to fix a few more things.)

BTW, I see you using raw pointers. This is C++; use smart pointers! (Or references... Or smart pointers!)
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

Re: Preview of "RICcreator", yet another RIC editor

Post by spillerrec »

muntoo wrote:Portability issue. This line:

Code: Select all

unsigned char file_data[ bytes ];
I fixed the two occurrences of this in nxtIO.cpp. If there are more issues to fix you will have to give me the full error log.
For now I just changed it to a pointer based array instead, using a vector here is overdoing it a bit imo.

I haven't been using smart pointers because I simply never have heard of them before. Seeing however that you can still screw up with them, I will wait a bit until I fully understand them. Seeing how one of the default templates are deprecated in C++11 is a bit annoying though. (They finally changed the name, I was kinda hoping they would stick to C++0x for the fun of it.)

Since I have not been using copy-constructors I have been a bit careful with passing objects, I have always used pointers to be sure nothing went wrong. However passing them by reference should avoid this?

Code: Select all

class object;
void foo( const object &obj ); //Read-only
void bar( object &obj ); //Read and Write
These two functions will not invoke any copy operation right? (I'm just a bit paranoid, so I want to be sure...)

I finally have access to a decent library (well two actually, but the university's library is better) so I can finally start relearning C++. (And I need a primer in C# too...)
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: Preview of "RICcreator", yet another RIC editor

Post by muntoo »

I haven't looked in your source code in much detail (only for about a minute or two, yesterday), but those were the things that struck me.

According to this, the following are pass-by-references. (i.e. No copy constructor.)

Code: Select all

object obj;
foo(obj);
bar(obj);
Also, if you don't have a C++11 compiler, you can always use Boost. :) (MSVS2010 is a partial-C++0x compiler. :()
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

Re: Preview of "RICcreator", yet another RIC editor

Post by spillerrec »

I do think you have a point, I use pointers a lot and I think I will be able to replace many of these with references instead. It should replace all those stupid NULL checks:

Code: Select all

void foo( object *obj ){
   if( !obj )
      return;
   ...
Pushing the responsibility of *obj being valid to the caller instead of the callee is much better in my opinion.
So when I have finished the abstract interface (which will be either tomorrow or somewhere towards the end of next week) I will do some code cleanup, replacing some of those pass-by-pointer with pass-by-reference. No smart-pointer stuff for now though.
muntoo wrote:Also, if you don't have a C++11 compiler, you can always use Boost.
I want to keep "riclib" portable, so I will not use C++11 until it is widely supported even if my compiler supported it.
I also want to keep it free from dependencies, but since this Boost library appears to just be headers I guess it might work out anyway.

Edit:
Abstract interface almost done, quite a bit of work had to be done. More detail on the blog later, but the memory use when having multiple files open has dropped greatly.
However since I'm going on a "field trip" for a couple of days it will probably first be done on Thursday/Friday.
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

Re: Preview of "RICcreator", yet another RIC editor

Post by spillerrec »

I wasn't quite able to sleep so I did some more work on this. The interface appears to be working as it should now, I think I managed to fix the worst regressions.
Download RICcreator rev. 133 - win32

So the only actual addition is this:
tabbar.jpg
tabbar.jpg (5.72 KiB) Viewed 9123 times
The tab text will become red and postfixed '*' when the file has been edited.
I have also improved the error messages when file loading fails, but this should only show very rarely anyway...
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

Re: Preview of "RICcreator", yet another RIC editor

Post by spillerrec »

I added a simple editor which only shows the sprite:Image(The interface is completely the same as the normal sprite editor, I just changed it a bit.)
Is this sprite editor good enough for less experienced users, or is it not intuitive enough?

Download: RICcreator rev. 139 - win32.zip
(Notice: The full editor's toolbar disappears when you change forth and back between the editors at the moment.)
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

Re: Preview of "RICcreator", yet another RIC editor

Post by spillerrec »

New release, highlights:
  • Polygon can be filled
  • Sprite is no longer created with size 100x64, it will be autosized when you start drawing.
  • Scrollbars (somewhat) improved in sprite editor
  • Dithering possible when importing images
  • Adaptive thresholding improved
Full details at my blog: RICcreator – October update

Downloads:
RICcreator rev. 154 – win32.zip
RICcreator rev. 153 – src.zip
Please delete any settings.xml files from previous versions, as otherwise it might crash. XML loading is quite terrible at the moment... :oops:
Anyway, fixed an issue which could cause settings.xml files to appear at other places than the .exe folder, so you can delete those files too.
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 4 guests