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

web: set variants according to what the browser runs on #1953

Merged
merged 2 commits into from Aug 16, 2019

Conversation

@Beuc
Copy link
Contributor

commented Jul 20, 2019

This proposal detects additional variants by querying the browser.

This allows the same web game to e.g. plays with a mobile UI on mobile, and with a full-blown UI on desktop/"pc". This can be tested with real hardware as well as "Responsive Design Mode" in browsers.

I'm not entirely sure about setting "android" and "ios", maybe some games use it to target OS-specific features not available through the browser.

(tested on 7.3.2.320, master is broken with the on-going GL work AFAICS)

@renpytom

This comment has been minimized.

Copy link
Member

commented Jul 21, 2019

My feeling is that web should be exclusive of the other platform-specific things. I like the idea of detecting touch and small/medium/large, but I don't think a web platform game should set mobile, pc, android, or ios. (Or linux/windows/macintosh, for that matters.)

Basically, if renpy.variant("android") was used to implement some requirement for Android, I don't think that should affect the Android value.

Master shouldn't be broken, though you might have to delete renpy/module/gen to build it.

@Beuc

This comment has been minimized.

Copy link
Contributor Author

commented Jul 21, 2019

  • One issue is whether to display the (keyboard/mouse-related) help menu, as well as the window/full-screen menu; that's mainly why I set 'pc' vs. 'mobile'&'tv'. What would you suggest?

  • Looking again at 'touch', my heuristic seems error prone due to hybrids like microsoft surface, and Edge's way to declare touchpads as touch devices. I'm thinking of only defining it when we detect a mobile browser (even if we don't define the 'mobile' variant) to mitigate, there doesn't seem to be a clean way to address this, all the doc I found recommends moving away from touch/not-touch binary logic.

Master shouldn't be broken, though you might have to delete renpy/module/gen to build it.

I (obviously) did that, as well as registered the new matrix module. Does it work for you??

@Beuc

This comment has been minimized.

Copy link
Contributor Author

commented Jul 23, 2019

(added a note about missing window/full-screen menu as well)

@renpytom

This comment has been minimized.

Copy link
Member

commented Jul 23, 2019

Hm... is it possible to detect the presence of a keyboard or mouse on the device? It might be a good idea to proactively set keyboard and mouse variants, rather than touch.

I haven't tried building the web version of the gl2 codebase, though I'll hopefully get to that soon.

@Beuc

This comment has been minimized.

Copy link
Contributor Author

commented Jul 24, 2019

AFAICS browsers push devs to handle all kind of events as they are received, rather than attempt to double-guess how the user will use the webpage. Consequently they do not provide devs with device capabilities ahead of time (i.e. the code doesn't know there's a keyboard until it receives a keyboard event).
I found a possible way to detect a mouse but nothing for keyboards.

@Beuc Beuc force-pushed the Beuc:variants-web branch from e4467af to 204a48f Aug 5, 2019

@Beuc

This comment has been minimized.

Copy link
Contributor Author

commented Aug 5, 2019

I reworked the proposal.

  • 'android'/'ios'/'pc' dropped
  • mitigate pc-tablet hybrids by defining "touch" only on mobile
  • keep 'mobile' as it's the basis for many decisions
  • display Help only if pc or web&!mobile
  • display Fullscreen option for pc&web

@renpytom renpytom merged commit b5707d7 into renpy:master Aug 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.