Skip to content

Commit

Permalink
fix to exolang entry points so that time is in seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
dktr0 committed Feb 26, 2024
1 parent 1d40996 commit 27a0dc8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions index-0.5.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
}
function animate() {
window.requestAnimationFrame(animate);
var now = Date.now();
var now = Date.now()/1000.0;
window.punctual.preRender({canDraw: true, nowTime: now});
window.punctual.render({canDraw: true, zone:0, nowTime: now});
window.punctual.postRender({canDraw: true, nowTime: now});
}
window.doEval = function () {
var t = document.getElementById("editorArea").value;
var r = window.punctual.define({zone:0,text:t,time: Date.now()});
var r = window.punctual.define({zone:0,text:t,time: Date.now()/1000.0});
console.log(r);
document.getElementById('errors').textContent = r.error;
}
Expand Down
14 changes: 7 additions & 7 deletions punctual.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/DateTime.purs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module DateTime where

import Prelude (bottom)
import Prelude (bottom,(*))
import Data.DateTime (DateTime)
import Data.DateTime.Instant (instant, toDateTime)
import Data.Time.Duration (Milliseconds(..))
import Data.Maybe (Maybe(..))

numberToDateTime :: Number -> DateTime
numberToDateTime x = case instant (Milliseconds x) of
numberToDateTime x = case instant (Milliseconds (x*1000.0)) of
Just i -> toDateTime i
Nothing -> toDateTime bottom
4 changes: 2 additions & 2 deletions src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ setTempo punctual ft = do
SharedResources.setTempo punctual.sharedResources (fromForeignTempo ft)


preRender :: Punctual -> { canDraw :: Boolean, nowTime :: Number, previousDrawTime :: Number } -> Effect Unit
preRender :: Punctual -> { canDraw :: Boolean, nowTime :: Number } -> Effect Unit
preRender punctual args = when args.canDraw do
log $ "preRender: " <> show args
-- if any current or immediately preceding programs require the webcam, it should be active
Expand All @@ -108,7 +108,7 @@ render punctual args = do
Just w -> drawWebGL w (numberToDateTime args.nowTime)


postRender :: Punctual -> { canDraw :: Boolean, nowTime :: Number, previousDrawTime :: Number } -> Effect Unit
postRender :: Punctual -> { canDraw :: Boolean, nowTime :: Number } -> Effect Unit
postRender _ args = log $ "postRender: " <> show args


Expand Down

0 comments on commit 27a0dc8

Please sign in to comment.