Forum Replies Created
-
AuthorPosts
-
will LoadString also work everywhere?
Yes, because it uses Stream itself – well, it uses DataBuffer.Load which uses Stream.
There should be no real reason to use FileStream directly. Stream.Open will return a FileStream when appropriate but you shouldn’t need to ‘know’ this.
Would need to see more code, it looks like it can’t find a uniform but I can’t really see how you’re setting things up etc.
It’s the right general idea though.
[edit]The shader related error message REALLY need some work! I’ll see what I can do here.[/edit]
Actually, you shouldn’t really use FileStream for opening assets, instead use Stream.Open(…).
This is because assets are not necessarily files (eg: on android) so FileStream.Open( “asset::….” ) will NOT work everywhere, but Stream.Open( “asset::…” ) WILL.
I also added filesystem support for asset::, desktop:: etc so people could go FileType( “asset::blah…” ) but I now think this was a mistake, because “asset::” and co. are really nothing to do with any native filesystems at all, they are purely monkey2 constructs.
I’ve added a textureFlags param to Font.Load in develop branch, although TextureFilteringEnabled is fine here too.
> It seems it doesn’t accept “asset::”
Oops, bug, fixed in develop.
>Yes, I want this! But don’t want to use Set or properties.:)
So you do want assignment overloading…as I’ve said above, this is not happening sorry!
Any ideas how to get what I want?
I’m not actually sure what you want.
If you want a function to be called when a value is modified, you’ll need a ‘Set’ style method for assignments because, well, there is no assignment overloading. This is pretty trivial to implement though so I suspect you mean something else (or that you really *do* want assignment overloading!).
No, I will not supporting assignment overloading in the near future, if ever.
There are a lot of complications involved with assignment overloading which I’m not going to go into right now (email me if you want to discuss further…) but that I don’t want to weigh the language down with.
I don’t like having 1001 ways to convert values as it can easily get too confusing how things work when the compiler does a ton of implicit/magic stuff behind your back. C++ is a bit like this – there’re copy ctors, assignments and cast operators (at least, probably more since c++11) all of which can result in type conversions but it’s not always obvious which one gets called or even when.
So the monkey2 equivalent might be: if ‘operator from’ WAS supported, and a dst type implemented ‘operator from’ and a src type implemented ‘operator to’, which would get used when converting from src type to dst type?
IMO, operator to plus type extensions allows you to do pretty much anything without everything getting too confusing. If there’s something you can’t do this way, let me know and we can try to come up with a solution.
For example, it allows me use std.geom types like Vec3f with assimp and bullet and have them automatically convert correctly from the native assimp/bullet geom types like aiVector3D.
And there is no overloadable assignment operator in monkey2 (or copy ctor).
Next time this happens, check to see if you haven’t accidentally ‘locked’ a file (filename will have a ‘+’ before it in the tabview).
Thanks Angus, I will take a look soon-ish
…just wanted to see if this would work really (it does!), getting a bit ‘c++’-ish for my liking though…
Monkey12345678910111213141516171819202122232425262728293031#Import "<std>"Using std..Function LessThan<T>:Bool( val:T )( cmp:T )Return Lambda:Bool( val:T )Return val<cmpEndEndFunction Main()Local stack:=New IntStackFor Local i:=0 Until 100stack.Add( Rnd( 100 ) )Endstack.RemoveIf( LessThan( 50 ) )For Local val:=Eachin stackPrint valNextEndThe code that generated the error was this,
I think there may be something weird going on here in general.
What was the full path of the monkey2 source file?
What was the full path of the monkey2 installation?
Monkey1 is no longer under development any more. You could try this 3rd party fork, although I have nothing to do with it:
The parameter for RemoveIf should be a function:
Monkey123456789101112131415161718192021222324252627Namespace myapp#Import "<std>"Using std.collectionsUsing std.stringioFunction Main()Local st:=New Stack<Int>st.Add(10)st.Add(20)st.Add(123)st.RemoveIf( CheckIt ) 'I would like to remove all the items with 'value' greater of 40 (for example)For Local i:=Eachin stPrint iNextEndFunction CheckIt:Bool( value:Int )Return value>40End…you can use a lambda to write the function ‘inline’ too:
Monkey1234st.RemoveIf( Lambda:Bool( value:Int )Return value>40End ) -
AuthorPosts