~ubuntu-branches/ubuntu/trusty/teeworlds/trusty

« back to all changes in this revision

Viewing changes to src/game/client/components/menus_settings.cpp

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2013-05-05 09:49:34 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20130505094934-uidw42ov1t0jlvrz
Tags: 0.6.2+dfsg-1
* New upstream release.
  - Update patches.
* Pass $CPPFLAGS to the build system.
* Switch to my @debian.org email address.
* Bump Standards-Version to 3.9.4, no changes needed.
* Change Vcs host to anonscm.debian.org.

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
                if(DoButton_CheckBox(&g_Config.m_ClShowhud, Localize("Show ingame HUD"), g_Config.m_ClShowhud, &Button))
97
97
                        g_Config.m_ClShowhud ^= 1;
98
98
 
 
99
                // chat messages
 
100
                Left.HSplitTop(5.0f, 0, &Left);
 
101
                Left.HSplitTop(20.0f, &Button, &Left);
 
102
                if(DoButton_CheckBox(&g_Config.m_ClShowChatFriends, Localize("Show only chat messages from friends"), g_Config.m_ClShowChatFriends, &Button))
 
103
                        g_Config.m_ClShowChatFriends ^= 1;
 
104
 
99
105
                // name plates
100
106
                Right.HSplitTop(20.0f, &Button, &Right);
101
107
                if(DoButton_CheckBox(&g_Config.m_ClNameplates, Localize("Show name plates"), g_Config.m_ClNameplates, &Button))
221
227
                        float OldWidth = Item.m_Rect.w;
222
228
                        Item.m_Rect.w = Item.m_Rect.h*2;
223
229
                        Item.m_Rect.x += (OldWidth-Item.m_Rect.w)/ 2.0f;
224
 
                        Graphics()->TextureSet(pEntry->m_Texture);
225
 
                        Graphics()->QuadsBegin();
226
 
                        Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
227
 
                        IGraphics::CQuadItem QuadItem(Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h);
228
 
                        Graphics()->QuadsDrawTL(&QuadItem, 1);
229
 
                        Graphics()->QuadsEnd();
230
 
                        UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, 0);
 
230
                        vec4 Color(1.0f, 1.0f, 1.0f, 1.0f);
 
231
                        m_pClient->m_pCountryFlags->Render(pEntry->m_CountryCode, &Color, Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h);
 
232
                        if(pEntry->m_Texture != -1)
 
233
                                UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, 0);
231
234
                }
232
235
        }
233
236
 
446
449
        { "Remote console", "toggle_remote_console", 0 },
447
450
        { "Screenshot", "screenshot", 0 },
448
451
        { "Scoreboard", "+scoreboard", 0 },
 
452
        { "Respawn", "kill", 0 },
449
453
};
450
454
 
451
455
/*      This is for scripts/update_localization.py to work, don't remove!
452
456
        Localize("Move left");Localize("Move right");Localize("Jump");Localize("Fire");Localize("Hook");Localize("Hammer");
453
457
        Localize("Pistol");Localize("Shotgun");Localize("Grenade");Localize("Rifle");Localize("Next weapon");Localize("Prev. weapon");
454
458
        Localize("Vote yes");Localize("Vote no");Localize("Chat");Localize("Team chat");Localize("Show chat");Localize("Emoticon");
455
 
        Localize("Spectator mode");Localize("Spectate next");Localize("Spectate previous");Localize("Console");Localize("Remote console");Localize("Screenshot");Localize("Scoreboard");
 
459
        Localize("Spectator mode");Localize("Spectate next");Localize("Spectate previous");Localize("Console");Localize("Remote console");Localize("Screenshot");Localize("Scoreboard");Localize("Respawn");
456
460
*/
457
461
 
458
462
const int g_KeyCount = sizeof(gs_aKeys) / sizeof(CKeyInfo);
504
508
        }
505
509
 
506
510
        CUIRect MovementSettings, WeaponSettings, VotingSettings, ChatSettings, MiscSettings, ResetButton;
507
 
        MainView.VSplitLeft(MainView.w/2-5.0f, &MovementSettings, &VotingSettings);
 
511
        MainView.VSplitMid(&MovementSettings, &VotingSettings);
508
512
 
509
513
        // movement settings
510
514
        {
 
515
                MovementSettings.VMargin(5.0f, &MovementSettings);
511
516
                MovementSettings.HSplitTop(MainView.h/3+60.0f, &MovementSettings, &WeaponSettings);
512
517
                RenderTools()->DrawUIRect(&MovementSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
513
518
                MovementSettings.Margin(10.0f, &MovementSettings);
543
548
                WeaponSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &WeaponSettings);
544
549
                UiDoGetButtons(5, 12, WeaponSettings);
545
550
        }
546
 
        
 
551
 
547
552
        // defaults
