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

What's required to write a GUI App? #2

Open
Skeeve opened this issue Nov 16, 2020 · 9 comments
Open

What's required to write a GUI App? #2

Skeeve opened this issue Nov 16, 2020 · 9 comments
Assignees
Labels

Comments

@Skeeve
Copy link
Contributor

Skeeve commented Nov 16, 2020

Hi.
I do not understand how to write a GUI app for Pocketbook. Did you already do it? Do you have an example?

I think I need to include some GUI library (which one) to be able to paint windows and buttons and to react to button presses.

But as I never ever did that in any language (besides Javascript in a browser), I'm clueless here.

Do you have some guidance, please?

@dennwc dennwc self-assigned this Nov 16, 2020
@dennwc
Copy link
Owner

dennwc commented Nov 16, 2020

Hi @Skeeve,

This library is relatively low level, as it exposes the API provided by the InkView SDK. You can check device info, get events, draw on screen, force it to refresh. But there is no complete GUI framework to use.

So you either need to try building a GUI app using those primitives (e.g. drawing lines, boxes and pixels) or we need to think which existing Golang framework can be used with this SDK.

If you want to try the first way, you will need to implement the App interface, and call Run. This will start the event loop handle by the SDK.

Events will automatically call the related callback on the interface:

	// Key is called on each key-related event.
	Key(e KeyEvent) bool
	// Pointer is called on each pointer-related event.
	Pointer(e PointerEvent) bool
	// Touch is called on each touch-related event.
	Touch(e TouchEvent) bool
	// Orientation is called each time an orientation of device changes.
	Orientation(o Orientation) bool

In the Draw callback you can use functions like DrawLine or DrawString followed by one of the screen update functions (e.g. FullUpdate). When the state of your app/UI changes, you need to call Repaint to ask SDK to call your Draw callback again.

If this is too much trouble for the app you want to build, we definitely need to explore ways to integrate with existing GUI frameworks for Go.

@Skeeve
Copy link
Contributor Author

Skeeve commented Nov 16, 2020

I really would prefer to "explore ways to integrate with existing GUI frameworks for Go."

I think that would be most beneficial for everyone.

@dennwc
Copy link
Owner

dennwc commented Nov 16, 2020

Although the most popular GUI toolkits for Go are Fyne and Gio, they both require OpenGL and shaders support in one form or another. There's also Shiny, which is partially deprecated, but allows to use simpler backends like the one we have for PocketBook.

@Skeeve
Copy link
Contributor Author

Skeeve commented Nov 16, 2020

Currently you see me completely clueless in regards what this is about and what's required to get it to work.

@dennwc
Copy link
Owner

dennwc commented Nov 18, 2020

After a chat with guys at Fyne, it seems like there is a way to make it work with this kind of renderer as well. This might take a while, though.

@dennwc
Copy link
Owner

dennwc commented Jan 6, 2021

I looked into it and the first step that is required is to get a direct access to PB framebuffer.

The short path is to just render to a bitmap and then draw it using Inkview API. Unfortunately I hit some issues when trying to render RGB images (it should be supported according to docs). Grayscale works, but it would require too many copy operations which may affect performance significantly (get RGB framebuffer, copy it to grayscale, copy to PB).

So I started to look into a different direction: reverse engineer the inkview.so and reimplement the parts we are care about in Go. For now it doesn't look too complicated and should give direct access to the framebuffer. But again, it might take some time.

@Skeeve
Copy link
Contributor Author

Skeeve commented Jan 26, 2021

Hi Denys…
While looking around PB's filesystem, i notices the directory ebrmain/qml. Could it be that QT Quick is available on the device?

@Skeeve
Copy link
Contributor Author

Skeeve commented Feb 5, 2021

Might be interesting: "Building cross-platform Go GUIs fast using Fyne"

With the growing popularity of Go many people are asking how to build a solid GUI. The language design to target concurrency and portability makes it a great match for cross-platform development. This talk shows how the Fyne toolkit is designed to help make beautiful and idiomatic native apps with Go.

This talk explores the Fyne toolkit and what is new with the recently released version 2.0. We will explore the main features including canvas, widgets, data binding, test support and app store packaging.

We will step through how to build an application using standard widgets, data binding and storage, and then see how it can be distributed for practically all graphical operating systems and app stores.

@wzykubek
Copy link

I think this project is dead, did you guys created something before and can share some more information, tips etc.?

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

No branches or pull requests

3 participants