Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding possability to use 64bit unsigned long long in nk_property_ull gui element #70

Open
KenthJohan opened this issue Mar 4, 2020 · 1 comment

Comments

@KenthJohan
Copy link
Contributor

KenthJohan commented Mar 4, 2020

Using 32bit size signed is limited to [−2,147,483,647, +2,147,483,647] range.
It's not possible to have larger value than that in the current Nuklear.
Adding support for unsigned long long which is 64bit size will have [0, +18,446,744,073,709,551,615] range and open up more possibility for apps using Nuklear.
The function could be called nk_property_ull(struct nk_context *ctx, const char *name, unsigned long long min, unsigned long long *val, unsigned long long max, unsigned long long step, float inc_per_pixel).

Adding this function would require:

enum nk_property_kind {
    NK_PROPERTY_INT,
    NK_PROPERTY_FLOAT,
    NK_PROPERTY_DOUBLE,
+   NK_PROPERTY_ULL
};
union nk_property {
    int i;
    float f;
    double d;
+   unsigned long long ull;
};

We have to think about not overflowing signed or wrap around unsigned values. INT30-C INT32-C.

@KenthJohan KenthJohan changed the title Can we add nk_property_ull for 64 bit unsigned integers? Adding possability to use 64bit unsigned long long in nk_property_ull gui element Mar 16, 2020
@dumblob
Copy link
Member

dumblob commented Mar 17, 2020

Generally I'm not against 64 (or more) bit widths nor against adding new property functions to Nuklear. I'm though quite concerned about unsigned as all other functions were deliberately signed. Would it work for your use case to use signed 64 bit integers?

There should be also a "friend" function analogous to nk_propertyi().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants