Dear all, I would like to point out an upgrade that was recently completed for the Casanova language: physics support through the Farseer engine.
This means that now, in addition to declarative rendering, game loop, input and game scripts through coroutines, and menu support, Casanova now offers a series of primitives for handling physics. For example, the definition of the game world and entities for a simple bouncing ball is now just:
type [<CasanovaEntity>] Ball = {
Circle : PhysicsEntity
Sprite : DrawableSprite
} with
member self.Position = self.Circle.Position
static member SpritePosition'(self:Ball,dt:float32<s>) =
self.Circle.Position
static member SpriteRotation'(self:Ball,dt:float32<s>) =
self.Circle.Rotation
and [<CasanovaEntity>] Wall = {
Box : PhysicsEntity
Sprite : DrawableSprite
} with
static member SpritePosition'(self:Wall,dt:float32<s>) =
self.Box.Position
and [<CasanovaWorld>] World = {
Physics : PhysicsWorld
Ball : Ball
Ground : Wall
}
The whole bouncing ball sources are less than 80 lines of code overall, together with saving and loading of the game. Physics requires that physical entities contain a field of type PhysicsEntity, whereas the game world must contain, before the physical entities, a field of type PhysicsWorld.
Head over to the project website if you want to see more samples, such as multiple bouncing balls, pong, etc.