Search found 6674 matches

by dodicat
Nov 23, 2020 10:31
Forum: General
Topic: When to use Integer and when not to
Replies: 5
Views: 121

Re: When to use Integer and when not to

My rule of thumb: make every integer long, including ulong for uinteger.(colours) For things like: screeninfo x,y, where you will get a compiler error if you use long, or screencontrol 100,x,y in 64 bits, so you are forced to use integer here. Saying all that, integer tends to be faster than long in...
by dodicat
Nov 23, 2020 0:55
Forum: Game Dev
Topic: Problem with Fog-of-War
Replies: 16
Views: 391

Re: Problem with Fog-of-War

Maybe just a simple linear mapping from one area to another? Basiccoder2 - you have done this stuff in the past. Nice one paul doe. dim shared as integer xres,yres Dim as string zz = _ "S4C4294904064BM104,601M+111,-137M+51,-39M+142,-21M+73,60M+63,47"_ &"M+67,18M+71,-12M+58,-43M+88...
by dodicat
Nov 22, 2020 21:43
Forum: Beginners
Topic: [HELP] converting KNN code from python to FB
Replies: 65
Views: 2137

Re: [HELP] converting KNN code from python to FB

By multidimensional you mean 3D? I cannot visualize 4D space. 3D is only different in that to view the points properly the array should be sorted in the z direction (into the screen). And the visual size should be mapped closest big, furthest small. Also a perspective should be applied. The function...
by dodicat
Nov 20, 2020 21:33
Forum: Game Dev
Topic: Problem with Fog-of-War
Replies: 16
Views: 391

Re: Problem with Fog-of-War

if you use a for loop then the end position cannot change for n as long=1 to 7 ... ... next n Whatever you do inside the loop won't change the 7. You have to loop and redim preserve in another way. Example Type timage As Any Ptr i As Long x,y Declare Constructor End Type Constructor timage Static As...
by dodicat
Nov 20, 2020 19:23
Forum: General
Topic: Antivirus hurt by functions pasting text on clipboard - sometimes
Replies: 12
Views: 222

Re: Antivirus hurt by functions pasting text on clipboard - sometimes

You can use the unicode version for ansi text also. #include "windows.bi" #include "crt.bi" Function get_clipboard() As wString ptr dim as wstring * 10 e="ERROR" If IsClipboardFormatAvailable(CF_UNICODETEXT) = 0 Then Return @e If OpenClipboard(0) = 0 Then Return @e Func...
by dodicat
Nov 20, 2020 13:28
Forum: General
Topic: Split 8bit in 4bit
Replies: 26
Views: 522

Re: Split 8bit in 4bit

Now I have bits and bytes unmasked, and an 8 bit number can be a ubyte or byte, then in case of a byte with negative value the mask keeps all things positive, and it is in agreement with the union method by paul doe written for byte. union Nibbles as byte value type lo : 4 as byte hi : 4 as byte end...
by dodicat
Nov 20, 2020 13:13
Forum: General
Topic: Antivirus hurt by functions pasting text on clipboard - sometimes
Replies: 12
Views: 222

Re: Antivirus hurt by functions pasting text on clipboard - sometimes

The code was for text (ansi) - jj2007 For unicode this is better. #include "windows.bi" #include "crt.bi" Function get_clipboardW() As wString ptr dim as wstring * 10 e="ERROR" If IsClipboardFormatAvailable(CF_UNICODETEXT) = 0 Then Return @e If OpenClipboard(0) = 0 Then...
by dodicat
Nov 19, 2020 19:39
Forum: General
Topic: Antivirus hurt by functions pasting text on clipboard - sometimes
Replies: 12
Views: 222

Re: Antivirus hurt by functions pasting text on clipboard - sometimes

Windows.bi is fine without crt.bi to get memcpy, thanks for that.
Good luck with your project.
by dodicat
Nov 19, 2020 19:24
Forum: General
Topic: Antivirus hurt by functions pasting text on clipboard - sometimes
Replies: 12
Views: 222

Re: Antivirus hurt by functions pasting text on clipboard - sometimes

Hi TT This one is better for Win 10. I think the last code was for XP, it was a while back. #include "windows.bi" #include "crt.bi" Function get_clipboard() As String If IsClipboardFormatAvailable(CF_TEXT) = 0 Then Return "Error" If OpenClipboard(0) = 0 Then Return &quo...
by dodicat
Nov 19, 2020 17:49
Forum: General
Topic: My take on Squares PRNG
Replies: 28
Views: 572

Re: My take on Squares PRNG

That was my take on Squares PRNG, but worry not, I shall avoid your future endeavours in any subject, like the plague and pestilence which is going around.
Farewell and adieu.
by dodicat
Nov 19, 2020 17:42
Forum: Beginners
Topic: [HELP] converting KNN code from python to FB
Replies: 65
Views: 2137

Re: [HELP] converting KNN code from python to FB

If it is just nearest neighbours to a chosen point in a 2D space array, then it is not difficult. type pt as single x,y end type sub GetClosest(a() as pt,ans() as pt,v as long,num as long) #define incircle(cx,cy,radius,x,y) (cx-x)*(cx-x) +(cy-y)*(cy-y)<= radius*radius dim as single r=.5,ctr do r+=.5...
by dodicat
Nov 19, 2020 13:04
Forum: General
Topic: Split 8bit in 4bit
Replies: 26
Views: 522

Re: Split 8bit in 4bit

Yea, I know fxm in general this is true.
Thank you.
by dodicat
Nov 19, 2020 13:01
Forum: General
Topic: My take on Squares PRNG
Replies: 28
Views: 572

Re: My take on Squares PRNG

I had a try at this deltarho. It wasn't easy getting the two code groups (engine) and array. I had to find each and combine them into a .bi file. (This is just as an outsider, not tied up with paul doe or jeff marshall or yourself in this thread). I have a 4245 line .bi file. Naturally I have to tes...
by dodicat
Nov 19, 2020 11:30
Forum: General
Topic: Split 8bit in 4bit
Replies: 26
Views: 522

Re: Split 8bit in 4bit

jj2007 The macros are tidier IMO #define loNibble(x) (x And 15) #define hiNibble(x) ((x And 240) shr 4) #define mk(a,b) a or b shl 4 dim as ubyte b,nh,nl do b=rnd*255 print "Hex number = "; hex(b),,"(number =";b;")" nh=hinibble(b) nl=lonibble(b) print "High ";...
by dodicat
Nov 18, 2020 19:26
Forum: General
Topic: Split 8bit in 4bit
Replies: 26
Views: 522

Re: Split 8bit in 4bit

It was the 4 bits that confused me, one byte is the smallest at 8 bits. This is maybe better down that far. #define mk(a,b) a or b shl 8 dim as byte a,b do a=rnd*128 b=rnd*128 var m=mk(a,b) print hex(m) print hex(lobyte(m)),hex(hibyte(m)) print print "Press any key or <escape> to finish" s...

Go to advanced search