Penjin Help


milkshake

Advanced Member
Joined
May 18, 2009
Messages
3,748
Age
40
Location
Rotherham, UK
Hi, this is aimed at PokeParadox.

I have folled the steps here I have installed code::blocks and installed the libraries I have configured the compilers, I ran the bash scripts from the cross compile set up page but the codesorcery url didnt work so I updated it to this.

Code:
#!/bin/bash
# some default variables
TOOLCHAIN=arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
TOOLCHAIN_MD5=2c2b324f0a84916afd9920029286eb10
TOOLCHAIN_SHA1=d8c01b420470e236761cebd65f86fc0f7415c3e9
PNDSDK_DIR="/usr/local/pandora"
CWD=[ pwd ]

# usefull functions ...
black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'

cecho ()	# Color-echo. Argument $1 = message, Argument $2 = color
{
	local default_msg="No message passed."	# Doesn't really need to be a local variable.

	message=${1:-$default_msg}		# Defaults to default message.
	color=${2:-$black}			# Defaults to black, if not specified.

	echo -e "$color $message"
	#echo "$message"
	tput sgr0				# Reset to normal.

	return
} 

check_wget_error()
{
	if [ "$?" -ne "0" ];
	then
		cecho "Sorry, wget failed. Maybe angstrom repository is down, please try again later" $red
		exit 1
	fi
}

# Fast hack to ask for sudo pwd at startup
sudo ls &>/dev/null
# Make working directory
cecho "Making working directory (`pwd`/tmp)" $green
if [ ! -d "tmp" ]
then mkdir tmp
fi

# Check if codesourcery TOOLCHAIN is available, download it if needed
echo -e
cecho "Checking if codesourcery toolchain is available, download it if needed" $green
if [ ! -f "tmp/$TOOLCHAIN" ]
then
        wget -O tmp/$TOOLCHAIN http://smp-on-qemu.googlecode.com/files/$TOOLCHAIN
	check_wget_error
fi

# Verify the codesourcery toolchain integrity
echo -e
cecho "Verifying the codesourcery toolchain integrity" $green
md5=$(md5sum tmp/$TOOLCHAIN |cut -d' ' -f1)
if [ "$md5" != "$TOOLCHAIN_MD5" ]
then
	cecho "Error : `pwd`/tmp/$TOOLCHAIN is corrupted, please fix" $red
	exit 1
fi

# Create the pandora sdk directory
echo -e
cecho "Creating the pandora sdk directory ($PNDSDK_DIR)" $green
if [ ! -d $PNDSDK_DIR ]
then
        sudo mkdir $PNDSDK_DIR
        sudo chown -R $USER:$USER $PNDSDK_DIR
else
        sudo chown -R $USER:$USER $PNDSDK_DIR
fi

# Extract codesourcery toolchain
echo -e
cecho "Extracting codesourcery toolchain to $PNDSDK_DIR" $green
tar -xjf tmp/$TOOLCHAIN -C $PNDSDK_DIR

cd $CWD

# All done
echo -e
echo -e
cecho "All done, your Pandora SDK is located here : $PNDSDK_DIR/arm-2009q3" $green
echo -e
cecho "The following pandora sdk path have been added to your login script (~/.bashrc) : PNDSDK" $green
echo -e
echo "export PNDSDK=\"/usr/local/pandora/arm-2009q3\"" >> ~/.bashrc
echo "export PATH=\"\$PATH:\$PNDSDK/bin:\$PNDSDK/usr/bin\"" >> ~/.bashrc
source ~/.bashrc

and now it installed the libs.
and now im confused what to do next how do I configure code::blocks to compile using the pandora sdk? instead of g++? or is this done automatically?

and also do you have a more concise set up examples of how to use penjin in coding?
thanks
 
For a good introduction to Penjin, to see some working (and well documented) example code and to have the compilers set-up get the Penjin TestSuite via SVN from here:
http://penjin.googlecode.com/svn/TestSuite/

This contains a codeBlocks project file, which makes use of environment variables for easy set-up (you will be asked several paths upon opening it, see the Penjin manual for an explanation).
The project consists of different States which show various functions of Penjin (Animation, Collision detection, Menu and File Lister, etc.). The code is commented so you have an explanation of what is going on.
Additionally you can see how a simple Penjin project is set-up, how it looks like and how to work with states and the engine.

Alternatively you could check out some of the Penjin based projects, like PandoraPanic, PanJoust or Wandor, but in general their code is much more messy and much less commented than the TestSuite's one.

Poke will have to help you out with Pandora cross-compiling, I have got it set up and working, but I can really give an explanation on how to get there as I pretty much hacked it together with Poke's help ;) (also I am on Win32)

foxblock
 
thanks fox block ill download that and have a play around, could still do with help getting code::blocks to compile for pandora/penjin
 
Setting up a compiler in C::B is pretty straightforward.

Settings - Compiler and debugger

Then hit the copy button, copy something you have used.

setup the toolchain executables, point it at the folder one level above the bin folder and modify the bin names to the right ones i.e arm-eabi-blahblah-g++

you can setup up search paths for headers/libraries here if they will be needed for every project that uses this compiler. i.e /usr/inlcude or /usr/lib
if you dont do it here then you will have to do it later in the specifc project settings.

thats a quick overview but it should get you in the right direction.
 
Pickle said:
setup the toolchain executables, point it at the folder one level above the bin folder and modify the bin names to the right ones i.e arm-eabi-blahblah-g++

you can setup up search paths for headers/libraries here if they will be needed for every project that uses this compiler. i.e /usr/inlcude or /usr/lib
if you dont do it here then you will have to do it later in the specifc project settings.

Im quite confused at this point, where it says "compiler's installation directory" I have pointed it to /usr/local/pandora/arm-2009q3 which is the folder one level above the bin folder, what do you mean by modify the bin names? and do I have to edit anything in the "program files" tab or the "additional paths" tab?
 
Last edited by a moderator:
OK firstly, I've been at work, so sorry if you have been waiting around for me to reply! :/

Clone the GNU Arm compiler and call it Pandora.
Now setup the compiler exes/bineries/programs as shown here:
fetch.php?media=homebrew:engines:penjin:images:pandora-toolchain_settings_on_linux.png


Hopefully if you do this you can now compile the TestSuite program that foxblock mentioned!

I agree that I need to sit and improve the existing docs and obviously finish them too. Hopefully now you have enough to get started, however.
:)
 
thank you very much yay :) im using 8.02 code::blocks because the newer version isnt in ubuntu software center is this ok or should I update?
 
when I open up the test suite it tells me...

"The defined compiler for W32 Debug cannot be located (ID: mingw). Please choose the compiler you want to use instead and click "OK". If you click "Cancel", the project/target will be excluded from the build."

then when I select the clone we made called linux it repeats the above but with (ID: pandora), (ID: gp2x), (ID: devkitppc). I just choose my linux clone everytime then the Notes about TestSuite come up.

"Penjin Test Suite Project
###############

This is a series of states which are created with the sole intent of testing Penjin Functionality.

Currently, there are states provided to test:

Animations - StateAnimation
Colours - StateColour
Menus - StateTitle - only basic functionality of the menu system.
Primitives - StatePrimitive
RayCaster - StateRaycast - Nowhere near finished... too slow current version crashes.

Press START in any of the Test States to return to the TitleState Menu."

I press cancel because ok is grayed out then it starts talking about defining some global variables penjin, pandora_sdk, gp2x_sdk, libogc, mingw

have I missed something?
 
Ok the compiler prompts... I suggest you setup dummy compilers for the relevant targets. Just clone something sensible and leave it as that, you can always change the settings if you do actually setup the cross compiler. You can hit cancel or change it to a different compiler but... hitting cancel will nag you each time you open the project and setting it to the "wrong" compiler will break the project settings if you plan on submitting code changes.

help on setting up global variables: http://projectinfinity.org.uk/doku.php?id=homebrew:engines:penjin:global_variables
 
So I figured I'd give Penjin a try. Built the test suite and for the most part it seems to work, except I can't get the joystick test to work. I've set the nubs to joystick mode, op_test_inputs reports they're doing something, but nothing seems to move when I push the nubs around. The mouse cursor moves when I touch the touch screen (and when I leave the nubs in mouse mode) but the joystick crosshairs do not. Did I do something wrong or is that test not complete?
 
First of all thanks for giving it a try!
Second of all, you are absolutely right, that section is WIP... although P is a little paused with my wedding and vacation. So you are doing nothing wrong.
Also you should leave the nub settings alone. Shouldn't have to change it.

@Milkshake: I'm interested on if you got any further.
 
PokeParadox said:
First of all thanks for giving it a try!
Second of all, you are absolutely right, that section is WIP... although P is a little paused with my wedding and vacation. So you are doing nothing wrong.
Also you should leave the nub settings alone. Shouldn't have to change it.

@milkshake: I'm interested on if you got any further.

I didnt im afraid I have to work on some web stuff atm also I just couldnt work it out, its not as simple as making a website for example u can use notepad and then just run in a browser for basic html and php stuff if like me your paying a host then it runs php anyway so i just upload it to the server and test it that way.
 
Last edited by a moderator:
milkshake said:
I didnt im afraid I have to work on some web stuff atm also I just couldnt work it out, its not as simple as making a website for example u can use notepad and then just run in a browser for basic html and php stuff if like me your paying a host then it runs php anyway so i just upload it to the server and test it that way.
No worries, hope you give it another shot at a later date. Once you get everything setup it's not so bad. ;)
 
Last edited by a moderator:
PokeParadox said:
First of all thanks for giving it a try!
Second of all, you are absolutely right, that section is WIP... although P is a little paused with my wedding and vacation. So you are doing nothing wrong.
Also you should leave the nub settings alone. Shouldn't have to change it.
Looks like you're doing it so that unless you define PENJIN_ES, it'll use SDL for input, including the joystick, which means you do have to change the nub settings. SDL only reads the nubs if they're in joystick mode. I'm doing some hacking around. Maybe I can help figure some. :)
I've got a great idea for a game that I want to try but it needs a joystick/nub, and I don't feel like (nor see a need to) writing my own engine from scratch for it. The capabilities of Penjin seem to fit exactly what I want, so I hope it turns out well.
Good luck with your wedding by the way!

edit: incidentally, instead of setting up a code blocks project, I've made a simple Makefile for those that prefer a more classical compilation. If you're interested I can clean it up a bit more and post it.
 
Last edited by a moderator:
Ah... I must admit joysticks/nubs are still mostly untested on Pand in Penjin... Although I could swear the menu on PandoraPanic! works with the nubs...

I would be very interested in including a makefile on the svn so please do share the wealth! ;)

PS I´m now married!
 
PokeParadox said:
PS I´m now married!
What the heck are you doing here?!?! It's you're wedding night! You should be sleeping!

edit: also, PandoraPanic title screen only seems to accept when the nubs are in mouse mode. I suspect you've got it mapping the mouse to joystick somewhere and aren't actually reading the nub values. I'll look some more tomorrow night and get back to you on it. In the meantime, enjoy your post wedding bliss :)

editedit: except it does map the joystick properly... how is it working? And why only when it's in mouse mode? This is so weird. It's late and I'm not thinking clearly.
 
Last edited by a moderator:
Na it was the morning after when I wrote that... So all wedding stuff mostly over and done with, great great experience! :)

All I can say regarding nubs, I just mapped the relevant axes to the SimpleJoy values for leftStick and rightStick... nothing fancy.
 
Ok, I think I've figured it out: I'm 99% certain your nub code needs a lot of work still. The reason the menu works is because of the line
Code:
menu.setMouseSelection(input->getTouch());
getTouch() is just a wrapper around the mouse, and the mouse is the nub. Moving the nub up and down moves an invisible cursor. Comment out that line and the menu selection no longer moves. The isLeftStickUp and isLeftStickDown sections don't seem to be working.
 
WizardStan said:
Ok, I think I've figured it out: I'm 99% certain your nub code needs a lot of work still. The reason the menu works is because of the line
Code:
menu.setMouseSelection(input->getTouch());
getTouch() is just a wrapper around the mouse, and the mouse is the nub. Moving the nub up and down moves an invisible cursor. Comment out that line and the menu selection no longer moves. The isLeftStickUp and isLeftStickDown sections don't seem to be working.

Errr, i've looked at the changes in the svn, and i dunno if i should troutslap you or PokeParadox :p But after updating Penjin (don't do that very often) Panjoust suddenly segfaults on me. A problem with simplejoy and multiple players it seems. Should i add something to my code to make it work again?

EDIT:
With the last line of the code below commented out it runs nicely again. But that would probably result in a memleak? dunno... at least i can work an test again :)
Code:
//  copy existing players accross
        for(int i = 0; i < numPlayers; ++i)
        {
            players[i].deadZone = tp[i].deadZone;
            players[i].scaler = tp[i].scaler;
            players[i].mapLoaded = tp[i].mapLoaded;
        }
        //delete [] tp;
 
Last edited by a moderator:
Back
Top