Forum Replies Created
Have you tried using generic methods, and making ‘GetFromIndex’ take ‘Derived’ as an argument?Monkey12Local thing:= GetFromIndex<Derived>(id)
Then you can have ‘GetFromIndex’ perform a cast to T, where T is ‘Derived’ in this case.
Why wouldn’t you just make the dynamic cast outside of the class to begin with? Even then, if you need to dynamically cast to a derived class from the base class, why not put the functionality you need in the base class to begin with… At the very least, why aren’t you using ‘Virtual’ methods instead of casting? Dynamic casting is slower, so you don’t have that excuse.
This looks like a design smell.
For those interested, Mark just fixed this bug in the ‘develop’ branch. To fix the problem, pull the latest changes, update your modules, then build Ted2/Ted2Go again.
@Mark Sibly Maybe you could fix CTRL+LEFT/RIGHT as well? It doesn’t seem to snap to the borders of words properly.
I’m really glad you’re adopting GitHub as a part of bug tracking and discussion.
Just for the record, you know the creator of a repository can also open issues, right? In other words, if you end up finding a bug you want to fix later, you can add and document it.
Started an issue. I presume GitHub’s the correct place to post bugs, then? I originally intended to post to GitHub, but I didn’t know if this was intended behavior or not.
Neither crashes on their own. It’s just when it tries to build the module that it failed to extract/download properly.
Just a heads up, I tried to install Wiebow’s module, and it seems to have crashed.
On a second attempt it appears to be making a file called “wdw-game2d” rather than a folder, then it obviously says “modules/wdw-game2d/wdw-game2d.monkey” doesn’t exist.
EDIT: ‘portmidi’ does the same thing from the look of it.
You’re looking for degrees, Monkey 2 made the switch to radians.
Sin(n * (Pi / 180))
Here’s an example of how to convert to and from radians.Monkey123456789101112131415161718192021222324Function RadiansToDegrees:Double(x:Double)Const RadianScalar:= (Pi / 180.0) ' 57.29577951308232Return (x * RadianScalar)EndFunction DegreesToRadians:Double(x:Double)Const DegreeScalar:= (180.0 / Pi) ' 0.017453292519943295Return (x * DegreeScalar)EndFunction Cosd:Double(x:Double)Return Cos(RadiansToDegrees(x))EndFunction Sind:Double(x:Double)Return Sin(RadiansToDegrees(x))EndFunction Main:Void()Print(Sind(10.0))Print(Cosd(30.0))End
EDIT: Just realized you figured it out.
I know it’s just a Pacman clone right now, but the art is gorgeous.
@edzup: These examples work here for me, and I’m still on 1.0.1. It even works without declaring a namespace.
You are sure the file’s named correctly, right? Same file extension, too?
@Mark Sibly: Yeah, that may be a wise choice.
Although, I really have to question why enumerators can even be implicitly casted to integers. It can’t be done the other way around, so shouldn’t you have to add an explicit cast here as well? That would kill two birds with one stone.
I made a proper clone from the start. Whenever I want to update I usually wait for a semi-major fix or version on GitHub, then use git pull from the command-line. When it’s done downloading I just run the rebuild script and I’m up-to-date.
This approach does require you to make a proper clone of the repository, meaning you can’t simply download a ZIP file.
Works here on Windows. I haven’t tried more than the example, though.
For the record, you should only need to rebuild ‘std’ if you changed it, which can be done by simply opening “std.monkey” and building it in Ted or Ted2.