1. Dashboard
  2. Forum
    1. Unerledigte Themen
  3. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team-Mitglieder
    4. Trophäen
    5. Mitgliedersuche
  4. Tutorial Bereich
  • Anmelden
  • Registrieren
  • Suche
Dieses Thema
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Seiten
  • Forum
  • Lexikon
  • Erweiterte Suche
  1. Informatik Forum
  2. Community
  3. Gaming

sdl game

  • milton88888
  • 29. Oktober 2011 um 12:48
  • Unerledigt
  • milton88888
    3
    milton88888
    Mitglied
    Punkte
    55
    Beiträge
    9
    • 29. Oktober 2011 um 12:48
    • #1

    i make a sdl c++ game i now i have this problem.
    the screen resolution in fullscreen mode is 1920x1080 but if i play it on another computer screen with the screen resolution 960x540 the game crashes because of the pixel resolution.

    how can i make the screen smaler without making every picture again and place it on other position.
    only making the screen surface smaler but to see the same as in 1920x1080 only smaler

    sorry for bad english(i´m from germany):)

  • mtoman
    13
    mtoman
    Mitglied
    Reaktionen
    47
    Punkte
    1.767
    Beiträge
    331
    • 29. Oktober 2011 um 13:22
    • #2

    Sieh mal bei
    http://forums.gamedesigncenter.org/viewtopic.php?f=1&t=263&sid=c5efee6d60f00bd07c09eb0a7d4942cb
    u
    nd
    http://www.sdltutorials.com/sdl-scale-surface


    Oder OpenGL verwenden und sich darum keine Sorgen machen (dafür halt andere) :winking_face:

  • milton88888
    3
    milton88888
    Mitglied
    Punkte
    55
    Beiträge
    9
    • 29. Oktober 2011 um 13:52
    • #3

    i dont think that this solves my problem
    perhaps there an option to create a "second screen" where i can make the whole blitting etc. with the original size(1920x1080)
    and then show the second screen (resized with the correct resolution) on the first shown screen(with the computer screen resolution "960x540","1600x800" and so on)

    thanks for answer!!!!!!!!:):mad::(:ausheck::confused::o

  • mtoman
    13
    mtoman
    Mitglied
    Reaktionen
    47
    Punkte
    1.767
    Beiträge
    331
    • 29. Oktober 2011 um 14:12
    • #4

    I think one guy in the "zoom"-thread did this - write everything to an offline framebuffer as a reference coordinate system and then resize to the lower resolution. So I think this should be possible.
    If there is a function for resizing in SDL it shouldn't be much of a problem.

    But don't try something like
    x' = x * ( 1920 / 320 )
    y' = y * ( 1080 / 200 )
    for every pixel (x,y) in the 320x200-image...
    this might be fast but you will most certainly lose important pixel information from the 1920x1080 image :)

    Use an SDL function.. or if you have fun doing it, you could take x' and y' in the 1920x1080 buffer and use the mean value of the ceil( 1920 / 320 ) x ceil( 1080 / 200 ) pixel block around it or some hacked stuff like that ;).

    No.. better the built in resize function ;))

  • milton88888
    3
    milton88888
    Mitglied
    Punkte
    55
    Beiträge
    9
    • 29. Oktober 2011 um 14:17
    • #5

    whats an offline framebuffer
    sorry for the bad english

  • mtoman
    13
    mtoman
    Mitglied
    Reaktionen
    47
    Punkte
    1.767
    Beiträge
    331
    • 29. Oktober 2011 um 14:22
    • #6

    From the forum:
    "I did exactly this in my game Brum Brum Rally. The way I did it was to have a small surface, in my case of size 320x240. Instead of drawing onto the screen surface I did all drawing onto this smaller surface."

    So what I mean is a buffer/surface that is not drawn on the screen.

    He did it the other way round - small surface and resized to a large screen as he seems to want the "blocky look" (probably used nearest-neighbor interpolation for that but that doesn't really matter..)

  • milton88888
    3
    milton88888
    Mitglied
    Punkte
    55
    Beiträge
    9
    • 29. Oktober 2011 um 14:30
    • #7

    do you know how to define a buffer/surface because that i dont have to go throught his whole code

  • milton88888
    3
    milton88888
    Mitglied
    Punkte
    55
    Beiträge
    9
    • 29. Oktober 2011 um 14:57
    • #8

    i found it for other who have problems with it heres the code
    screen = SDL_CreateRGBSurface(SDL_SWSURFACE, 1920, 1080, format->BitsPerPixel,
    format->Rmask, format->Gmask, format->Bmask, format->Amask);
    create a screan like that and make all blitting on it!!!
    after all blittings blit the"screen" on the real screen(the one who is shown)and shrink the screen in a funktion
    apply_surface(0,0,shrinkSurface(screen, 2,2),screen_shown);

  • milton88888
    3
    milton88888
    Mitglied
    Punkte
    55
    Beiträge
    9
    • 29. Oktober 2011 um 15:07
    • #9

    perhaps do you know a good shrinking function
    except sdl gfx (there is only possible to make the surface half of real or the 1/3 or 1/4 and so on)

  • mtoman
    13
    mtoman
    Mitglied
    Reaktionen
    47
    Punkte
    1.767
    Beiträge
    331
    • 29. Oktober 2011 um 15:07
    • #10

    I think
    http://wiki.libsdl.org/moin.cgi/SDL_CreateRGBSurface?highlight=%28%5CbCategorySurface%5Cb%29|%28CategoryStruct%29|%28CategoryEnum%29


    and then blit to this surface using
    http://wiki.libsdl.org/moin.cgi/SDL_BlitSurface?highlight=%28%5CbCategorySurface%5Cb%29|%28CategoryStruct%29|%28CategoryEnum%29


    But it has been years since I played with SDL (and then rather used opengl)

  • milton88888
    3
    milton88888
    Mitglied
    Punkte
    55
    Beiträge
    9
    • 29. Oktober 2011 um 15:24
    • #11

    there is nothing to resize an image

  • milton88888
    3
    milton88888
    Mitglied
    Punkte
    55
    Beiträge
    9
    • 29. Oktober 2011 um 15:55
    • #12

    does anyone know something
    ??????????????????????????????????????

  • Paulchen
    1
    Paulchen
    Gast
    • 29. Oktober 2011 um 18:02
    • #13

    Nur so nebenbei:

    Zitat von milton88888

    sorry for bad english(i´m from germany):)

    Die meisten Leute in Österreich verstehen recht gut Deutsch. :winking_face:

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!

Benutzerkonto erstellen Anmelden

Tags

  • c++
  • game
  • resolution
  • screen
  • sdl

Benutzer online in diesem Thema

  • 1 Besucher

Rechtliches

Impressum

Datenschutzerklärung