![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Open Source Projects The place to discuss Basic4ppc open source applications. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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. |
|
||||
|
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. |
|
|||
|
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 Last edited by colin9876 : 12-11-2007 at 11:20 AM. |
|
||||
|
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.
|
|
||||
|
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. |
|
|||
|
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? Last edited by colin9876 : 12-11-2007 at 03:13 PM. |
|
||||
|
Quote:
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. |
|
||||
|
Quote:
Quote:
|
|
|||
|
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. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |