-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|427|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Article Home -> Coding Basics


 
Jayenkai
Created : 05 May 2009
Edited : 10 May 2009
System : Windows
Language : D

MidletPascal Jumpstart



1. Initially written for an "LG Cookie KP500" forum, so very Cookie specific things ahead! (That's my phone!!)
2. Thanks, thanks, and thanks again to Pio for having pointed out MidletPascal.
..
Less Java = Happier Jay!!

----

Right, let's all assume you want to write a game for the Cookie.
It's not terribly hard to do, so long as you understand all the limitations that have been previously layed out.
(See here and bits in here.)

But before you touch a single bit of code, you need to get EVERYTHING set up, and ready to go.

*sigh*

Are you ready?

OK, let's begin.




Download, Download more, Download even more, Setup, Setup, Install, Setup and Install.
and then download a bit more.

1. Java J2ME Toolkit Thingy
This lets you write games in Java.
I'm not 100% sure you'll need this for the basics, but if you ever need to do some advanced stuff, be it for MidletPascal, or even doing stuff in plain Java.. You still need it.
So, grab it and install it now, before you start getting annoyed at the fact that there's a big download needed for something so simple.. (but get used to doing that!! Java's stupid like that! If you want to write a 72kb game of Hangman, expect to install 72Gb of stuff to do it!)

Download, install, done..
Next!

2. MidletPascal
There's an attached version of this, below. The website's down fairly frequently, the programs not been updated for a few years, and the forum's one great big spam-bin. *sigh*
Still, it just about works, and it seems to do the job fairly well..

Download it, and install it, but then leave it for the moment.. We'll get back to this in a bit..

3. LG SDK Thingy
Head to the LG site, then follow the signs to download the "LG SDK 1.2 for the Java™ ME platform released!" thing.
I'd link to it, but LG's websites is one of the worst websites I've ever seen in my entire life..
It won't let you link to things..
*sigh*
Even MidletPascal's spam filled forum is better!

Anyway, grab that, download, and install.

You now have all the tools installed, and about 1/2 of the setup done.
Wouldn't life be easier if everything was just "Install + Run".
Not with Java!
"Java.. Making life more complicated!"




setup, setup, setup, and setup
I really hope you installed to the default folders!!

1. Make the Cookie the size of a Cookie.
Head to the following folder.
C:\LGMobile\JavaME_SDK_12\wtklib\devices\
In there, you'll spot a KP500 folder.
Have a look.
You'll notice 2 annoying things that LG have done for you.
First, they've made the thing about 1000000 times bigger than it needs to be, by adding "PROFESHUNAL" stylings, and logo.
Second, they left that bloody d-pad on!
BAH!!

Download this.
It's a smaller, neater, and more importantly, fullscreen version.
Great!
Shove the bits in the kp500 folder, overwriting the rubbishy LG ones.


2. Make the Emulator be a Cookie
Up three folders, then into bin.
C:\LGMobile\JavaME_SDK_12\bin\

Right at the top, there should be a DefaultDevice.bat program.
Run that, choose KP500, then close it.
We've now picked our lovely cookie to be the default device whenever we run the included emulator.

But because this is Java-World, you can't just RUN the Emulator!
Don't be silly!!!


3. Adding much needed essentials to MidletPascal.
Nope, we're not done yet!
Download this.
They do the following.

lib_sensor allows you to read the stylus.
BUT..
Be aware of my earlier rants.
A Touch gives instant co-ordinates, but a Drag does not..

lib_vibra does the vibrating. woot!

Download the libs, and place all the contents into c:\program files\midletpascal\libs\

We're ready to run!!


4. Making MidletPascal run stuff in the cookie emulator.
No, wait, we're not!

*sigh*
If you're still bothering at this point, well done!
Place the shortcut for MidletPascal somewhere you can get to it VERY VERY QUICKLY!
Because, when it crashes, being able to load it back quickly is essential!
Otherwise it'll tick you off!
(Why not rightclick the icon, and give it a shortcut key?!)

Run it!
Woot!
There it is..
The screen you'll see for the next year and a half!

Head into Configure/Program Options, and down to Emulator.
Add a new one, and you want to set it up as follows.
Emulator Description : LG
Run Command : c:\LGMobile\JavaME_SDK_12\bin\emulator.exe -Xdescriptor:%JAD%

Now, if all that's worked out, that should all work out!




The Sample
Create New Project, and.. well, you might as well use default settings..
Then, copy and paste this, overwriting the simple Hello World project that's already in the new project.



SAVE
Then click the Build icon.
At this point, MidletPascal's annoying issue will appear.
You've a 1/5 chance it'll crash here!
(A nice quick crash, mind.. nothing nasty)
If it does, open it back up, and try, try, try again!

Once it's happily compiled, click the run, and it oughta run in the LG Cookie emulator.
(if not, click the arrow by the Run Icon, and make sure it's the LG that's selected.)

If all goes well, you should have a cookie, a white screen, and the words "Hello World" every time you click the screen.

Blinkin' 'eck, that was hard work!

Any questions, ask away.
Expect part 2 of this, in the next day or so, time dependant.

 

Comments