Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Open Source Projects
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Open Source Projects The place to discuss Basic4ppc open source applications.


Pocket Burning Sand (Open Source)


Reply
 
LinkBack Thread Tools Display Modes
  #111 (permalink)  
Old 12-10-2007, 10:45 PM
Basic4ppc Veteran
 
Join Date: Nov 2007
Posts: 316
Awards Showcase
Beta Tester 
Total Awards: 1
Default Mini request for Agraham..

Just as an interim measure can we have this line in the current bithandler library, it will help me merge what we have to Neils BS interface to give a half playable result!

for i=0 to n
plot(px(i),py(i),cBlack)

nexpx=px(i)+(2*rnd-1)*spread
newpy=py(i)+1

if form1.getpixel(newpx,newpy)<>black then
newpy=py(i)
if form1.getpixel(newpx,py(i))<>black then
newpx=px(i)
end
end


px(i)=newpx(i)
py(i)=newpy(i)

plot(px(i),py(i),pcolor(i))

Next

Basically calc new position, if u hit something dont go down just do the horizontal movement. If ur still going to hit something dont move position at all

This means the sand, water etc wont plough through the background but wiggle its way round it if it can!

Last edited by colin9876 : 12-10-2007 at 11:04 PM.
Reply With Quote
  #112 (permalink)  
Old 12-11-2007, 09:31 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,690
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by neilnapier View Post
I find it quite amusing that some members of this forum said that this program couldn't be done.
I did NOT say it couldn't be done. I said
Quote:
So I am afraid that the bottom line is that to get a viable BS to run under B4PPC you would have to write it in a library
which is exactly what is now happening! - with my help I may add.
Reply With Quote
  #113 (permalink)  
Old 12-11-2007, 09:44 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,690
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by colin9876 View Post
maybe structure is the right word
Exactly right. A two-dimensional array of structures is required, which compiles down to arrays of array (i.e a three-dimensional array). B4PPC can manage this but I will have to ask Erel if it can successfully pass it to a library as I can think of a possible typing problem here.

EDIT:- If arrays of structures can't be used then a plain three-dimensional array of ints or doubles could be used.

Last edited by agraham : 12-11-2007 at 10:03 AM.
Reply With Quote
  #114 (permalink)  
Old 12-11-2007, 10:04 AM
Basic4ppc Veteran
 
Join Date: Nov 2007
Posts: 316
Awards Showcase
Beta Tester 
Total Awards: 1
Default BSv2.0

If u can do the half way house modification of adding those few lines that say

if something where Im goingto then only move horizontally
..if something still where Im goingto then dont move at all

