-- Our render function
renderGame :: (MonadIO m, MonadReader Resources m) => Size Int -> Model -> Scalar -> m ()
renderGame scrSize Model { playerPos, missiles } _gameTime = do
  H.runMatrixT . H.xform (calcCameraMatrix scrSize) $ do
    missileTex <- asks missileTex
    tex <- pull vaoCache "squaretex"
    for_ missiles \(pos, _) -> H.xform (mkTranslation pos !*! mkScale (V2 5 5)) do
      H.drawVAO tex do
        H.bindTextures [missileTex]
        H.bindUniform "color" red
        H.bindMatrix "modelMat"
    pull vaoCache "square" >>= flip H.drawVAO do
      H.xform (mkTranslation playerPos !*! mkScale (V2 10 10)) $ H.bindMatrix "modelMat"
      H.bindUniform "color" white

-- ** INPUT **

-- Translating raw input to game input
renderGame :: (MonadIO m, MonadReader Resources m) => Size Int -> Model -> Scalar -> m ()
renderGame scrSize Model { playerPos, missiles } _gameTime = do
  H.runMatrixT . H.xform (calcCameraMatrix scrSize) $ do
    missileTex <- asks missileTex
    tex <- pull vaoCache "squaretex"
    for_ missiles \(pos, _) -> H.xform (mkTranslation pos !*! mkScale (V2 5 5)) do
      H.drawVAO tex do
        H.bindTextures [missileTex]
        H.bindUniform "color" red
        H.bindMatrix "modelMat"
    pull vaoCache "square" >>= flip H.drawVAO do
      H.xform (mkTranslation playerPos !*! mkScale (V2 10 10)) $ H.bindMatrix "modelMat"
      H.bindUniform "color" white

-- ** INPUT **

-- Translating raw input to game input
renderGame scrSize Model { playerPos, missiles } _gameTime = do
  H.runMatrixT . H.xform (calcCameraMatrix scrSize) $ do
    missileTex <- asks missileTex
    tex <- pull vaoCache "squaretex"
    for_ missiles \(pos, _) -> H.xform (mkTranslation pos !*! mkScale (V2 5 5)) do
      H.drawVAO tex do
        H.bindTextures [missileTex]
        H.bindUniform "color" red
        H.bindMatrix "modelMat"
    pull vaoCache "square" >>= flip H.drawVAO do
      H.xform (mkTranslation playerPos !*! mkScale (V2 10 10)) $ H.bindMatrix "modelMat"
      H.bindUniform "color" white

-- ** INPUT **

-- Translating raw input to game input