I've coded a little sum sum in my free time when I'm not blowing off my classes that I'd like to try and port to java. I've heard java is simple to use and is very interface friendly. By that I mean you can take code and make an applet that is easy to create. Well I'd like to take what I've written in C++ and port it to java. I was wondering if someone had any experience with java that would help me write an applet with the code I have. I, by no means, want to get it written for me. I'd like to be able to get walked through it so that I can replicate this for future reference. I've done a fair amount of reading on creating applets and I really have a hard time learning by reading books or articles. I'm more of a walkthrough it first and get it learner. Anyways, if this fits you, please feel free to email me or pm me on here.
Here's the full source to my WIP game: http://www.LB-Stuff.com/Java/Game_Test/..zip (change ..zip to Game_Test.htm for the game in a browser ready to play)
It's going throgh heavy refactoring and this is the most recent 'cleanest' version.
For applets, you'll be interested mainly in game.Game.run(), game.ScreenDrawer.Display, and game.ScreenDrawer.UpdateDrawRegion
Well, but what is *the* question? If you know Java and you know C++, porting C++ to Java is quite easy (easier this way than the other way round). You just have to try to do it and post questions whenever you have a concrete problem.
Java and C++ have extremely similar syntax. What is confusing to you?
For starters, you should know Java has nine primitive types:
boolean (C++'s bool)
byte (C++'s signed char, 8 bits)
char (C++'s unsigned short, 16 bits)
short (C++'s signed short, 16 bits)
int (C++'s signed int or signed long, 32 bits)
long (C++'s signed long long, 64 bits)
float (C++'s float, 32 bits)
double (C++'s double, 64 bits)
references (C++'s pointers)
References can only reference class types, they cannot reference primitives. Since references are themselves primitives, you cannot have references to references. They resemble C++'s pointers, not C++'s references. They can be either null or referencing something, and using == on them compares to see if they reference the same thing or no, not if what they reference is equal. (This always tricks people up) You should use obj1.equals(obj2) to test if two referenced objects equal each other.
Let me clarify. I can write half-assed code in c++. I get the concept of different data types. What I don't get is how to use all the java syntax. I can't understand what to write in a java project. If I did, I wouldn't be here.
I'm referring to all the java.blah.Blah stuff. And I just tried writing a simple multiplication program that multiplied two doubles together. Needless to say, it didn't work.
C# is like C++ and Java got married, so that automatically makes it better
More features in a programming language is not always better. Actually well designed languages are those that achieve good expressivity with few core features. Think: Lisp or Scala. Anyway, C# is actually Java with some minor things fixed. But Microsoft was later, so they would be idiots if they didn't fix some things. Nevertheless, their runtime still sucks for server applications, performance-wise.
I'm referring to all the java.blah.Blah stuff. And I just tried writing a simple multiplication program that multiplied two doubles together. Needless to say, it didn't work.
Try Scala instead. It is easier to learn.
1 2 3 4 5
println("Enter the first number: ")
val a = readInt
println("Enter the second number: ")
val b = readInt
println("Multiplicity of the numbers is: " + a * b)
Why would you want to write applets? Does anybody actually still do that nowadays? There was a cool website with a few emulator applets, but other than that I can't think of any reason.
I've coded a little sum sum in my free time when I'm not blowing off my classes that I'd like to try and port to java. I've heard java is simple to use and is very interface friendly. By that I mean you can take code and make an applet that is easy to create. Well I'd like to take what I've written in C++ and port it to java. I was wondering if someone had any experience with java that would help me write an applet with the code I have. I, by no means, want to get it written for me. I'd like to be able to get walked through it so that I can replicate this for future reference. I've done a fair amount of reading on creating applets and I really have a hard time learning by reading books or articles. I'm more of a walkthrough it first and get it learner. Anyways, if this fits you, please feel free to email me or pm me on here.