Proposed changes for SDL2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tangar
    Veteran
    • Mar 2015
    • 1002

    #16
    Originally posted by backwardsEric

    Changing the third value there changes the y coordinate for the upper left corner. Since you increased that by 11, if you decreased the last value, 952 which is the height, by 11 you would get the same amount of overlap with what's below as you had before (though you will lose some space in the map display). Also, did you try any value for the start coordinate between 19 and 30? From your screenshot, it looks like there's blank space between the menu bar and the start of the main subwindow, so I suspect that something like 22 or 23 for the start (and therefore 949 or 948 for the height) would work without resulting in the red border.
    yep, decreasing map is obvious solution, but it makes it worse then before as you will have less "useful" space... and we want to improve stuff in new SDL2 versions, not to degrade it, right?

    this values worked for reset to fix red border. Afterwards I moved window as much as possible to the top and it still cut half of a line (10px). There screenshot which shows window border on movement. there is no blank space: https://cdn.discordapp.com/attachmen...3440/image.png

    ... so the thing is:
    1) previously is was possible to overlap window (to play with worked: subwindow-full-rect:0:0:19:1920:952) - and there wasn't red frame or error
    2) new version is less flexible - as it do not allow overlapping windows (causing red frame) - which makes "useful" screen smaller than before. now the values are subwindow-full-rect:0:0:29:1920:952 and you can't make it less than 29 (for my font size)

    1. [20:16]Serega88:

      like in sdl1 I set the size of the Menu bar
      window-status-bar-font:0:0:6x10x.fon



      or .ttf font, this may be useful for small displays
    ^ good workaround. atm I use "window-status-bar-font:0:0:8x13x.fon". But I suppose best way to fix this is adding way to hide menu via setting, eg:
    window-status-bar-font:0:0:0
    Last edited by tangar; January 11, 2024, 06:14.
    https://tangaria.com - Angband multiplayer variant
    tangaria.com/variants - Angband variants table
    tangar.info - my website ⍽⍽⍽⍽⍽⍽⍽⍽⍽⍽⍽⍽
    youtube.com/GameGlaz — streams in English ⍽ youtube.com/StreamGuild — streams in Russian

    Comment

    • Ituirth
      Rookie
      • Feb 2021
      • 7

      #17
      to return the style as previous code or sdl1 it is possible to set empty space around labels smaller
      Code:
      sdl2/pui-ctrl.h
      /*
      * Default width for empty space around labels, push buttons, and menu buttons
      */
      #define SDLPUI_DEFAULT_CTRL_BORDER 4
      and with 'SDLPUI_DEFAULT_CTRL_BORDER 4' convenient to use for small displays
      'sdl2init.txt' window-status-bar-font:0:0:6x10x.fon

      Comment

      • Ituirth
        Rookie
        • Feb 2021
        • 7

        #18
        I clicked 'Menu' -> 'Menu shortcuts'
        Window 1 menu 'Change' -> press '1' keyboard -> Close
        click mouse to subwindow, and press '1' on keyboard - opens 'Menu',
        repeat click mouse to subwindow and 1 key, repeated (2 - 3..) pressing several times
        Segmentation fault:
        Code:
        gdb ./angband
        (gdb) run
        Thread 1 "angband" received signal SIGSEGV, Segmentation fault.
        0x0000555556083190 in ?? ()
        (gdb) bt
        #0 0x0000555556083190 in ()
        #1 0x0000555555761833 in handle_key (a=0x555555844f20 <g_app>, key=0x7fffffffdaf0) at main-sdl2.c:3762
        #2 0x0000555555761d03 in get_event (a=0x555555844f20 <g_app>) at main-sdl2.c:3919
        #3 0x0000555555761fc1 in term_xtra_event (v=1) at main-sdl2.c:3989
        #4 0x00005555557621f0 in term_xtra_hook (n=1, v=1) at main-sdl2.c:4064
        #5 0x00005555556b224a in Term_xtra (n=1, v=1) at ui-term.c:477
        #6 0x00005555556b74fa in Term_inkey (ch=0x7fffffffdc04, wait=true, take=true) at ui-term.c:2680
        #7 0x0000555555683cac in inkey_aux (scan_cutoff=0) at ui-input.c:81
        #8 0x0000555555683ffc in inkey_ex () at ui-input.c:286
        #9 0x0000555555695024 in menu_select (menu=0x55555582a8a0 <race_menu>, notify=209, popup=false) at ui-menu.c:782
        #10 0x000055555565fb18 in menu_question
        (current=BIRTH_RACE_CHOICE, current_menu=0x55555582a8a0 <race_menu>, choice_command=CMD_CHOOSE_RACE) at ui-birth.c:801
        #11 0x00005555556614cc in textui_do_birth () at ui-birth.c:1677
        #12 0x0000555555681813 in start_game (new_game=false) at ui-game.c:701
        #13 0x0000555555681fb8 in play_game (mode=GAME_LOAD) at ui-game.c:892
        #14 0x00005555557565c3 in main (argc=1, argv=0x7fffffffdf28) at main.c:540
        (gdb) q

        Comment

        • backwardsEric
          Knight
          • Aug 2019
          • 512

          #19
          Builds from 4.2.5-92-gd8518ad36 on incorporate changes so the menu bar is the same height with the default font as it was in 4.2.5. They also incorporate changes so the minimum window size should never trigger an assertion about not being able to resize the menu bar and to avoid crashes like the one posted by Ituirth in the previous message. The post 4.2.5 builds are available at https://github.com/angband/angband/releases .

          Comment

          • Ituirth
            Rookie
            • Feb 2021
            • 7

            #20
            compiled Angband-750bd63
            When I click on [Menu] with the mouse, I cannot close menu by clicking on the screen.
            it closes if you move the mouse to button [7] and move to the right.

            Comment

            • backwardsEric
              Knight
              • Aug 2019
              • 512

              #21
              Originally posted by Ituirth
              compiled Angband-750bd63
              When I click on [Menu] with the mouse, I cannot close menu by clicking on the screen.
              The changes in https://github.com/angband/angband/pull/5858 (not yet accepted in the repository) should restore the behavior of dismissing a menu when clicking outside of it.

              Comment

              • Nick
                Vanilla maintainer
                • Apr 2007
                • 9613

                #22
                Originally posted by backwardsEric

                The changes in https://github.com/angband/angband/pull/5858 (not yet accepted in the repository) should restore the behavior of dismissing a menu when clicking outside of it.
                Now in the latest nightly release.
                One for the Dark Lord on his dark throne
                In the Land of Mordor where the Shadows lie.

                Comment

                • Ituirth
                  Rookie
                  • Feb 2021
                  • 7

                  #23
                  if the subwindow has red borders (borders.error = true), then it is impossible to fix subwindow move or resize.
                  code is_rect_in_rect(); if remove this, the subwindow moves
                  -> https://github.com/angband/angband/b...n-sdl2.c#L3521
                  handle_mousebutton()
                  if (subwindow && is_rect_in_rect(&subwindow->full_rect,
                  &a->w_mouse->inner_rect)
                  ) {
                  . . . . .
                  }

                  but need to check the subwindow is fixed
                  Code:
                  if (is_rect_in_rect( )) subwindow->borders.error = false;

                  Comment

                  • backwardsEric
                    Knight
                    • Aug 2019
                    • 512

                    #24
                    For now, I would keep the logic for that red border and its side effect of preventing manually moving/resizing the subwindow as is. Instead, I would try to address the situations that cause a subwindow to not fit in the window holding it. https://github.com/angband/angband/pull/5875 should remove some of those situations: resizing the containing window or transferring a subwindow between windows will coerce the subwindow to fit when it is too big and that coercion can be done while still honoring the minimum size for subwindow. The other situations that remain to be fixed are:

                    1) At startup, make sure the position and size of a subwindow are consistent with the containing window and the minimum dimensions for that subwindow
                    2) Fullscreen to not-fullscreen transitions

                    Resolving one or more the fullscreen<->not fullscreen issues on GitHub ( https://github.com/angband/angband/issues/5842 , https://github.com/angband/angband/issues/5841 , and https://github.com/angband/angband/issues/5840 ) should take care of (2).

                    Comment

                    • Ituirth
                      Rookie
                      • Feb 2021
                      • 7

                      #25
                      checked font customization sdl2, number 0-255
                      127 and 173 are not displayed.
                      for example Tangar's font (.fon/.ttf)

                      Code:
                      '/lib/customize/font-sdl2.prf'
                      feat:open floor:*:3:127
                      
                      feat:open floor:*:3:173
                      after the character '~' (126) font number (127) space ' ' https://github.com/angband/angband/b...in-sdl2.c#L184
                      127 fixed with wxyz{|}~\x7f"; but 173 is black.
                      in sdl1 the font displayed correctly

                      Comment

                      • backwardsEric
                        Knight
                        • Aug 2019
                        • 512

                        #26
                        Using 10X20TG.FON from tangar's fonts (https://tangar.info/en/t/tileset) and tracing how entry 173 is rendered in the SDL2 front end, the individual steps appear to be the same as the rendering of entry 174 (TTF_RenderGlyph_Blended() successfully generates a surface, the pitch and dimensions of that surface and the details in the format field of the surface are the same, a texture is generated from the surface with SDL_CreateTextureFromSurface(), the rectangles cropped to the appropriate dimensions, and the texture copied to the destination with SDL_RenderCopy()) while the end result is a black rectangle. The pixels and map fields for the surface are opaque types so I can't check if there is a problem there without more knowledge of what SDL2 does internally. I suspect some interaction between the font and the SDL2_ttf library.

                        [EDIT: 173 is a soft hyphen (to flag a place where a hyphen and a line break could be inserted, but would otherwise be invisible when displayed) in Unicode and ISO 8859-1. That's likely why its getting special treatment (in the FreeType library?) .]
                        Last edited by backwardsEric; February 4, 2024, 13:34. Reason: add stuff about soft hyphens

                        Comment

                        Working...
                        😀
                        😂
                        🥰
                        😘
                        🤢
                        😎
                        😞
                        😡
                        👍
                        👎