Reputation: 199
I have been having problems with tracking my 2d objects in OpenGL using Ajhc.
I don't know how I can keep track of my object and prevent it from leaving the width and height of the device. Can anyone provide assistance?
My code here:
module Draw where
import CubeVerts
import CoSys
import AndroidNdk
import AndroidNdk.Log
import Foreign.Marshal.Array
spriteMv :: Float -> Float -> Float -> Float -> Float -> IO ()
spriteMv x y dx dy z = do
drawFunc
drawFunc :: IO ()
drawFunc = do
c_glDrawArrays c_GL_TRIANGLES 0 6
spritePlayer :: Float -> Float -> Float -> Float -> Float -> IO ()
spritePlayer x y dx dy z = do
withArray vertices $ λvp -> withArray colors $ λcp -> do
c_glEnableClientState c_GL_VERTEX_ARRAY
c_glEnableClientState c_GL_COLOR_ARRAY
c_glVertexPointer 3 c_GL_FLOAT 0 vp
c_glColorPointer 4 c_GL_FLOAT 0 cp
spriteMv x y dx dy z
c_glDisableClientState c_GL_VERTEX_ARRAY
c_glDisableClientState c_GL_COLOR_ARRAY
Upvotes: 15
Views: 989