Great addition with the colours, will integrate that library into the BS code now so it can use the colour functionality
RE librarys/dlls. SO Express c# can do libraries, but ppc apps cant use libraries?
What do u use to create these dlls, is it many steps on top of writing the code to get it as a dll?
RE librarys/dlls. SO Express c# can do libraries, but ppc apps cant use libraries??
Let me try to explain.
Devices run the Compact Framework (CF) which is a (mostly) compatible subset of the full .NET Framework. Desktops run the full .NET Framework (NF).
Code compiled for the CF can run on the NF. Code compiled for the NF will NOT run on the CF. This is how you can usually use the same library in B4PPC on the device and the desktop, they are compiled for the device. There are some B4PPC libraries that have different versions for the desktop and device due to differences between the two environments. Some B4PPC libraries are available only for the desktop (e.g my FormExDesktop) because the device does not include that functionality.
The Express versions can only compile for the NF even if the code itself is perfectly capable of running on the CF. This is a marketing decison by Microsoft not a fundamental limitation of the Express versions.
Dlls are actually p**s easy to do. You just tell Visual Studio or SharpDevelop what you want, dll, Windows exe or console app and it makes it. Your code has to suit that use of course.
ok, well Im just reorganising the BSinterface because it needs to be done more logically to go fast. It was drawing pens on the foreground all the time, e.g. in black when a colour wasnt selected
I can implement everything Neil wants from Basic if I have two more things passed to the the library,
Firstly a ELEMENTS() array defining the color, spread
attributes of particles 0 to MAXELMENTS
A rules table rules(MAXELEMENTS,MAXELEMENTS)
which has arguments saying what happens when two colored particles meet
ChangetoElement, dx, dy is all it will need
Ill map out the C# lines in anticipation of Neil working out how to do dlls
Ive got a french exam tomorrow so must go and revise now but will catch up with this later. A Bientot!
Update- what does that FromArgb( col[i]) change do?
Does C# store colours as doubles? Does .Net have a RGB function?
Last edited by colin9876 : 12-10-2007 at 07:27 PM.
Firstly a ELEMENTS() array defining the color, spread attributes of particles 0 to MAXELMENTS
Already got colour, need an additional array for spread - easy.
Quote:
A rules table rules(MAXELEMENTS,MAXELEMENTS)
which has arguments saying what happens when two colored particles meet
ChangetoElement, dx, dy is all it will need
I don't think you realise the implications of this. At present each particle is treated individually. The only way they can "meet" at the moment is when they ovelap due to spreading. There is no provision for static "objects" for particles and the library fiddles with the array and moves particles around to keep the array compacted. I could go on ... but I'll be interested to see your C# "psuedo code" in case you've got some ideas that I haven't thought of.
the elements array maps the RGB colours to a simple int 0 to MAX
u know what color u are(say 5), then u look at the colour pixel ur going to on the screen(say 6) and look up rule(5,6) say
then add dx to px, dy to py, and change element type if a different element is specified.
Ive got it running in basic, it can react to all fixed objects and all other moving pixels without slowing it down
I actually could get rid of the spread parameter by combining it in a rule - but Neil wanted it
all the boundry checking can be done by adding a rule in the array too to say e.g. yellow pixels change to black space if they hit a white border
codes not long - just not sure about arrays in C#- whats the best way to pass a 2 dimentional array that has 3 arguments
rule(m,m)=int,int,int etc
Last edited by colin9876 : 12-10-2007 at 08:23 PM.
just not sure about arrays in C#- whats the best way to pass a 2 dimentional array that has 3 arguments
rule(m,m)=int,int,int etc
Sorry Colin but I don't get this. Arrays don't HAVE arguments. What do you really mean?
Also multiple arbitrary rules per colour may have a bigger performance hit than you assume. If you have some code that works then post it and I will have a look at coding it.
Yes sorry arguments wasnt the right word ... how do u say for each rule(1,2) it looks up a few things (sort of like DIM rule(64,64) Type colchange,dy) ... maybe structure is the right word
u only look up one rule, doesnt matter how many there are in the list- only look up the one relevant to the color u are, and the color of the pixel ur going to.
Heres a rough guide - Ill give u the exact code next week when Ive got it exactly right
bithandler(px(),py(),pcolor(),pspread(),n,rules(,) )
for i=0 to n
plot(px(i),py(i),cBlack)
newpx=px(i) + our random spreadline
newpy=py(i)+1
tocolor=getpixelcolor(newpx,newpy)
if tocolor<>cblack
thisrule=rule(condense(pcolor(i)) , condense(tocolor))
newpy=py(i) + thisrule.dy
pcolor(i)= thisrule.colchange
if getpixel(newpx,newpy)<>cBlack then
newpx=px(i)
newpy=py(i)
end
end
px(i)=newpx
py(i)=newpy
plot(px(i),py(i),pcolor(i))
Next
N.B the condense function just reduces the distinction of the colors so it doesnt need a 64000x64000 rule table. Then I dont need the element look up table either
Condense(R,G,B)=((R Mod64)+1)x((G Mod64)+1)x((R Mod64)+1)
e.g condense(200,100,0)=4*3*1=12
so 4*4*4 distinct colors, rule table is rules(64x64)
Last edited by colin9876 : 12-10-2007 at 10:27 PM.