Dark Bit Factory & Gravity
PROGRAMMING => C / C++ /C# => Topic started by: DragonSpirit on September 08, 2008
-
Well luckily for me this website is a non flaming environment ;D
I haven't contributed anything yet, so thought I would make a start.
This is some untidy c++ / pocket pc code if anyone is interested (which I hope they are). It is a very simple example of starfield and copper bars.
Please note the starfield and parts of the code are code from a pocketpc book and i converted the copperbars from I believe a blitz basic shockwave code example to c++. I could be wrong though as I have been ill and not coded for over a year and just happened to load this in today for a look.
My c++ code is messy as I am only learning c++ and there is no double buffering in this, however, it shows people how to do pixel drawing on the pocket pc. The exe is 2003 and wm5 compatible.
I would love it if anyone was interested in ppc development for intros as this is where my enthusiasm lies at the moment, although due to my illness I only manage about 40mins on pc before wanting to throw up, so my dedication is limited at the moment.
Anyway at the risk of peoples uncontrollable laughing, here it is. (VS2005)
-
Well done!
I don't see much that could be improved code-wise (but I haven't been looking into pocketpc-development for years).
It just might a bit faster to directly feed a 16bit-colour to DrawPixel16 instead of always converting it from 24bit.
If you request 16bpp, GXDisplayProperties::cbxPitch is *very* probably 2.
and there is no double buffering in this
and that's perfectly okay since it wouldn't make sense for a starfield.
Please post more stuff if you make some progress!
-
Does it run under the mobile emulator stuff or do I need a real target?
Jim
-
Should work fine on the emulators. I have tested it on emulator and both my devices. It needs the Gapi dll to run, but I think the emulators and devices have this in their standard build anyway.
-
thanks hellfire I will have a look into that I see what I can come up with.
-
Well talk about optimisation ;D
After your advise and some extra analysis I found some major speed improvements. Compare the original intro1.exe(begining of thread) to the speed of intro1a.exe and you will see the difference.
On my 2003 ppc now I can hardly see the stars they are that fast (which is obviously a whole different issue now).
I will release the source later today, but it is too late right now and I have really overdone my healths quota. Anyway the optimisations were as follows:
1. Stopped calling g_gxdp.cbyPitch and g_gxdp.cxWidth from within the main pixel drawing loop
2. The same with all generic gapi calls within the loop.
3. And this was the major saving. Precalculated the copper bars in an array instead of processing withing the pixel drawing loop. I was forgetting that the things you can get away
with calculating on a pc, will really slow down a 266mhz processor ::)
As this was a rush, I hardcoded the array to be 240 pixels instead of getting it from the screen width, but this will be changed, and copper bar colours are not quite the same (need to work this out)
See what you think
-
Not a great day for me today, but here is the new source as promised. Still contains a hardcoded screen width and needs tidying, but not up to it today :(
-
This is very cool and works fine on my X1 with only the screen being the wrong size.
-
Glad you like it and that it works (apart from the screen size) :D
I havent really done anymore on this for the last few months, although I do plan on doing. I have been writing a game using a great language for the pocket pc called PPL. Its good for games as it is fast, and still reasonably small exe's with no runtime. (about 500k), although I want to still get to grips with the c++ side of things for demos as this is maximum speed and space saving.
Here is the link to the game if you are interested.
http://forums.arianesoft.ca/showthread.php?t=1557 (http://forums.arianesoft.ca/showthread.php?t=1557)
-
Another person with too much talent to let it go to waste.
Please do carry on with your C++ adventures :)
-
Wow!! Shockwave telling me I have too much talent. If anything is encouragement to get started again that certainly is :)
It's not that I am not going to continue, it's just that there didn't seem too much interest in the pocketpc source, so I assumed that people were busy with other languages and moving onto other platforms, hence why I moved on myself to try and accomplish at least one finished pocketpc game in my life.
I will start work on the c++ code again and see what I can move forward with and thanks to everyone for the interest and encouragement. I love cracktros and check the forum frequently for new ones so I will try and accomplish one myself.