Forum Replies Created
-
AuthorPosts
-
Structs are copied by value, that’s why you are not supposed to make very big struct, it would slow it down. This makes another problem with inheritance, it would slow down it’s speed benefit if it could have ‘extends’. However you can use ‘extension’, but then it’s always the same struct name. The ‘extension’ keyword is not documented but you can find some examples in the forum:http://monkey2.monkey-x.com/forums/topic/possible-to-add-method-to-rect-with-extention/
Macros are not there.
There is aliases but not real macros.Array, Delete and Friend are three reserved keywords I could not find when/where they are used. I’m interrested in some examples if they have any functionality.
Do you import and use std?
Rnd is part of std module.
At the beginning of your code you should have:[/crayon]Monkey1234[crayon-5cbaa093de7f6839414668 inline="true" ]#Import "<std>"Using std..Looks pretty nice. I’m looking forward to test it!
I had to copy vcruntime140.dll to ted21 folder because it’s not in my path. (old mx2 prob looking for it though it’s not necessary, I suppose it’s because you use an older mx2cc). It could be usefull to redist it in ted21 folder if allowed.
I had to put ted21 folder it in my mx2 folder too of course.
The first execution I could see no text, but then it was ok.there is the c2mx2 tool(src/c2mx2.monkey2, you have to install LLVM read readme of c2mx2).Tthat could do this for you automatically (with luck), it will be a good base and warn you for some parts that he could not glue correctly.
I made some little exercices example for external imports here:
https://github.com/abakobo/learn_monkey2/tree/master/externs
https://github.com/abakobo/learn_monkey2/tree/master/char_t
(not sure all this works fineconst does not exist in monkey2 so sometimes it is a problem (with abstract/pure virtual things mostly).
for chars you’ll want to use libc module’s char_t types:[/crayon]Monkey12345678910111213141516171819202122232425[crayon-5cbaa093e6f90876703402 inline="true" ]#rem monkeydoc C/C++ 'char' type.#endStruct char_t="char"End#rem monkeydoc C/C++ 'const char' type.#endStruct const_char_t="const char"End#rem monkeydoc C/C++ 'signed char' type.#endStruct signed_char_t="signed char"End#rem monkeydoc C/C++ 'unsigned char' type#endStruct unsigned_char_t="unsigned char"End#rem monkeydoc C/C++ 'wchar_t' type#endStruct wchar_t="wchar_t"Endunfortunately not findable in the docs because of some doc generation bug…
it could have something to do with compiler optimisation flags (I don’t know how to change them though!)
In the docs:
Structs
Structs are similar classes, but differ in several important ways:
A struct is a ‘value type’, whereas a class is a ‘reference type’. This means that when you assign a struct to a variable, pass a struct to a function or return a struct from a function, the entire struct is copied in the process.
Stucts are statically typed, whereas classes are dynamically typed.
Struct methods cannot be virtual.
A struct cannot extend anything.So it should tell you may not extend struct and use virtual methods. Or structs are now extendable?
there are some automatic extern importers, you could have a try
src/c2mx2.monkey2
src/cxx2mx2.monkey2importing big libs is always not trivial though…
using absolute path returned by
[/crayon]Monkey123[crayon-5cbaa09409ba8596984325 inline="true" ]filename = RequestFile("Save the file","",True)I could save where I want on W7 except my sys root dir (C:\ –> no error but no files)
on OSX I can only save on user dir if on sys drive (memory acces violation if not user dir), everywhere on other drives
the filter is not working on OSX so
[/crayon]Monkey123[crayon-5cbaa09409bad934462563 inline="true" ]filename = RequestFile("Save the file","png",True)will crash too
never used assetsdir(), desktopdir(),…
all this should be reported on github when we have a clearer idea of where it actually crashes/not-working.
Welcome!
here is a little list of some educative content:
THE pack of examples for now, probably the most educative content you can get (it’s in a forum sticky post):
https://github.com/Pakz001/Monkey2examplesA WIP tutorial on how to use chimpmunk and timelineFX, it has very nice comments and is step by step and actually covers a larger part of monkey2 than just chipmunk..:
https://github.com/peterigz/Monkey2TutorialsThere’s also a WIP monkey2 doc with a bit more info in the language reference section than in the current official distro (Pointers, Conditionals, Loops, Preprocessor, Index,…). You can avoid a lot of questioning by reading all the language reference (the “Monkey2>Language Reference” thing). It is not very long so I really advise you to do so.
http://turdus.be/monkey2docs/docs/You should also read the mojo main doc page because mojo is the main Gfx module and it’s very usefull to understand its workflow:
http://monkey2.monkey-x.com/mx2-docs/mojo-module/use FileStream to write to a file (FileStream extends Stream)
[/crayon]Monkey123[crayon-5cbaa0941af1c641671589 inline="true" ]Local stream:=FileStream.Open(path,"rw")That’s Nice and Clean! Great step by step tutorial. Congrats! Looking forward to see things exploding.
here on W7 mx2 1.1.03
[/crayon]Monkey12345678[crayon-5cbaa0942c534479338177 inline="true" ]Parsing...Semanting...C:/mx2_shortpath/PromptInvasion-master/PromptInvasion.monkey2 [1656] : Error : Super class 'std.collections.List<default.Special>.Node' has no default constructorC:/mx2_shortpath/PromptInvasion-master/PromptInvasion.monkey2 [1653] : Error : Can't find overload for 'new[Void(default.Special),Void(default.Special,std.collections.List<default.Special>.Node)]' with argument types ()C:/mx2_shortpath/PromptInvasion-master/PromptInvasion.monkey2 [2484] : Error : Super class 'std.collections.List<default.ParticleA>.Node' has no default constructorC:/mx2_shortpath/PromptInvasion-master/PromptInvasion.monkey2 [2477] : Error : Super class 'std.collections.List<default.ParticleA>.Node' has no default constructorC:/mx2_shortpath/PromptInvasion-master/PromptInvasion.monkey2 [751] : Error : Super class 'std.collections.List<default.Entity>.Node' has no default constructorDoes this mean that canvas should discard the passed image!?
-
AuthorPosts