Forum Replies Created
-
AuthorPosts
-
In monkey every type can be null. In other typed languages like cpp, only pointers can be null.
So in monkey only referenced types (ie classes and arrays) can have the ‘real’ Null value.
The other types (ints, floats, bool,…) will have a zero/false value as null. And there is no difference between null and zero/false.I have finnnallly finished the complex polygon (positive)partitionning. I had made a lot of mistakes and the problem was a bit difficult. But it’s there. It just won’t allow collinear&intersecting segment at the “edge” of the poly.
If anybody wants to try it, the code is attached. Run polytoolstest.monkey2 for demo. It is not decomposing to convex polys yet.Attachments:
Generics are always associated with a function, class or struct. Generic interfaces were not available, I think it’s not available yet.
Ah Ok shader stufff!?
Yes splitting a convex to convex is pretty straightforward… thx again.
LOL! You could not do it at a better time for me as I was going to use Mark Bayazit’s algorithm for this purpose (https://mpen.ca/406/bayazit). I suppose you do it for box2d. Have you implemented the max number of vertices=8 ?
I’m working on a box2dxt function to decompose complex polygons and I’ve nearly finished the step of decomposing complex poly to simple polys now! so now I need concave decomp (and reduction to 8 vertices).
You can see pictures (attached) of the “decomplexification” of complex polys
Now I have to split and convex decomp it!
So… great thx!
AFAIK Monkey2 is 100% compatible with C++11 and ANSI C, as long as your code is system agnostic!
The only problem I got till now is endian.h on Mac (not system agnostic but every monkey2 system is “little endian” so you can bypass it) or sources that includes some other libs that are not especially available on every platform (not system agnostic again).
For non cross-platform things, I’ve seen no Limits.
Note that Unions, Generics and other things cannot be imported from C++ (Monkey2 is not C++). You’ll have to wrap it in some C++ code if you really need that part of your lib into monkey2. The frequent std::string and std::vector are a bit problematic and would deserve a convenience interfacing like CString/libc.char_t[] exists for const char*/char *.
My wrapper for box2d has successfully been tested on every available system I have (i.e. Windows, Mac, Linux, Android, IOS, Emscriptem). (box2d is C++)
I ported part of a library to get this done. Code is from https://create.stephan-brumme.com/hash-library/ . Please check for the license(MIT I think).
I had to remove the call to endian.h because it’s a mess with OSX. This result in this port working on “Little Endian” OS/Hardware ONLY (which is all common now but I preffer to tell). (Networks seems to be “Big Endian” though!)
Sorry not to review your code but for me it’s easyer to Import C++ code..I’m using a libc.char_t array to get my CString to avoid memory leaks.
Hope it works well for you.Code in attached zip.
PS: I’ve seen on StackOverflow that the most common problem with hashes is a confusion with chars and bytes.
PS2: you could check the code in std.digest to see how the types are managed in there if you want to continue your mx2 education..Attachments:
Geeting a char by string index actually returns a signed int! So that is a bit strange as the language reference states that Strings have 16 bit elements.
Monkey123456789101112131415Namespace myapp#Import "<std>"#Import "<reflection>"Using std..Using reflection..Function Main()Local s:="yo"Local c:=s[1]Print Typeof(c)EndI’ll have a look at your code but I must say I’m not really into bit shifting and all that stuff so I’m not sure I’ll be able to help.
Hi,
Firt thing to know: CString is not a type you are supposed to use inside Monkey2. It’s a convenience type that will automaticaly translate a String to CString for a C/Cpp function. When you declare CString in your externals, the C func will be receiving a null terminated char* (ie a CString). Arrays in Monkey2 are Not C Arrays and thus if you want a real C type array in Monkey 2
you’ll have to malloc it yourself and use a “Ubyte Ptr”. Dereferencing it will then look like a “classic” array but you won’t have the “.Length” so you’ll have to store the size by yourself or check for null termination. You can malloc using databuffer too as i’ve seen you did.You’ll have to use libc.char_t type wich is the same as C’s char. In an Array or in a DataBuffer. And use the .Data To Get the first element.Secondly, Monkey2 String is 16 bit so you’ll have to ensure that you don’t meet any value exceeding the 8bit capability of your Ubytes. Or use UShorts if you can? I know there is some Char vs UTF8 thing. For me that’s where you get a problem in your quest.
The probable easyest way to do what you want (for me) is to find a C function that do the stuff and import it in your project, there you’ll have to use of CString.
String an Array are actulay defined in C++ and not in Monkey2 (bbTypes.h/bbTypes.cpp).
If you post some C/C++ code I can write a wrapper for you if you’re not comfortable with externals.
For Ascii funcs. If you reach a String element by index it will give you it’s int value. To transform that int value back to a string Use String.FromChar()
Strange.. my W10 and Windows defender are up-to-date and Defender finds no viruses on my computer even with complete virus search. I have 7 different monkey2 folders. But only self compiled I think (I’m not even sure about that).
The mx2community fork is more an issue container than a base repo for pull requests. I personally directly use my mx2 fork for pull requests.
I could sync the fork though.
If you want admin privileges on the fork you can give your githhub nickname…There has been some AV in past that had white listed monkey2. (I thought BitDefender did it)
It’s most probably a false positive, and the message you get is probably because of a whitelist+heuristic strategy. The “.Heur” is an heuristic detection, so it has not formaly found a virus but think it is probably one. https://www.toptenreviews.com/software/articles/what-is-heuristic-antivirus-detection/
But as Danilo said, if your devtools are infected, your compiled execs can be infected too..
I abandoned super-AV’s and use now windows defender, mainly because those heuristic detections are a real PITA when combined with various programming languages.Ok could see some in macOS. But could not really “feel” anything different on W10.
The perfs on MacOS with latest dev has a big problem as it tears big images draws. But the august version is still ok form me! Only after that I get really big perfs differences. Ran some mx2 builds at different commit points to see when this has happened.
Thanks. I’ll reinstall latest monkey-x and have some tests.
I’m back on mx2. Could you give me the state of your analysis on this “event” problem? And also on the Mac/ios problem?
I have a Mavericks, a ElCapitan, a HighSierra and a Mojave machine to run tests and would like to see what’s going on there (and if it is a problem for my game project as it is). I only have an IPhone6s for the ios tests though.Thx
-
AuthorPosts

