Working UrhoSharp with Xamarin Workbooks

Sign in to queue

Description

The one and only, Charles Petzold (Don't make me cry and say, "Who's that?") recently blogged about a very cool use for Xamarin Workbooks, using them to interactively build and explore creating UrhoSharp apps.

We've covered UrhoSharp a couple times...

What's Xamarin Workbooks?

Workbooks are live documents that mix text, code and results in the same document.

This document will teach you how to effectively use Workbooks to explore, experiment and live code workbooks that you can share or reuse.

For example, the following cell declares a variable name, assigns the value “Miguel” and then prints the result. To watch it in action, position your cursor at the end of the line below and press the return key.

Interactive 3D with UrhoSharp and Workbooks

Humans live in a three-dimensional world, which we navigate from the time we’re infants. We might, therefore, assume that 3D graphics programming would be an intuitively natural fit to our lifetime of experience; after all, we simply need to translate familiar concepts (left and right, up and down, forward and back) into an X-Y-Z coordinate system.

For most people, however, 3D graphics is quite daunting. It’s hard to get a mental feel for 3D objects and how they move through space, and the mathematics involved can be truly hairy. It’s very common for beginning 3D graphics developers to programmatically define a camera, light source, and a 3D object, and then see nothing at all on the screen.

Imagine if you could then fiddle with the code a bit, perhaps change that positive Z coordinate to a negative, for instance, and immediately see the new result.

This is what the combination of UrhoSharp and Xamarin Workbooks now offers. 3D graphics programming has become more accessible to developers, as well as more enticing, by becoming more interactive.

UrhoSharp is Xamarin’s C# wrapper for the open-source Urho3D cross-platform game engine. This is a powerful, industrial-strength 3D graphics API whose major deficiency is that it has so many features it can seem overwhelming to a 3D newcomer (and to developers who already have some 3D coding experience!).

Xamarin Workbooks are documents that combine text and code. Workbooks allow you to edit and execute code in tiny pieces and get immediate feedback. To get started, download the Workbooks application from the Xamarin Workbooks page, and then begin exploring the almost 100 Workbooks that already exist for a variety of platforms.

Getting Started

If you know some UrhoSharp, it might not seem like the optimal platform for Workbooks. Normally, you create a UrhoSharp application by deriving a class from Application, overriding several methods, and then calling a method named Run. This Run method is blocking; it doesn’t return until the application has completed. Within a Workbook, this application architecture is not conducive to an interactive experience.

... [Click through to read the entire post]



The Discussion

Add Your 2 Cents