[Tool]FemtoIDE

I ran into that same thing. I think an error throws even I’d you just do any number with f. So 5f for example blew up. If I’m remembering accurately

Java is supposed to create one for you if one isn’t already specified.
It’s called the ‘default constructor’.

From Oracle docs:

The compiler automatically provides a no-argument, default constructor for any class without constructors. This default constructor will call the no-argument constructor of the superclass. In this situation, the compiler will complain if the superclass doesn’t have a no-argument constructor so you must verify that it does. If your class has no explicit superclass, then it has an implicit superclass of Object, which does have a no-argument constructor.

Wait a minute, if it wasn’t already doing that, what was happening?
Were the member variables/fields (Oracle can’t make up their minds) just not being initialised?


Interesting.

In C++ 5f is an error because of parsing rules,
but I believe in Java it’s supposed to be allowed.

Once upon a time in college I saw this book that had a complete Java syntax diagram,
but unfortinately I haven’t been able to find anything like that online so far.

Yup. Hence the sprite bug.

1 Like

Well that’s not in the spec…
I think your Java has a bit too much C++ in its blood. :P

(Though technically in C++ even when the member variables aren’t initialised there’s still a constructor call, it’s just considered empty and thus reduces to a nop.)

Indeed, which is why I just fixed it.

There’s still a lot of work to be done. The nested-classes thing is only partially implemented, for example (it only works if they’re static), and the Java compiler leaves some type-checking to GCC (which is why you can use an int type in the condition of an if).

Nevertheless, enough of the language has been implemented for it to be useful and limitations shouldn’t be too hard to side-step.

1 Like

That was a joke…

Honestly I’m not surprised.
I know how difficult compilers are, I’ve attempted to implement one or two in the past.
(Anyone who doesn’t know, get reading. LALR, shift-reduce, recursive descent, Backus–Naur form… yet another onslaught of terminology to memorise.)

I’d attempt to help out, but it would be yet another thing on my todo list,
my knowledge of Java isn’t particularly good, and I don’t like using JavaScript.
(I’m presuming that side of things is also using JavaScript and it’s not just the front-end.)

Might have spotted another bug, but it’s on the emulator - haven’t tested on the actual device yet.

A Sprite with flip = true, no matter what mirror is, will clip it weirdly when it is overflowing on the top border - the Sprite will be drawn as if it started from the border instead of above.

With no flip:
6

With flip:
1

With flip+mirror:
2

3 Likes

Thanks for reporting it, fixed for the next release. :slight_smile:

2 Likes

Release v0.0.16b Compo Edition

  • lots of misc bug fixes
  • one more splash screen
  • initial git integration thanks to isomorphic-git
  • file list now allows you to fold directories
  • new shortcut (Alt+h) for switching between H and CPP files quickly
  • improved navigation (Ctrl+. and Ctrl+,)
  • Fixed double-paste bug
  • Remove all breakpoints menu option
  • Java: fixed bug where variables weren’t being initialized without a constructor
  • Java: improved support for interface implementation through inheritance
  • FemtoLib: sprites now have a draw(screen, x, y) method, thanks to @torbuntu
  • FemtoLib: fixed bug with flipped sprites partially outside the screen.
  • FemtoLib: fixed reset button, thanks to @bl_ackrain
  • project-specific scripts can be bound to a keyboard shortcut or a menu. Example:
//!MENU-ENTRY:Say hello
//!MENU-SHORTCUT:C-h

alert("Hello");

Save this as a file with a js extension, inside a project folder. Restart the IDE and you should see a “Scripts” menu, with a “Say hello” option. Pressing Ctrl+h will also execute the script.

Here’s a video of the new git support and file list in action:

5 Likes

I got this when I try to build my game:

RangeError: Maximum call stack size exceeded

Edit: But the “Hello Java” builds and run ok.

o_O
Can you send me your project folder in a zip?

1 Like

Ok, I have sent PM.

1 Like

Thanks, fixed now. A missing source file.

I tested the Git integration and it worked well :slight_smile: One improvement is to be able to skip “staging”. I never use it and TortoiseGit IDE also hides it. It could be optional.

Really? That sounds really odd to me. You write one commit message for each file?

No, I use it like e.g, SVN works. There is no separate staging state. I can commit all the changed files in one commit.

2 Likes

Ah, I see, it automatically stages all the changes. That’s really different to how I’m used to using git, I generally stage chunks of lines manually. I’ll add a “Stage All and Commit” option.

1 Like

I only ever use the GitHub UI, so this is closer to what I’d expect too.

Git’s always seemed needlessly complicated to me.
I think it’s quite aptly named. :P

I have not either myself found any use for a separate “staging” stage. Maybe it helps when doing better commits, so that one commit is one logical unit.

I tend to do a lot of “save work” commits, which I later combine together, and give better description.

It does, especially when you’re working in a team or you cherrypick commits from other branches.

I do both :slight_smile:
Edit: But cherrypicking is not a common operation. I mostly merge other branch to my branch instead.