Hello. I’m a new programmer and I’m interested on buying an arduboy. I only know to program on Java and I don’t know what languages use the games of the arduboy. It’s difficult to learn them? Do you recommend me to buy an arduboy? I have one more question. The arduboy has a on/off button or how it turns on/off?
From the perspective of someone who knows both Java and C++.
They are similar in places, but also quite different.
The basic differences:
The basic constructs (for, while, if, else) are almost exactly the same.
Both have a concept of classes, but classes behave differently.
Both have variables but they behave differently.
Both have enums but they behave differently.
C++ doesn’t have interfaces, but its classes can be made to behave almost exactly the same
The more fundamental differences (don’t worry if you don’t understand many/any of these):
Java is garbage-collected, C++ is not
Java compiles to JVM bytecode executed on a virtual machine, whereas C++ compiles straight to machine code *
Java’s variables are usually ‘references’ by default, whereas C++'s variables are the actual values
Java puts nearly everything on the heap, C++ puts nearly everything on the stack or in registers
Java generics use type erasure, C++ generics use templating
* For the pedantic technophiles: technically speaking this is a generalisation, but discussing the other possibilities like the Dalvik VM and Clang + LLVM would vastly over complicate things
The original version of Minecraft was written in Java, it’s only the later versions that use C++.
Obviously though, Minecraft is quite beyond the Arduboy’s capabilities due to various hardware constraints.
A few clarifications:
void is not a datatype. It is the absence of a type.
A function marked void returns no value.
A pointer to void is a pointer to a block of memory that doesn’t have a type.
The IDE does not accept C#.
It might appear to accept C# syntax, but only the subset of C# syntax that is also a subset of C or C++, and in almost all cases the semantics (i.e. the meaning/behaviour) will be different.
He told you so probably to simply things for you and probably meant that void is used like a datatype.
But @Pharap is correct and you can do so quick research on it. You quickly will find that void can be used instead of any datatype to indicate, that there is no type. Another difference to datatypes is that you can’t create a variable of void.
Have a go at the tutorials that were mentioned and you will be have few problems. Having a Java background will be very helpful but occasionally you will pull your hair out and say ‘but this works in Java’. Its at that point you will realise that some of the differences that @Pharap pointed out are super important and sometimes subtle.
You can write complex games without ever needing to write a class but I encourage you to stick with it and question whether you can apply the OOP techniques you have learnt in Java to C++. At the end of learning C++ on a restricted environment like the Arduboy you should become a better Java programmer!
Because I wasn’t here UNTIL I GOT my Arduboy…
You can always message someone to have them check the code for you, if you can’t test it with your Arduboy (since you don’t got it yet…) @crait’s first tutorials are very helpful and can get you started. (although I tinkered around a few program examples, it was Crait’s tutorial that put things together.)
I wasn’t writing serious code that does things until I read that. (although in my Computer programming class we DID do some code, but those canmot run outside a IDE.)