Author Topic: KeyboardSearch module  (Read 58096 times)

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
KeyboardSearch module
« on: October 28, 2017, 05:35:25 PM »
I just pushed my keyboard-search module to github.. have at it! It's completely customizable, see  the README for usage:

https://github.com/liquid8d/attract-extra/tree/master/modules/objects/keyboard-search



I haven't worked on this recently and wanted to get it and my layout that uses it out there, so let me know if you come across any bugs. There may be issues with different orientations or aspect ratios.
« Last Edit: October 28, 2017, 09:20:01 PM by liquid8d »

calle81

  • Sr. Member
  • ****
  • Posts: 184
    • View Profile
Re: KeyboardSearch module
« Reply #1 on: October 29, 2017, 04:37:24 PM »
Wow, awesome! Works great! Thanks for this. :)

SomeoneElse

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: KeyboardSearch module
« Reply #2 on: November 04, 2017, 05:21:41 PM »
Sorry for newb question. But i am not following..
is this extension of plugin search within attract or module by it self?

because keyboard search plugin when activated is nothing like ur search module and its unusable for me as it crashes all the time.

So what am i missing? if plugin is deactivated custom1 key does nothing at all

kent79

  • Hero Member
  • *****
  • Posts: 857
    • View Profile
Re: KeyboardSearch module
« Reply #3 on: November 04, 2017, 05:30:43 PM »
Sorry for newb question. But i am not following..
is this extension of plugin search within attract or module by it self?

because keyboard search plugin when activated is nothing like ur search module and its unusable for me as it crashes all the time.

So what am i missing? if plugin is deactivated custom1 key does nothing at all

Please see the guide first.  :)

https://github.com/liquid8d/attract-extra/blob/master/modules/objects/keyboard-search/README.md

kent79

  • Hero Member
  • *****
  • Posts: 857
    • View Profile
Re: KeyboardSearch module
« Reply #4 on: November 04, 2017, 05:32:00 PM »
Hope it can add "Confirm" button later. Thanks.  :)

SomeoneElse

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: KeyboardSearch module
« Reply #5 on: November 04, 2017, 05:35:33 PM »
Sorry for newb question. But i am not following..
is this extension of plugin search within attract or module by it self?

because keyboard search plugin when activated is nothing like ur search module and its unusable for me as it crashes all the time.

So what am i missing? if plugin is deactivated custom1 key does nothing at all

Please see the guide first.  :)

https://github.com/liquid8d/attract-extra/blob/master/modules/objects/keyboard-search/README.md

i did read it. it mentions calling function from within layout , but there are no basic guides on doing so. my next best guess is tha ti need to call the function from within theme it self?
ok im getting somewhere, still something is breaking it.
i added
fe.load_module("objects/keyboard-search");
local search_surface = fe.add_surface(fe.layout.width, fe.layout.height)
KeyboardSearch(search_surface).init()
to module list in theme layout, but visibility is breaking up. maybe due to my snap background..will figure out..


P.S
yeah my snap background is breaking any visibility of search module. And its stretched out i can only see keyboard. I am not knowlegable in this coding language so this ends my attempt.

Anyway nice to see good looking search for attract
« Last Edit: November 04, 2017, 06:03:06 PM by SomeoneElse »

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: KeyboardSearch module
« Reply #6 on: November 04, 2017, 10:54:39 PM »
I do plan on adding a DONE or CONFIRM :)

SomeoneElse:

This is a module, meant for layout designers. However, if you are making your own layout - you are welcome to try it out.
First, make sure you are adding the search surface (the add_surface line) AFTER your background and other objects that you don't want ontop of the search.

Also, the default search key is "custom1" - if that is bound to something else, that might cause you problems. You can set it directly by adding .search_key("custom2") to the init line, or add the user config options as shown in the README to your layout.

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1274
    • View Profile
Re: KeyboardSearch module
« Reply #7 on: November 05, 2017, 12:26:56 AM »
Very cool module. Great job liquid8d!

SomeoneElse

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: KeyboardSearch module
« Reply #8 on: November 05, 2017, 03:09:52 AM »
I do plan on adding a DONE or CONFIRM :)

SomeoneElse:

This is a module, meant for layout designers. However, if you are making your own layout - you are welcome to try it out.
First, make sure you are adding the search surface (the add_surface line) AFTER your background and other objects that you don't want ontop of the search.