548
553
        {
549
554
                ResetButton.HSplitTop(10.0f, 0, &ResetButton);
550
555
                RenderTools()->DrawUIRect(&ResetButton, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
551
556
                ResetButton.HMargin(10.0f, &ResetButton);
552
557
                ResetButton.VMargin(30.0f, &ResetButton);
 
558
                ResetButton.HSplitTop(20.0f, &ResetButton, 0);
553
559
                static int s_DefaultButton = 0;
554
560
                if(DoButton_Menu((void*)&s_DefaultButton, Localize("Reset to defaults"), 0, &ResetButton))
555
561
                        m_pClient->m_pBinds->SetDefaults();
556
562
        }
557
 
        
 
563
 
558
564
        // voting settings
559
565
        {
560
 
                VotingSettings.VSplitLeft(10.0f, 0, &VotingSettings);
 
566
                VotingSettings.VMargin(5.0f, &VotingSettings);
561
567
                VotingSettings.HSplitTop(MainView.h/3-75.0f, &VotingSettings, &ChatSettings);
562
568
                RenderTools()->DrawUIRect(&VotingSettings, vec4(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
563
569
                VotingSettings.Margin(10.0f, &VotingSettings);
590
596
                TextRender()->Text(0, MiscSettings.x, MiscSettings.y, 14.0f*UI()->Scale(), Localize("Miscellaneous"), -1);
591
597
 
592
598
                MiscSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &MiscSettings);
593
 
                UiDoGetButtons(17, 25, MiscSettings);
 
599
                UiDoGetButtons(17, 26, MiscSettings);
594
600
        }
595
601
 
596
602
}
607
613
        static int s_GfxScreenWidth = g_Config.m_GfxScreenWidth;
608
614
        static int s_GfxScreenHeight = g_Config.m_GfxScreenHeight;
609
615
        static int s_GfxColorDepth = g_Config.m_GfxColorDepth;
 
616
        static int s_GfxBorderless = g_Config.m_GfxBorderless;
610
617
        static int s_GfxFullscreen = g_Config.m_GfxFullscreen;
611
618
        static int s_GfxVsync = g_Config.m_GfxVsync;
612
619
        static int s_GfxFsaaSamples = g_Config.m_GfxFsaaSamples;
613
620
        static int s_GfxTextureQuality = g_Config.m_GfxTextureQuality;
614
621
        static int s_GfxTextureCompression = g_Config.m_GfxTextureCompression;
 
622
        static int s_GfxThreaded = g_Config.m_GfxThreaded;
615
623
 
616
624
        CUIRect ModeList;
617
625
        MainView.VSplitLeft(300.0f, &MainView, &ModeList);
662
670
 
663
671
        // switches
664
672
        MainView.HSplitTop(20.0f, &Button, &MainView);
 
673
        if(DoButton_CheckBox(&g_Config.m_GfxBorderless, Localize("Borderless window"), g_Config.m_GfxBorderless, &Button))
 
674
        {
 
675
                g_Config.m_GfxBorderless ^= 1;
 
676
                if(g_Config.m_GfxBorderless && g_Config.m_GfxFullscreen)
 
677
                        g_Config.m_GfxFullscreen = 0;
 
678
                CheckSettings = true;
 
679
        }
 
680
 
 
681
        MainView.HSplitTop(20.0f, &Button, &MainView);
665
682
        if(DoButton_CheckBox(&g_Config.m_GfxFullscreen, Localize("Fullscreen"), g_Config.m_GfxFullscreen, &Button))
666
683
        {
667
684
                g_Config.m_GfxFullscreen ^= 1;
 
685
                if(g_Config.m_GfxFullscreen && g_Config.m_GfxBorderless)
 
686
                        g_Config.m_GfxBorderless = 0;
668
687
                CheckSettings = true;
669
688
        }
670
689
 
681
700
                g_Config.m_GfxFsaaSamples = (g_Config.m_GfxFsaaSamples+1)%17;
682
701
                CheckSettings = true;
683
702
        }
 
703
        
 
704
        MainView.HSplitTop(20.0f, &Button, &MainView);
 
705
        if(DoButton_CheckBox(&g_Config.m_GfxThreaded, Localize("Threaded rendering"), g_Config.m_GfxThreaded, &Button))
 
706
        {
 
707
                g_Config.m_GfxThreaded ^= 1;
 
708
                CheckSettings = true;
 
709
        }
684
710
 
685
 
        MainView.HSplitTop(40.0f, &Button, &MainView);
 
711
        MainView.HSplitTop(20.0f, &Button, &MainView);
 
712
        if(g_Config.m_GfxThreaded)
 
713
        {
 
714
                Button.VSplitLeft(20.0f, 0, &Button);
 
715
                if(DoButton_CheckBox(&g_Config.m_GfxAsyncRender, Localize("Handle rendering async from updates"), g_Config.m_GfxAsyncRender, &Button))
 
716
                {
 
717
                        g_Config.m_GfxAsyncRender ^= 1;
 
718
                        CheckSettings = true;
 
719
                }
 
720
        }
 
