Welcome to GD.SE, Simon! Looking at your code, it's not obvious what everything actually does - for example, why is 320 added to view_xview[0]? It'd be great if you could edit your answer to explain your code.
–
PolarMay 23 '14 at 18:33