Giter VIP home page Giter VIP logo

inky's Introduction

Hey there 👋🏻

My name is Justin van der Leij, a software engineering student from the Netherlands.

I love everything programming, from front- to backend, robotics, apps, and games.
I'm currently in the fourth year of my study at the NHL Stenden University of Applied Sciences for my bachelor's degree in software engineering.

When I'm not programming I'm likely playing the 🎹 or spoiling my 😸😸😸😸.

🛠️ Technologies and Tools

📬 Social Media

You can find me on LinkedIn , Twitter and Discord .

inky's People

Contributors

badduck32 avatar keyslam avatar steveroll-git avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

inky's Issues

Lifetime hooks

Elements have to be drawn every frame. If they're not drawn, they are removed from the Scene's event system.
It can be useful to know when an element is added or removed from the event system: The element is effectively enabled or disabled, which might mean that some resources need to fetched or cleaned up.

I propose the following API:

context:onEnable(function()
    // ...
end)

context:onDisable(function()
  // ...
end)

Target mode broken?

I'm not sure if I'm just misunderstanding, but I've got code that looks like this:

pointer:setTarget{actions[1]}
print (pointer:getMode())

This prints "POSITION".

Lines 85 - 94 of core/pointer/internal.lua read as follows:

	if (self._target ~= target) then
		return self
	end

	self._target = target
	self._mode = PointerMode.TARGET

	self._scene:__getInternal():onPointerTargetChanged(self._pointer)

	return self

If I'm reading that right, it seems like the problem is that the if statement is backwards. Replacing the ~= with == on line 85 causes this error:

Error

lib/Inky/inky/core/pointer/internal.lua:244: attempt to call method '__getInternal' (a nil value)


Traceback

[love "callbacks.lua"]:228: in function 'handler'
lib/Inky/inky/core/pointer/internal.lua:244: in function 'setOverlappingElements'
lib/Inky/inky/core/scene/internal.lua:108: in function '_resolvePointerOverlappingElements'
lib/Inky/inky/core/scene/internal.lua:132: in function 'onPointerTargetChanged'
lib/Inky/inky/core/pointer/internal.lua:92: in function 'setTarget'
lib/Inky/inky/core/pointer/init.lua:54: in function 'setTarget'
ui/actionbar.lua:17: in function '_initializer'
lib/Inky/inky/core/element/internal.lua:312: in function 'initialize'
lib/Inky/inky/core/scene/internal.lua:199: in function 'render'
lib/Inky/inky/core/element/internal.lua:323: in function 'render'
lib/Inky/inky/core/element/init.lua:159: in function 'render'
main.lua:105: in function 'draw'
[love "callbacks.lua"]:168: in function <[love "callbacks.lua"]:144>
[C]: in function 'xpcall'

Which is beyond my ability to troubleshoot.

Performance improvement: Spatial hash

By using the same mechanic as the lifetime hooks (#2), and keeping track of when an element moves, it's possible to add and remove an element from a spatial hash.
This can make overlap checks significantly faster.
UI doesn't tend to change a whole lot every frame, so the performance benefit will probably outweigh the cost of maintaining a spatial hash for complex UI's. For simple UI's it is not necessary.

I propose using a spatial hash is opt-in per scene:

scene:useSpatialhash(boolean)

Documenting Inky

Inky works in a different way than most (LÖVE) users might be used to. It also follows a paradigm that's not really immediate or retained mode, which makes it harder for users of different GUI libraries to convert.

Inky should be well documented such that using it is as painless as possible.
I, personally, am not that good at documenting, so I'd appreciate any and all help and feedback for this.

Performance improvement: Check pointers only on change

Currently, every pointer is checked against every element every frame. This can be improved.
There is a mechanism in place that will check a pointer only against elements if the pointer changed, but this falls short when the element changes.

Consumption of pointer events

If a pointer event is emitted at a point where multiple elements are overlapping, the event will be sent to all of the elements.
In some cases, events should be able to be consumed: A window might consume any clicks, such that a window below won't be focused.
To enable this, a sense of "depth" is also required.

I propose the following changes:

  1. When drawing an element, a 5th argument can be given to indicate the "depth" of the element can be given. This defaults to 0:
myElement(x, y, w, h, depth)
  1. The depth is passed into the render function:
return function(view, depth)
  otherElement(view, depth + 1)
end
  1. Inky, under the hood, will send events to elements with higher depth first.
  2. Context:onPointer and Context:onPointerEnter can return true to indicate the event was consumed. It will not be passed to other elements then.

Default implementations for Elements?

In my opinion, it is not possible to create a set of widgets that work for everyone's usecase, without being way to bloated and complicated to use.
However, I also recognize that some users just want some basic UI elements they can set up, and be done with it.

I am debating if Inky should provide some default implementation for elements, such as buttons, labels, sliders, checkboxes, radioboxes, text fields, et cetera. And if so, how would these widgets be styled by the user?

Alternatively, these widgets could be hosted in one or more other repositories, there could be a Material-like implementation, a ImGUI-like implementation, et cetera.

Pointer:setActive does not work

As the title says: Pointer:setActive does not work. It does set the state within the Pointer, and notifies Scene of the change, but the state is completely ignored for the overlap check.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.