Skip to content
This repository has been archived by the owner on Jun 6, 2020. It is now read-only.

Add getticks #44

Merged
merged 4 commits into from
Feb 16, 2020
Merged

Add getticks #44

merged 4 commits into from
Feb 16, 2020

Conversation

szbergeron
Copy link

Adds a way of getting the value of the timer used for timestamps in input events. Will allow for proper sampling with libscroll

Copy link
Member

@glennsl glennsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know much about the FFI, but this isn't the most complicated function in the world. Looks good to me!

src/sdl2.re Outdated Show resolved Hide resolved
@@ -795,6 +795,14 @@ CAMLprim value resdl_SDL_WaitTimeoutEvent(value vTimeout) {
CAMLreturn(ret);
}

CAMLprim value resdl_SDL_GetTicks() {
CAMLparam0();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A function that has parameters or local variables of type value must begin with a call to one of the CAMLparam macros and return with CAMLreturn, CAMLreturn0, or CAMLreturnT. In particular, CAMLlocal and CAMLxparam can only be called after CAMLparam.

Here the macro seem useless. I think you should be able to benefit from cheap call with [@noalloc] if you remove the macro.
20.11.2 https://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#sec476 but it is fine otherwise.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, neat. Yeah that sounds like a good idea.

@Et7f3 Et7f3 merged commit 4c2ac30 into revery-ui:master Feb 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants