Results 1 to 14 of 14

Thread: Menu auto-scaling

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default Menu auto-scaling

    Trying to figure out how to auto scale the background in RT3DApp. It stays at iPhone resolution in Windows - even when I change the resolution in main.cpp.

    More general question - can you layout Entities to auto scale/position based on resolution?

  2. #2
    Peasant rzuf's Avatar
    Join Date
    Nov 2010
    Posts
    8

    Default

    Go to App::Init() and check the SetupFakePrimaryScreenSize() function. :)

  3. #3
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    what I'm looking for is a way just to resize the background element - not all elements. Trying to figure out how the various key controls (already in source) will set landscape mode and size in windows. It doesn't appear to be working currently.

  4. #4
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,377

    Default

    what I'm looking for is a way just to resize the background element - not all elements. Trying to figure out how the various key controls (already in source) will set landscape mode and size in windows. It doesn't appear to be working currently.
    Hmm, I'm not clear on what you want to do.

    The demo menu uses a bitmap bg that is 480X320. As rzuf suggested, it is possible to auto-scale it up by doing this:

    in main.cpp I set the video to 1024X768 (named "Windows", but you can add your own resolutions easily)

    Code:
    	string desiredVideoMode = "Windows"; //name needs to match one of the ones defined below
        g_landScapeNoNeckHurtMode = true; //if true, will rotate the screen so we can play in landscape mode in windows without hurting ourselves
    In bool App::Init() near the top I add:

    Code:
    SetupFakePrimaryScreenSize(320,480); //game will think its this size, and will be scaled up
    See attached screenshot for the output. Yep, it's big and blurry and blown up.

    Name:  3dapp_menu.jpg
Views: 18
Size:  261.3 KB

    If we actually choose a menu option we get something like this:
    Name:  3dapp_3d.jpg
Views: 14
Size:  282.4 KB

    Ew! Giant blurry controls! This is because the GUI artwork is also being scaled up too from the iPhone size, and at a different aspect ratio at that.

    If you comment out the SetupFakePrimaryScreenSize(320,480); command from earlier, the GUI art is not scaled and looks much better, but now the menu is too small.

    For a real PC sized game you would just design new menu art and bigger fonts. If you want control on a piece-by-piece basis, you can do that, just scale the entity in question up or down.

    A handy function for that is:
    void EntitySetScaleBySize(Entity *pEnt, CL_Vec2f vDestSize), in EntityUtils.cpp.

    You could use this line in MainMenu.cpp to scale only the BG up (I've taken the SetupFakePrimaryScreenSize out):

    Code:
    Entity * MainMenuCreate(Entity *pParentEnt)
    {
    	Entity *pBG = CreateOverlayEntity(pParentEnt, "MainMenu", "interface/summary_bg.rttex", 0,0);
    	EntitySetScaleBySize(pBG, GetScreenSize()); //only this line is new
    	AddFocusIfNeeded(pBG);
    ...etc
    Now we get this:
    Name:  3dapp_menu_partly_scaled.jpg
Views: 20
Size:  240.3 KB

    The BG is blurry and huge, but the button positions/sizes are not changed, and the examples themselves probably look better.

    Anyway, hope that gives you an idea.
    Seth A. Robinson
    Robinson Technologies

  5. #5
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    Exactly was I was looking for! Thanks for the detailed response!

    I realize scaling Entities is a sloppy way to go, but I'm prototyping for now ;o)

    a couple of annoyances if you don't mind (Windows build):

    1. Sometimes the icon is stuck as an hourglass
    2. The debug output is clipped at the top of the screen (Windows XP - big window borders). How would I move this around and/or modify it? Is it an entity as well?
    Last edited by BigBMan; 11-18-2010 at 04:40 AM.

  6. #6
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    So I tried doing this where SetupFakePrimaryScreenSize is not called from App::Init(). GetScreenSize() returns a zero value vector, which causes my app to crash.

    How can I use the *actual* screen size to scale to what the hardware display's resolution is?

Similar Threads

  1. Help using retail auto package
    By TSO in forum Novashell Game Creation System
    Replies: 6
    Last Post: 05-11-2010, 03:34 AM
  2. Chat Box Auto Scroll
    By lordhogfred in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 03-31-2010, 09:25 AM
  3. Possible Bug? Scaling and clipped frames.
    By catch22 in forum Official ClanLib SDK Forums
    Replies: 14
    Last Post: 06-11-2009, 12:25 PM
  4. Scaling when some tile of parallaxed background selected.
    By Rrrichi in forum Novashell Game Creation System
    Replies: 4
    Last Post: 06-13-2007, 03:11 AM
  5. Auto delete this event
    By in forum Other RTsoft Games
    Replies: 0
    Last Post: 02-16-2003, 08:50 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •