Skip to content

Instantly share code, notes, and snippets.

<?php
$config = dirname(__FILE__) . '/library/config.php'; // this config contains things like tokens and what providers are enabled
require_once './library/Hybrid/Auth.php';
try {
$hybridauth = new Hybrid_Auth($config);
/*
* When the user is not authenticated this redirects that user to the twitter authentication page.
* Twitter then sends the user back to this page
* If the user is already authenticated it simply goes on to the next line of code.
*/
@teuneboon
teuneboon / gist:1987881
Created March 6, 2012 18:18
Voorbeeldcode Farseer
World world = new World(new Vector2(0f, 2f)); // We maken een nieuw world object met 2 zwaartekracht op de y as
Body body = BodyFactory.CreateRectangle(world, 5f, 5f, 1f); // Een vierkante body van 5 bij 5 met een density van 1, wordt automatisch aan world toegevoegd
body.BodyType = BodyType.Dynamic; // Een dynamische body reageert naast op collisions ook op zwaartekracht en frictie, static wil je gebruiken voor bijv. muren en de grond
body.Position = new Vector2(10f, 10f); // Eenvoudig genoeg: de positie instellen
/**
* Stuk drawing code, dit gaat er even vanuit dat je een sprite klasse hebt, het is niet van belang hoe die eruit ziet voor Farseer zelf. De ConvertUnits.ToDisplayUnits
* zet de positie van de Farseer World om in pixels, zo kun je een scherm schaalbaar maken zonder dat het poppetje er ineens langer over doet om van boven naar beneden te vallen.
*/
spriteBatch.Draw(this.Sprite.Texture, ConvertUnits.ToDisplayUnits(body.Position), null, Color.White, body.Rotation, this.Sprite.Origin, 1f, SpriteE