we have a player!

This commit is contained in:
nek0 2020-12-23 16:39:45 +01:00
parent 99f37fc6b2
commit 675b0ff155
4 changed files with 16 additions and 15 deletions

View File

@ -12,6 +12,7 @@ void main()
{ {
//vec4 texColor = texture(u_texture, v_texCoord); //vec4 texColor = texture(u_texture, v_texCoord);
int index = int(v_texIndex); int index = int(v_texIndex);
color = texture(u_textures[index], v_texCoord); //color = texture(u_textures[index], v_texCoord);
color = texture(u_textures[index], v_texCoord) * v_color;
//color = vec4(0.0, 1.0, 0.0, 1.0); //color = vec4(0.0, 1.0, 0.0, 1.0);
} }

View File

@ -104,14 +104,14 @@ instance Scene Test where
shader shader
"u_textures" "u_textures"
(map (map
((\(GL.TextureObject o) -> o) . textureId) textureSlot
[ (tileMapTexture $ mapTileMap loadedMap) [ (tileMapTexture $ mapTileMap loadedMap)
, tex , tex
] ]
) )
let pituicat = Pituicat let pituicat = Pituicat
(V2 0 (-1748)) (V2 400 1748)
(V2 0 0) (V2 0 0)
(V2 0 0) (V2 0 0)
100 100
@ -242,19 +242,19 @@ populate layers props actors =
actorsHere actorsHere
(lisRaw, lvs) = toVertices l (lisRaw, lvs) = toVertices l
lis = V.map lis = V.map
(+ if null is then 0 else V.maximum is) (+ if null is then 0 else V.maximum is + 1)
lisRaw lisRaw
pis = V.map pis = V.map
(+ (+
if null (is V.++ lis) if null (is V.++ lis)
then 0 then 0
else V.maximum (is V.++ lis)) else V.maximum (is V.++ lis) + 1)
pisRaw pisRaw
cis = V.map cis = V.map
(+ (+
if null (is V.++ lis V.++ pis) if null (is V.++ lis V.++ pis)
then 0 then 0
else V.maximum (is V.++ lis V.++ pis)) else V.maximum (is V.++ lis V.++ pis) + 1)
cisRaw cisRaw
in in
( is V.++ lis V.++ pis V.++ cis ( is V.++ lis V.++ pis V.++ cis

View File

@ -52,22 +52,22 @@ instance Drawable Tile where
, V.fromList , V.fromList
[ newVertex [ newVertex
(V3 (fromIntegral x * 32) (fromIntegral y * 32) 0) (V3 (fromIntegral x * 32) (fromIntegral y * 32) 0)
(V4 0 0 0 1) (V4 1 1 1 1)
(V2 u1 v1) (V2 u1 v1)
0 0
, newVertex , newVertex
(V3 (fromIntegral (x + 1) * 32) (fromIntegral y * 32) 0) (V3 (fromIntegral (x + 1) * 32) (fromIntegral y * 32) 0)
(V4 0 0 0 1) (V4 1 1 1 1)
(V2 u2 v1) (V2 u2 v1)
0 0
, newVertex , newVertex
(V3 (fromIntegral (x + 1) * 32) (fromIntegral (y + 1) * 32) 0) (V3 (fromIntegral (x + 1) * 32) (fromIntegral (y + 1) * 32) 0)
(V4 0 0 0 1) (V4 1 1 1 1)
(V2 u2 v2) (V2 u2 v2)
0 0
, newVertex , newVertex
(V3 (fromIntegral x * 32) (fromIntegral (y + 1) * 32) 0) (V3 (fromIntegral x * 32) (fromIntegral (y + 1) * 32) 0)
(V4 0 0 0 1) (V4 1 1 1 1)
(V2 u1 v2) (V2 u1 v2)
0 0
] ]

View File

@ -30,23 +30,23 @@ instance Drawable Pituicat where
, V.fromList , V.fromList
[ newVertex [ newVertex
(V3 (realToFrac x - 25) (realToFrac y - 25) 0) (V3 (realToFrac x - 25) (realToFrac y - 25) 0)
(V4 0 0 0 1) (V4 0 1 0 1)
(V2 0 (1 - 50 / 1024)) (V2 0 (1 - 50 / 1024))
1 1
, newVertex , newVertex
(V3 (realToFrac x + 25) (realToFrac y - 25) 0) (V3 (realToFrac x + 25) (realToFrac y - 25) 0)
(V4 0 0 0 1) (V4 0 1 0 1)
(V2 (50 / 1024) (1 - 50 / 1024)) (V2 (50 / 1024) (1 - 50 / 1024))
1 1
, newVertex , newVertex
(V3 (realToFrac x + 25) (realToFrac y + 25) 0) (V3 (realToFrac x + 25) (realToFrac y + 25) 0)
(V4 0 0 0 1) (V4 0 1 0 1)
(V2 (50 / 1024) 1) (V2 (50 / 1024) 1)
1 1
, newVertex , newVertex
(V3 (realToFrac x - 25) (realToFrac y + 25) 0) (V3 (realToFrac x - 25) (realToFrac y + 25) 0)
(V4 0 0 0 1) (V4 0 1 0 1)
(V2 (50 / 1024) 1) (V2 0 1)
1 1
] ]
) )