Skip to content

Commit

Permalink
fix: web.c removed
Browse files Browse the repository at this point in the history
  • Loading branch information
Anut-py committed Oct 28, 2024
1 parent 11bc59a commit afa9268
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 58 deletions.
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}:
mkDerivation {
pname = "h-raylib";
version = "5.5.2.0";
version = "5.5.3.0";
src = ./.;
isLibrary = true;
isExecutable = buildExamples;
Expand Down
66 changes: 34 additions & 32 deletions examples/first-person-camera/src/Main.hs
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TemplateHaskell #-}

module Main where

import Raylib.Core (clearBackground, disableCursor)
import Raylib.Core (initWindowUnmanaged, setTargetFPS, windowShouldClose, closeWindow, clearBackground, disableCursor)
import Raylib.Core.Camera (updateCamera)
import Raylib.Core.Models (drawCircle3D, drawCubeWiresV, drawLine3D)
import Raylib.Core.Text (drawFPS)
import Raylib.Types (Camera3D (Camera3D), CameraMode (CameraModeFirstPerson), CameraProjection (CameraPerspective), pattern Vector3)
import Raylib.Util (drawing, mode3D, whileWindowOpen_, withWindow)
import Raylib.Util (drawing, mode3D, raylibApplication)
import Raylib.Util.Colors (black, white)

main :: IO ()
main = do
withWindow
600
450
"raylib [core] example - first person camera"
60
( \_ -> do
disableCursor

let camera = Camera3D (Vector3 0 0 0) (Vector3 2 0 1) (Vector3 0 1 0) 70 CameraPerspective

whileWindowOpen_
( \c ->
drawing
( do
clearBackground black
drawFPS 10 20

mode3D
c
( do
drawCircle3D (Vector3 2 0 1) 2 (Vector3 0 0 0) 0 white
drawLine3D (Vector3 3 (-1) 1) (Vector3 1 1 1) white
drawLine3D (Vector3 4 2 2) (Vector3 1 (-1) 1) white
drawCubeWiresV (Vector3 (-2) 0 0) (Vector3 1 1 1) white
)
)
>> updateCamera c CameraModeFirstPerson
)
startup :: IO Camera3D
startup = do
initWindowUnmanaged 600 450 "raylib [core] example - first person camera"
setTargetFPS 60
disableCursor

return $ Camera3D (Vector3 0 0 0) (Vector3 2 0 1) (Vector3 0 1 0) 70 CameraPerspective

mainLoop :: Camera3D -> IO Camera3D
mainLoop camera =
drawing
( do
clearBackground black
drawFPS 10 20

mode3D
camera
( do
drawCircle3D (Vector3 2 0 1) 2 (Vector3 0 0 0) 0 white
drawLine3D (Vector3 3 (-1) 1) (Vector3 1 1 1) white
drawLine3D (Vector3 4 2 2) (Vector3 1 (-1) 1) white
drawCubeWiresV (Vector3 (-2) 0 0) (Vector3 1 1 1) white
)
)
>> updateCamera camera CameraModeFirstPerson

shouldClose :: Camera3D -> IO Bool
shouldClose _ = windowShouldClose

teardown :: Camera3D -> IO ()
teardown _ = closeWindow Nothing

raylibApplication 'startup 'mainLoop 'shouldClose 'teardown
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions h-raylib.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: h-raylib
version: 5.5.2.0
version: 5.5.3.0
synopsis: Raylib bindings for Haskell
category: graphics
description:
Expand Down Expand Up @@ -322,7 +322,6 @@ library

if flag(platform-web)
cpp-options: -DWEB_FFI
c-sources: lib/web.c

else
cc-options:
Expand Down
2 changes: 1 addition & 1 deletion lib/rl_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ RLBIND int rlGetPixelDataSize(int width, int height, int format)
}

return dataSize;
}
}
19 changes: 0 additions & 19 deletions lib/web.c

This file was deleted.

0 comments on commit afa9268

Please sign in to comment.