bithandler(px(),py()...

nexpx=px(i)+(2*rnd-1)*spread
newpy=py(i)+1

if form1.getpixel(newpx,newpy)<>black then
newpy=py(i)
if form1.getpixel(newpx,py(i))<>black then
newpx=px(i)
end if
end if

px(i)=newpx(i)
py(i)=newpy(i)

plot(px(i),py(i),pcolor(i))



Here is a cutdown version of BS (no other libraries required) u can test it with; v2.01 allows u to choose sanding colors, or static wall colours

It runs nicely with ur library - needs one addition tho to transfer the pixel color accross when off the screen pixels get removed out of the array {px(i)=px(n),py(i)=py(n),pc(i)=pc(n) }

N.B. Neil, dont worry that ur graphics are temporarily missing, Ive taken them out so its easier to work on this demo without needing to pass the imagefiles etc
Attached Files
File Type: sbp BSv2.01.sbp (2.2 KB, 5 views)

Last edited by colin9876 : 12-11-2007 at 11:20 AM.
Reply With Quote
  #115 (permalink)  
Old 12-11-2007, 12:09 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,690
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Try this - it has changed significantly so you will have to look at the code and see what changes you in turn need to make. The main one is that you tell it what area to restrict drawing to. You can pass the background colour and you need to put error checking in the B4PPC code when you create a particle to make sure it is in the drawing area.
Attached Files
File Type: zip BitmapHandlerDll.zip (3.9 KB, 4 views)
Reply With Quote
  #116 (permalink)  
Old 12-11-2007, 02:35 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,690
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Ooops - sorry. I forgot the shuffle sideways loop.

BTW I think that I can get this a lot faster but it would mean restricting it to Compact Framework 2.0 on the device (where it would be of most use) as CF 1.0 does not have the functionality needed.
Attached Files
File Type: zip BitmapHandlerDll.zip (3.9 KB, 4 views)
Reply With Quote
  #117 (permalink)  
Old 12-11-2007, 02:50 PM
Basic4ppc Veteran
 
Join Date: Nov 2007
Posts: 316
Awards Showcase
Beta Tester 
Total Awards: 1
Default Very Nice

Brilliant! Can u post the updated C code, the one in the zip didnt seem to have all the code? n.b need to make the spread value for sand >1.5 to make it come off slopes properly

Also take a look at something;-
in the loop i<n does that mean the final value will be n or n-1?

the reason I ask is in the destroy pixel bit shouldnt it be

spread(i)=spread(n-1)
it currently says=spread(n)

as px(i) etc are passed over as the n-1 argument?
Attached Files
File Type: sbp BSv2.02.sbp (2.3 KB, 7 views)

Last edited by colin9876 : 12-11-2007 at 03:13 PM.
Reply With Quote
  #118 (permalink)  
Old 12-11-2007, 03:03 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,690
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by colin9876 View Post
Update- what does that FromArgb( col[i]) change do? Does C# store colours as doubles? Does .Net have a RGB function?
It's best not to update existing posts - notifications don't seem to get sent so no-one may see it. I only just saw this re-reading your bit about rules.

You have to remember that .NET is object based. Even ints and doubles can be treated as objects although subject to some optimisations. Therefore .NET stores colours as Color objects. C# and VB.NET are strongly typed but will do some explicit conversions that do not cause potential problems. They will promote an Int32 to a Double automatically but not the other way round. You can force some conversions by explicitly telling the compiler that it is OK by "casting" it as in (Int32)SomeDouble. Other conversion have to be done by built-in functions.

So finally what FromArgb(col[i]) does is make a Color object from the Int32 ARGB value in col[i]. A stands for Alpha which is a fourth colour parameter specifying transparency.

And yes, there is a .NET RGB function. It is a static method of the Information class. e.g. intRGB = Information.RGB(intRed, intGreen, inBlue). As a colour value is 4 bytes packed into a 32 bit integer it just does some shifting and adding to make the colour value.
Reply With Quote
  #119 (permalink)  
Old 12-11-2007, 03:17 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,690
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by colin9876 View Post
Brilliant! Can u post the updated C code, the one in the zip didnt seem to have all the code?
Its C# not C and it's the right code, I just downloaded and checked.

Quote:
in the loop i<n does that mean the final value will be n or n-1? the reason I ask is in the destroy pixel bit shouldnt it be

spread(i)=spread(n-1)
it currently says=spread(n)

as px(i) etc are passed over as the n-1 argument?
You are right, that is wrong. The exit value of the loop iterator i will be n on exit but the highest value the inside of the for loop sees is n-1. Amended stuff attached.
Attached Files
File Type: zip BitmapHandlerDll.zip (3.9 KB, 12 views)
Reply With Quote
  #120 (permalink)  
Old 12-11-2007, 03:19 PM
Basic4ppc Veteran
 
Join Date: Nov 2007
Posts: 316
Awards Showcase
Beta Tester 
Total Awards: 1
Default great

Well its very good, got all the c# now - cleverly done, thanks for that, Im going to work on the basic part. Try it with the BSv2.02 Ive posted above - its interesting!

Last edited by colin9876 : 12-11-2007 at 03:26 PM.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tippy v.1.0 [open source] N1c0_ds Share Your Creations 4 Yesterday 10:08 PM
Personal Pocket PC Wiki tsteward Open Source Projects 120 11-11-2008 09:55 AM
Another Pocket Wiki digitaldon37 Open Source Projects 1 09-17-2008 11:01 AM
Pocket Burning Sand neilnapier Questions & Help Needed 2 11-05-2007 08:53 PM
dzSpy - Spy and Task Manager App - Open Source dzt Share Your Creations 3 07-15-2007 06:21 AM


All times are GMT. The time now is 03:10 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0