721
                
686
722
        MainView.HSplitTop(20.0f, &Button, &MainView);
687
723
        if(DoButton_CheckBox(&g_Config.m_GfxTextureQuality, Localize("Quality Textures"), g_Config.m_GfxTextureQuality, &Button))
688
724
        {
707
743
                if(s_GfxScreenWidth == g_Config.m_GfxScreenWidth &&
708
744
                        s_GfxScreenHeight == g_Config.m_GfxScreenHeight &&
709
745
                        s_GfxColorDepth == g_Config.m_GfxColorDepth &&
 
746
                        s_GfxBorderless == g_Config.m_GfxBorderless &&
710
747
                        s_GfxFullscreen == g_Config.m_GfxFullscreen &&
711
748
                        s_GfxVsync == g_Config.m_GfxVsync &&
712
749
                        s_GfxFsaaSamples == g_Config.m_GfxFsaaSamples &&
713
750
                        s_GfxTextureQuality == g_Config.m_GfxTextureQuality &&
714
 
                        s_GfxTextureCompression == g_Config.m_GfxTextureCompression)
 
751
                        s_GfxTextureCompression == g_Config.m_GfxTextureCompression &&
 
752
                        s_GfxThreaded == g_Config.m_GfxThreaded)
715
753
                        m_NeedRestartGraphics = false;
716
754
                else
717
755
                        m_NeedRestartGraphics = true;
761
799
                if(g_Config.m_SndEnable)
762
800
                {
763
801
                        if(g_Config.m_SndMusic)
764
 
                                m_pClient->m_pSounds->Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f, vec2(0, 0));
 
802
                                m_pClient->m_pSounds->Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f);
765
803
                }
766
804
                else
767
805
                        m_pClient->m_pSounds->Stop(SOUND_MENU);
775
813
        if(DoButton_CheckBox(&g_Config.m_SndMusic, Localize("Play background music"), g_Config.m_SndMusic, &Button))
776
814
        {
777
815
                g_Config.m_SndMusic ^= 1;
778
 
                if(g_Config.m_SndMusic)
779
 
                        m_pClient->m_pSounds->Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f, vec2(0, 0));
780
 
                else
781
 
                        m_pClient->m_pSounds->Stop(SOUND_MENU);
 
816
                if(Client()->State() == IClient::STATE_OFFLINE)
 
817
                {
 
818
                        if(g_Config.m_SndMusic)
 
819
                                m_pClient->m_pSounds->Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f);
 
820
                        else
 
821
                                m_pClient->m_pSounds->Stop(SOUND_MENU);
 
822
                }
782
823
        }
783
824
 
784
825
        MainView.HSplitTop(20.0f, &Button, &MainView);
785
826
        if(DoButton_CheckBox(&g_Config.m_SndNonactiveMute, Localize("Mute when not active"), g_Config.m_SndNonactiveMute, &Button))
786
827
                g_Config.m_SndNonactiveMute ^= 1;
787
828
 
 
829
        MainView.HSplitTop(20.0f, &Button, &MainView);
 
830
        if(DoButton_CheckBox(&g_Config.m_ClThreadsoundloading, Localize("Threaded sound loading"), g_Config.m_ClThreadsoundloading, &Button))
 
831
                g_Config.m_ClThreadsoundloading ^= 1;
 
832
 
788
833
        // sample rate box
789
834
        {
790
835
                char aBuf[64];
917
962
                        Item.m_Rect.VSplitLeft(Item.m_Rect.h*2.0f, &Rect, &Item.m_Rect);
918
963
                        Rect.VMargin(6.0f, &Rect);
919
964
                        Rect.HMargin(3.0f, &Rect);
920
 
                        Graphics()->TextureSet(m_pClient->m_pCountryFlags->GetByCountryCode(r.front().m_CountryCode)->m_Texture);
921
 
                        Graphics()->QuadsBegin();
922
 
                        IGraphics::CQuadItem QuadItem(Rect.x, Rect.y, Rect.w, Rect.h);
923
 
                        Graphics()->QuadsDrawTL(&QuadItem, 1);
924
 
                        Graphics()->QuadsEnd();
 
965
                        vec4 Color(1.0f, 1.0f, 1.0f, 1.0f);
 
966
                        m_pClient->m_pCountryFlags->Render(r.front().m_CountryCode, &Color, Rect.x, Rect.y, Rect.w, Rect.h);
925
967
                        Item.m_Rect.HSplitTop(2.0f, 0, &Item.m_Rect);
926
968
                        UI()->DoLabelScaled(&Item.m_Rect, r.front().m_Name, 16.0f, -1);
927
969
                }