Skip to content

Instantly share code, notes, and snippets.

View rsodre's full-sized avatar

roger_s rsodre

View GitHub Profile
@rsodre
rsodre / XcodePersistentBugs.md
Last active August 3, 2018 16:22
XCode Persistent Bugs

XCode used to be awesome

It still is, more or less, because a lot of good stuff is breaking with each new release.

Maybe some of these problems do not occur on Swift or Objective-C, since that's all that Apple uses internally, but using XCode for C++ projects is becoming a pain. Apple is probably too focused on Swift and leaving C++ to roth.

  • Code coloring: Generally fucked. If you can Jump to Definition, why can't you color it accordingly?

  • Quick help (OPT+click): Generally fucked. Rarely tells me any information about any method, member or class. Even those that are colored (thus identified), do not show any information.

@rsodre
rsodre / CanvasRenderModeSwitcher.cs
Created April 13, 2017 14:28
Unity tip: Work with your canvas in Camera space, switch to Overlay on Play.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Unity tip"
// Usually it is desired that the HUD canvas is separated from Camera effects, or "ScreenSpaceOverlay" mode
// But Overlay canvases are terrible to work with
// So keep your canvas in "Screen Space Camera", and switch it automatically to Overlay when the game starts
public class CanvasRenderModeSwitcher : MonoBehaviour
@rsodre
rsodre / transformToFit.h
Created March 23, 2017 14:27
Transform matrix to fit any rect into any other rect. For OpenFrameworks (or anything else, really)
#pragma once
#include "ofMain.h"
void transformToFit( ofRectangle src, ofRectangle dst, bool upscale=true ) {
// Scale
float scaleX = ( dst.width / src.width );
float scaleY = ( dst.height / src.height );
float sc = ( scaleX < scaleY ? scaleX : scaleY );
if ( ! upscale )
sc = ofClamp( sc, 0.0f, 1.0f );
// Position (scaled)