Also, the default search key is "custom1" - if that is bound to something else, that might cause you problems. You can set it directly by adding .search_key("custom2") to the init line, or add the user config options as shown in the README to your layout.

i did that first time, although because i didnt see any load order or brackets for functions in this coding i thought it wont matter now i understand that it calls from top to bottom. So added at the bottom of script to avoid everything and visibility is fine now.

Although im not sure where to define size x y of search?
i am only seeing leters from keyboard not the search result on the right side as shown in ur picture

https://i.imgur.com/MAnXRya.jpg
this is what i mean

searching atari dropped me at first atari, without that seek list on right side. i have more then one atari
-----
i managed to make search box smaller by utilizing half screen 0.5 instead of 1.0 but i am still not getting list on right side, is that part of another module ? or am i missing something

P.S i guess its not possible to actually allow keyboard typing be used as search?

P.P.S
The reason why i bother u and sorry if i am. Is because the actual fully functional implemented search in some theme and posted will probably be done , never.Considering how empty things are of late..So i am just trying to enable this very good stuff for my self at least.
« Last Edit: November 05, 2017, 03:46:57 AM by SomeoneElse »

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: KeyboardSearch module
« Reply #9 on: November 05, 2017, 08:09:34 AM »
The list is in my layout.

AttractMode has a command to filter your results based on search text. The module just calls this command with the text you input, but your layout has to show the actual games - either through a list, or adding objects that have index_offset set to show a set of games.

Also, added keyboard typing to TODO :)
« Last Edit: November 05, 2017, 08:47:43 AM by liquid8d »

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: KeyboardSearch module
« Reply #10 on: November 05, 2017, 02:16:50 PM »
I added a DONE key, along with an option to retain the search when you reopen it. You can also now default to text only instead of images by just passing null to keys_image_folder() and set the keys charsize with .keys_charsize().

As for keyboard input, I realize why i didn't add it - I'm not sure if you can override (grab) individual keyboard keys, at least with a module. Have to look into it further.

You can grab the changes here:

https://github.com/liquid8d/attract-extra/tree/master/modules/objects/keyboard-search

As I was making the changes, I realized it was not very clearly explained and I struggled myself to setup the default stuff  ;D Some of the instructions were pulled directly from my blueprint layout and still had user_config[...] in there.

I'm going to update the instructions a bit. In the meantime, I added a sample layout:
https://github.com/liquid8d/attract-extra/tree/master/layouts/sample_keyboard_search

Probably the most confusing thing is text_pos() and keys_pos() - this is a 0-1 map of x, y, w, h on where the search text and key layout will be within the *search surface*. For example:

Code: [Select]
local search_surface = fe.add_surface(fe.layout.width / 2, fe.layout.height);
local keyboard = KeyboardSearch(search_surface)

Code: [Select]
keyboard.text_pos( 0, 0, 1, 0.1 )
Here the search text will occupy the full width of the search surface (or half the screen). It will occupy 10% (0.1) of the height of the search surface.

Code: [Select]
keyboard.text_pos( 0, 0.5, 1, 0.5 )
Here the keys (all of them) will occupy the bottom half of the search surface ( y = 0.5 and height = 0.5, or half of search surface height).

Hopefully that makes sense.

kent79

  • Hero Member
  • *****
  • Posts: 857
    • View Profile
Re: KeyboardSearch module
« Reply #11 on: November 06, 2017, 03:35:52 PM »
@liquid8d

I would like to add this module in my "AMGPS Theme".  Every is good, but one thing can't fix it.

I don't know to make Game time out counter reset while keyboard screen closed. Could you help me to check it? Thanks.

//reset timeout
count = user_interval;
ui_counter.msg = count;

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: KeyboardSearch module
« Reply #12 on: November 07, 2017, 08:22:49 PM »
hi kent, not sure what you mean? Are you saying you want to do that when the keyboard is closed?

kent79

  • Hero Member
  • *****
  • Posts: 857
    • View Profile
Re: KeyboardSearch module
« Reply #13 on: November 07, 2017, 09:59:03 PM »
hi kent, not sure what you mean? Are you saying you want to do that when the keyboard is closed?

Yes. Sorry my English doesn't good enough  :)

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: KeyboardSearch module
« Reply #14 on: November 08, 2017, 03:25:23 PM »
No problem! There is a toggle() method in there which is called to show or hide the keyboard. All it does is switch the keyboard surface alpha to 0 or 255. You could hook into that, if ( surface.alpha == 0 ) //do your stuff.