All Projects → dotnet-ad → Comora

dotnet-ad / Comora

Licence: MIT license
A simple 2D camera for Monogame.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Comora

UI Engines
Engine specific libraries for Empty Keys UI
Stars: ✭ 52 (-26.76%)
Mutual labels:  monogame
surfacecast
SurfaceCast: send background-subtracted depth camera video via GStreamer (with optional perspective correction)
Stars: ✭ 22 (-69.01%)
Mutual labels:  camera
godot-trackball-camera
A short Godot addon that adds a TrackballCamera node without gimbal lock.
Stars: ✭ 22 (-69.01%)
Mutual labels:  camera
ACViewer
Viewer / Utility for DAT files for the game Asheron's Call
Stars: ✭ 19 (-73.24%)
Mutual labels:  monogame
qrcode-decoder
🤘Tool for decoding qrcode by image,video or camera.
Stars: ✭ 78 (+9.86%)
Mutual labels:  camera
Chafu
A photo browser and camera library for Xamarin.iOS
Stars: ✭ 36 (-49.3%)
Mutual labels:  camera
Landlord
Landlord was a planned roguelike game, which may yet be completed one day if I decide I am willing to re-approach it.
Stars: ✭ 40 (-43.66%)
Mutual labels:  monogame
Apos.Shapes
Shape rendering in MonoGame.
Stars: ✭ 21 (-70.42%)
Mutual labels:  monogame
metal camera
iOS metal camera with GPU shaders.
Stars: ✭ 68 (-4.23%)
Mutual labels:  camera
OpenNFS1
Remake of the original EA Need for Speed 1 using c# and Monogame
Stars: ✭ 157 (+121.13%)
Mutual labels:  monogame
cocos2d-mono
Continuation of Cocos2D-XNA project, with focus on MonoGame
Stars: ✭ 18 (-74.65%)
Mutual labels:  monogame
MJMediaPicker
A Custom Class to select media from camera ,video or photo library by just adding a single file
Stars: ✭ 15 (-78.87%)
Mutual labels:  camera
indi-3rdparty
INDI 3rd Party drivers repository
Stars: ✭ 90 (+26.76%)
Mutual labels:  camera
hevadea
🗺 A game about exploring a randomly generated world.
Stars: ✭ 29 (-59.15%)
Mutual labels:  monogame
FiniteStateMachine
This project is a finite state machine designed to be used in games.
Stars: ✭ 45 (-36.62%)
Mutual labels:  monogame
easy-extends
一个简单快速安装PHP扩展的程序--最简单的方法就是使用Linux
Stars: ✭ 78 (+9.86%)
Mutual labels:  monogame
Best
Gifts for Programmers
Stars: ✭ 22 (-69.01%)
Mutual labels:  camera
three-render-objects
Easy way to render ThreeJS objects with built-in interaction defaults
Stars: ✭ 33 (-53.52%)
Mutual labels:  camera
camera.zero
Combining Camera Zero with an Arducam 12MP camera, a Raspberry Pi Zero WH, a PiMoRoNi trackball breakout, and an Adafruit 16-LED NeoPixel ring will result in a neat little screenless camera that can be controlled with your thumb.
Stars: ✭ 26 (-63.38%)
Mutual labels:  camera
HopeLibrarySystem
厚朴工作室图书管理系统Hope books manage system📘
Stars: ✭ 42 (-40.85%)
Mutual labels:  camera

logo

Comora

A simple 2D camera for Monogame.

Install

Available on NuGet

NuGet

Quickstart

private Camera camera;

protected override void Initialize()
{
	this.camera = new Camera(this.graphics);
	
	base.Initialize();
}

protected override void Update(GameTime gameTime)
{
	this.camera.Update(gameTime);
	
	this.camera.Position = Mouse.GetState().Position.ToVector2();
	
	base.Update(gameTime);
}

protected override void Draw(GameTime gameTime)
{
    graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
    
	spriteBatch.Begin(this.camera);
	// Draw here
	spriteBatch.End();

	base.Draw(gameTime);
}

Draw

Through the SpriteBatch extension methods, simply call Begin as usual, but with your camera :

spriteBatch.Begin(this.camera);

You can add a parralax factor too :

spriteBatch.Begin(this.camera, new Vector2(0.85f,0.85f));

Animations

You can add animation by applying Transform velocities or tweens onto the the camera's Transform property.

Conversion

You can convert a point from screen unit to world :

var screenPosition = Vector.Zero;
var worldPosition = Vector.Zero;
camera.ToWorld(ref screenPosition, out worldPosition);

Converting world coordinates to screen coordinates is also possible.

var screenPosition = Vector.Zero;
var worldPosition = Vector.Zero;
camera.ToScreen(ref worldPosition, out screenPosition);

Debug tools

The framework provide several tools for debugging purpose.

camera.Debug.IsVisible = Keyboard.GetState().IsKeyDown(Keys.F1);

Make sure to load content too :

this.camera.LoadContent(GraphicsDevice);

And then draw it with Draw extension method. You don't have to call spriteBatch.Begin and spriteBatch.End which are already invoked by the method.

this.spriteBatch.Draw(this.camera.Debug);

FPS

The number of frame per seconds will be displayed on the layer.

Grid

A visual grid for world units.

// To draw a white line of size 2 every 50 world units
// and a red one of size 4 every 200 world units.
camera.Debug.Grid.AddLines(50, Color.White, 2);
camera.Debug.Grid.AddLines(200, Color.Red, 4);

Roadmap / Ideas

  • Integrate shaders for easy screen effects.
  • Add more built-in animations.
  • Clean and improve debug layer.

Why?

"Seriously, just a camera ?" ... Yes! I often see full engines with tons of stuff I never need. I'm looking about modularity and easy APIs (like many awesome LÖVE libraries) and that's why I created Comora. I'm sure this could be useful for someone else.

Thanks

Contributions

Contributions are welcome! If you find a bug please report it and if you want a feature please report it.

If you want to contribute code please file an issue and create a branch off of the current dev branch and file a pull request.

License

MIT © Aloïs Deniel

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].