-
Notifications
You must be signed in to change notification settings - Fork 87
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
Touch control #77
base: main
Are you sure you want to change the base?
Touch control #77
Conversation
# Conflicts: # library/borealis.mk # library/include/borealis/platforms/switch/switch_platform.hpp
# Conflicts: # library/include/borealis/core/platform.hpp # library/include/borealis/platforms/glfw/glfw_platform.hpp # library/include/borealis/platforms/switch/switch_platform.hpp # library/include/borealis/views/view.hpp # library/lib/platforms/glfw/glfw_platform.cpp # library/lib/platforms/switch/switch_platform.cpp # library/lib/views/scrolling_frame.cpp # library/meson.build
Hey, thanks for the PR! I'm sorry I didn't get to review it the first time, seeing that it's pretty large. It's going to take me some time to process everything, can you maybe explain quickly how your implementation works / how is its architecture? Thanks! |
It does not look like your branch is building for Switch, I see glfw / OpenGL stuff being built 🙁 |
That's strange... Merged yoga branch right now and checked, make clean / make -j works fine. |
You added glfw back to the Switch Makefile it seems |
Oh, I remember, in one of your old commits it was there, and I could not build nro, so I removed it by my self but not commited it, cause I thought you need it for any reason. |
I was able to try it by removing the glfw line in the Makefile. It works quite well, good job! Don't forget to add your name to the copyrights if you didn't already 😄 I don't know how far you wanted to go with your code, but there are a few things I noticed:
How do you want to proceed? Do you want me to look at the code and review it before changing anything? Or do you want to tackle some of these issues first? |
In qlaunch when you touch on things, you need to touch them once to select them THEN touch them another time to click them. So actually borealis views should have two modes: a "touch to click" one and a "touch to highlight, touch another time to click" mode |
I think if you'll review it, it will be better cause I'm new in c++ (I'm c#/swift developer). |
Also I have no sounds in borealis at all, do you have any idea of why that could be? |
Sound is only implemented on Switch right now, are you trying on Switch? It works for me, does it not work for you? |
Yes, I'm trying on switch with atmosphere 17.1, hos 11.1 |
Using touch or controller? Do you see anything relevant in the logs? |
Is your hbloader old by any chance? |
It's v3.4.0 |
oh, it's hbmenu |
This is a filesystem permission issue. The qlaunch romfs is accessible with hbloader since v2.3.3. Don't use forwarders. |
I got it, I don't know why, but I cannot run hbmenu by holding R while running any title (albums works fine, but it's an applet), so I created a forwarder for hbmenu. It worked fine when I was on SXOS, but after updating on Atmosphere it stoped working, do you know any reason of why that could happen? |
It looks like a botched Atmos install and/or config to me 👀 I'm going to read and review the changes when I can, it's a big PR so it might take me a while to take in lol |
Tell me how you would test scrolling without a super long text? |
+1, I used it to test long scrolling view. True, it's on Russia, but I could replace it with lorem ipsum text. It was the first I found in google with "super long text" request. Also I've found, that there is the problem with cyrillic character "Ц" in glfw version of font, it shows like " ," without "U". |
It's understandable if the super long text is for the scrolling, but yeah the text should be changed to the lorem ipsum example. You could also move the current example to another folder for Russian text. |
Well, I thought an alternative could be a bunch of elements that you scroll down on. For example, a bunch of pictures on the screen, maybe some big buttons that do nothing, rectangles? And yes, I'm aware my example is similar to the first tab in the demo. |
I've changed sound processing a bit. Now I'm not calling play() inside recognizer's callback anymore, now I'm setting sound to the pointer, provided by recognitionLoop() and play it inside Application. If there are several recognizers with custom sound, only the closest to the firstFesponder will be taken. |
I wanted to try this out, and I like it. It controls pretty smoothly, even on a Mac. Only one suggestion (might be hard to implement), I wish the scrolling on GLFW platforms was easier to do (what I mean is adding support for the scroll-wheel). |
I thought a lot about scrolling by wheel but I cannot realise how could I do that without any problem for users of Borealis... |
Borealis is not about mouse, it's about controllers and touch. As mouse is
yet another "input type" with different control schemes, I wouldn't focus
on making mouse usable for now.
Le jeu. 25 mars 2021 à 09:55, Vinogradov Daniil ***@***.***>
a écrit :
… I thought a lot about scrolling by wheel but I cannot realise how I could
do that without any problem for users of Borealis...
The main idea is to allow pan gesture recognizer work with both
scenarious, like it works on iOS apps ported on Mac, it's gestures
automatically translates to Mac's equivalents.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#77 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAI3CKCXSUXWQTTRSBDG77LTFL26HANCNFSM4XBXJ4ZA>
.
|
I've added mouse scrolling, tried to use as less code as possible. Review it please. |
Is it implemented as part of touch or separately? Because scrolling using the wheel doesn't make sense in a touch context, since... touch screens don't have a mouse wheel. If it works it's fine but it's weird to have a hybrid touch emulation / scroll wheel on a computer. I would rather implememt mouse as mouse with its own defined behavior and stuff |
As you could guess, I'm using ios and macos as reference. Apple's UIKit has auto adaptation of its gesture recognizers for touch and mouse, so I can use the same recognizer on both platforms. I wanted to implement something like that, but right now I've implemented only scrolling wheel as separate part for mouse. May be I should fully separate their inputs and combine them in single struct i.e. "ScreenInput" and toss it through recognizers, but that will double the code of recognizers, cause then we'll need to handle both touch and mouse. I'm still not sure what will be the best solution, so decided to write something what will not have too many lines of code and will be easy to replace later. |
Wow, it works really fluently! It feels like i'm using a web browser, which is good. |
@XITRIX And what purpose does it serve at the moment? Does mouse still act as a touch pointer on PC? Isn't it weird to have a half touch half mouse thing? |
You could test it, it works perfectly fine now, like it should work on PC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some more tiny comments, I think I'm starting to get through the review!
Once I go through the whole code I'll try it once again on PC and on Switch to see how it looks and feels, and see if there are little things that need to be tweaked here and there.
* | ||
* Child of Pan recognizer. | ||
* The only difference is that Scroll recognizer will translate scrolling wheel to pan gestures. | ||
* If NO_TOUCH_SCROLLING=true defined, will ignore scrolling by touch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the "should touch scroll" boolean be defined in the platform instead of as a define?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think while it's temporary solution there is no reason to create separate variable for that.
When mouse will be separated from touch, scroll will not trigger by mouse dragging the view.
@@ -149,6 +150,7 @@ void Application::createWindow(std::string windowTitle) | |||
bool Application::mainLoop() | |||
{ | |||
static ControllerState oldControllerState = {}; | |||
static View* firstResponder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
touchFirstResponder
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be used also for mouse , so may be leave it as is?
switch (touchState.phase) | ||
{ | ||
case TouchPhase::START: | ||
Logger::debug("Touched at X: " + std::to_string(touchState.position.x) + ", Y: " + std::to_string(touchState.position.y)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to remember to remove all debug prints once we're done
{ | ||
Sound sound = firstResponder->gestureRecognizerRequest(touchState, firstResponder); | ||
float pitch = 1; | ||
if (sound == SOUND_TOUCH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC in HOS there are more sounds that have their pitch randomized, did you poke around to see for yourself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you hint me what else sounds have randomized pitch? It was the only sound I heard randomized.
TODO for me after I'm done reviewing the code:
|
I've made a basic touch-event system, hope it could be useful.