@@ -72,6 +72,7 @@ module SDL.Raw.Types (
7272#ifdef RECENT_ISH
7373 FPoint (.. ),
7474 FRect (.. ),
75+ Vertex (.. ),
7576#endif
7677 RendererInfo (.. ),
7778 RWops (.. ),
@@ -1400,6 +1401,24 @@ instance Storable FRect where
14001401 (# poke SDL_FRect , w) ptr w
14011402 (# poke SDL_FRect , h) ptr h
14021403
1404+ data Vertex = Vertex
1405+ { vertexPosition :: ! FPoint
1406+ , vertexColor :: ! Color
1407+ , vertexTexCoord :: ! FPoint
1408+ } deriving (Eq , Show , Typeable )
1409+
1410+ instance Storable Vertex where
1411+ sizeOf _ = (# size SDL_Vertex )
1412+ alignment _ = (# alignment SDL_Vertex )
1413+ peek ptr = do
1414+ position <- (# peek SDL_Vertex , position) ptr
1415+ color <- (# peek SDL_Vertex , color) ptr
1416+ tex_coord <- (# peek SDL_Vertex , tex_coord) ptr
1417+ return $! Vertex position color tex_coord
1418+ poke ptr (Vertex position color tex_coord) = do
1419+ (# poke SDL_Vertex , position) ptr position
1420+ (# poke SDL_Vertex , color) ptr color
1421+ (# poke SDL_Vertex , tex_coord) ptr tex_coord
14031422#endif
14041423
14051424data RendererInfo = RendererInfo
0 commit comments