hedgewars/fGUI.pas
author unc0rr
Mon, 05 Dec 2005 21:46:15 +0000
changeset 24 79c411363184
parent 4 bcbd7adb4e4b
permissions -rw-r--r--
Add theme objects to land
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
     1
(*
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
     2
 * Hedgewars, a worms-like game
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
     3
 * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
     4
 *
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
     5
 * Distributed under the terms of the BSD-modified licence:
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
     6
 *
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
     7
 * Permission is hereby granted, free of charge, to any person obtaining a copy
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
     8
 * of this software and associated documentation files (the "Software"), to deal
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
     9
 * with the Software without restriction, including without limitation the
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    10
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    11
 * sell copies of the Software, and to permit persons to whom the Software is
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    12
 * furnished to do so, subject to the following conditions:
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    13
 *
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    14
 * 1. Redistributions of source code must retain the above copyright notice,
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    15
 *    this list of conditions and the following disclaimer.
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    16
 * 2. Redistributions in binary form must reproduce the above copyright notice,
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    17
 *    this list of conditions and the following disclaimer in the documentation
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    18
 *    and/or other materials provided with the distribution.
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    19
 * 3. The name of the author may not be used to endorse or promote products
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    20
 *    derived from this software without specific prior written permission.
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    21
 *
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    22
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    23
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    24
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    25
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    26
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    27
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    28
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    29
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    30
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    31
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    32
 *)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    33
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    34
unit fGUI;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    35
interface
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    36
uses Windows;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    37
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    38
procedure ProcessMessages;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    39
function GetWindowTextStr(hwnd: HWND): string;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    40
procedure DoControlPress(wParam: WPARAM;  lParam: LPARAM);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    41
procedure DoDrawButton(idCtl: UINT; lpmis: PDrawItemStruct);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    42
procedure LoadGraphics;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    43
procedure DoDestroy;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    44
procedure DoCreateControls;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    45
procedure DoCreateMainWindow;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    46
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    47
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    48
var hwndMain,hwndOptions: HWND;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    49
var isTerminated: boolean = false;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    50
var //main menu
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    51
    bitmap       ,optbmp        ,localbmp      ,netbmp      ,demobmp    ,exitbmp      ,setsbmp      : HBITMAP;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    52
    BackGroundDC ,OptBGroundDC  ,DCLocalGame   ,DCNetGame   ,DCDemoPlay ,DCExitGame   ,DCSettings   : HDC;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    53
                  HLocalGameBtn ,HNetGameBtm ,HDemoBtn   ,HExitGameBtn ,HSettingsBtn, HBGStatic : HWND;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    54
    //other
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    55
    HNetIPEdit,HNetIPStatic: HWND;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    56
    HNetNameEdit,HNetNameStatic,HNetConnectionStatic: HWND;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    57
    HNetJoinBtn,HNetBeginBtn,HNetBackBtn:HWND;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    58
    HDemoList,HDemoBeginBtn,HDemoBackBtn,HDemoAllBtn:HWND;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    59
    HSetResEdit,HFullScrCheck,HSetDemoCheck,HSetSndCheck,HSetSaveBtn,HSetBackBtn,HSetShowTeamOptionsBtn:HWND;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    60
    scrx, scry: real;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    61
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    62
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    63
implementation
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    64
uses fConsts, Messages, SysUtils, uConsts, fGame, fNet, fMisc, fOptionsGUI;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    65
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    66
function GetWindowTextStr(hwnd: HWND): string;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    67
var i: integer;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    68
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    69
i:= GetWindowTextLength(hwnd);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    70
SetLength(Result, i);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    71
GetWindowText(hwnd, PChar(Result), Succ(i))
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    72
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    73
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    74
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    75
procedure ProcessMessages;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    76
var Message: Windows.MSG;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    77
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    78
if PeekMessage(Message,0,0,0,PM_REMOVE) then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    79
  if Message.message <> WM_QUIT then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    80
    begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    81
    TranslateMessage(Message);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    82
    DispatchMessage(Message)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    83
    end else isTerminated:= true
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    84
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    85
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    86
procedure HideMain;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    87
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    88
ShowWindow(HLocalGameBtn,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    89
ShowWindow(HNetGameBtm,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    90
ShowWindow(HDemoBtn,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    91
ShowWindow(HSettingsBtn,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    92
ShowWindow(HExitGameBtn,SW_HIDE)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    93
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    94
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    95
procedure ShowMain;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    96
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    97
ShowWindow(HLocalGameBtn,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    98
ShowWindow(HNetGameBtm,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
    99
ShowWindow(HDemoBtn,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   100
ShowWindow(HSettingsBtn,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   101
ShowWindow(HExitGameBtn,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   102
SetFocus(HLocalGameBtn)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   103
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   104
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   105
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   106
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   107
procedure ShowNetGameMenu;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   108
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   109
HideMain;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   110
ShowWindow(HNetIPStatic,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   111
ShowWindow(HNetIPEdit,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   112
ShowWindow(HNetNameStatic,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   113
ShowWindow(HNetNameEdit,SW_SHOW);  
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   114
ShowWindow(HNetConnectionStatic,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   115
ShowWindow(HNetJoinBtn,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   116
ShowWindow(HNetBeginBtn,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   117
ShowWindow(HNetBackBtn,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   118
SetFocus(HNetJoinBtn)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   119
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   120
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   121
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   122
procedure ShowMainFromNetMenu;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   123
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   124
ShowWindow(HNetIPEdit,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   125
ShowWindow(HNetIPStatic,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   126
ShowWindow(HNetNameEdit,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   127
ShowWindow(HNetNameStatic,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   128
ShowWindow(HNetConnectionStatic,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   129
ShowWindow(HNetJoinBtn,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   130
ShowWindow(HNetBeginBtn,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   131
ShowWindow(HNetBackBtn,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   132
ShowMain
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   133
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   134
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   135
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   136
procedure ShowDemoMenu;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   137
var i: integer;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   138
    sr: TSearchRec;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   139
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   140
SendMessage(HDemoList, LB_RESETCONTENT, 0, 0);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   141
i:= FindFirst(format('%s*.hwd_%d',[Pathz[ptDemos], cNetProtoVersion]), faAnyFile and not faDirectory, sr);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   142
while i = 0 do
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   143
      begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   144
      SendMessage(HDemoList, LB_ADDSTRING, 0, LPARAM(PChar(sr.Name)));
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   145
      i:= FindNext(sr)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   146
      end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   147
FindClose(sr);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   148
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   149
HideMain;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   150
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   151
ShowWindow(HDemoList,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   152
ShowWindow(HDemoBeginBtn,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   153
ShowWindow(HDemoAllBtn,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   154
ShowWindow(HDemoBackBtn,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   155
SetFocus(HDemoList)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   156
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   157
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   158
procedure ShowMainFromDemoMenu;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   159
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   160
ShowWindow(HDemoList,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   161
ShowWindow(HDemoBeginBtn,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   162
ShowWindow(HDemoAllBtn,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   163
ShowWindow(HDemoBackBtn,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   164
ShowMain
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   165
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   166
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   167
procedure ShowSettingsMenu;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   168
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   169
HideMain;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   170
ShowWindow(HSetResEdit,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   171
ShowWindow(HFullScrCheck,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   172
ShowWindow(HSetDemoCheck,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   173
ShowWindow(HSetSndCheck,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   174
ShowWindow(HSetSaveBtn,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   175
ShowWindow(HSetBackBtn,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   176
ShowWindow(HSetShowTeamOptionsBtn,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   177
SetFocus(HSetResEdit)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   178
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   179
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   180
procedure ShowMainFromSettings;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   181
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   182
ShowWindow(HSetResEdit,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   183
ShowWindow(HFullScrCheck,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   184
ShowWindow(HSetDemoCheck,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   185
ShowWindow(HSetSndCheck,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   186
ShowWindow(HSetSaveBtn,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   187
ShowWindow(HSetBackBtn,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   188
ShowWindow(HSetShowTeamOptionsBtn,SW_HIDE);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   189
ShowMain
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   190
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   191
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   192
procedure DoControlPress(wParam: WPARAM;  lParam: LPARAM);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   193
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   194
case LOWORD(wParam) of
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   195
    cLocalGameBtn : StartLocalGame;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   196
    cNetGameBtn   : ShowNetGameMenu;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   197
    cDemoBtn      : ShowDemoMenu;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   198
    cSettingsBtn  : ShowSettingsMenu;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   199
    cExitGameBtn  : Halt;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   200
    cNetBackBtn   : ShowMainFromNetMenu;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   201
    cNetJoinBtn   : NetConnect;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   202
    cNetBeginBtn  : StartNetGame;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   203
    cDemoBackBtn  : ShowMainFromDemoMenu;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   204
    cDemoAllBtn   : MessageBeep(0);//PlayAllDemos;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   205
    cDemoBeginBtn : StartDemoView;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   206
    cSetSaveBtn   : SaveSettings;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   207
    cSetBackBtn   : ShowMainFromSettings;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   208
    cSetShowTeamOptions : ShowOptionsWindow;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   209
    end
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   210
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   211
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   212
procedure DoDrawButton(idCtl: UINT; lpmis: PDrawItemStruct);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   213
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   214
case lpmis.CtlID of
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   215
  cLocalGameBtn: StretchBlt(lpmis.hDC,0,0,trunc(309*scrx),trunc(22*scry),DCLocalGame,0,0,309,22,SRCCOPY);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   216
    cNetGameBtn: StretchBlt(lpmis.hDC,0,0,trunc(272*scrx),trunc(22*scry),DCNetGame  ,0,0,272,22,SRCCOPY);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   217
       cDemoBtn: StretchBlt(lpmis.hDC,0,0,trunc(181*scrx),trunc(22*scry),DCDemoPlay ,0,0,181,22,SRCCOPY);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   218
   cSettingsBtn: StretchBlt(lpmis.hDC,0,0,trunc(147*scrx),trunc(22*scry),DCSettings ,0,0,147,22,SRCCOPY);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   219
   cExitGameBtn: StretchBlt(lpmis.hDC,0,0,trunc(272*scrx),trunc(22*scry),DCExitGame ,0,0,272,22,SRCCOPY);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   220
      cBGStatic: StretchBlt(lpmis.hDC,0,0,trunc(1024*scrx),trunc(768*scry),BackGroundDC,0,0,1024,768,SRCCOPY);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   221
   cOptBGStatic: StretchBlt(lpmis.hDC,0,0,trunc(1024*scrx),trunc(768*scry),OptBGroundDC,0,0,1024,768,SRCCOPY);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   222
     end
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   223
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   224
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   225
procedure LoadGraphics;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   226
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   227
scrx :=  GetSystemMetrics(SM_CXSCREEN)/1024;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   228
scry :=  GetSystemMetrics(SM_CYSCREEN)/768;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   229
LoadOwnerBitmap(bitmap, cGFXPath + 'front.bmp',      BackGroundDC,hwndMain);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   230
LoadOwnerBitmap(optbmp, cGFXPath + 'TeamSettings.bmp',OptBGroundDC,hwndOptions);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   231
LoadOwnerBitmap(localbmp,cGFXPath + 'startlocal.bmp', DCLocalGame,cLocalGameBtn);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   232
LoadOwnerBitmap(netbmp,  cGFXPath + 'startnet.bmp',   DCNetGame,  cNetGameBtn);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   233
LoadOwnerBitmap(demobmp, cGFXPath + 'playdemo.bmp',   DCDemoPlay, cDemoBtn);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   234
LoadOwnerBitmap(setsbmp, cGFXPath + 'settings.bmp',   DCSettings, cSettingsBtn);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   235
LoadOwnerBitmap(exitbmp, cGFXPath + 'exit.bmp',       DCExitGame, cExitGameBtn);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   236
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   237
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   238
procedure DoDestroy;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   239
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   240
DeleteObject(localbmp);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   241
DeleteObject(optbmp);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   242
DeleteObject(bitmap);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   243
DeleteObject(netbmp);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   244
DeleteObject(demobmp);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   245
DeleteObject(setsbmp);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   246
DeleteObject(bitmap);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   247
DeleteDC(DCLocalGame);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   248
DeleteDC(DCNetGame);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   249
DeleteDC(DCDemoPlay);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   250
DeleteDC(DCSettings);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   251
DeleteDC(BackGroundDC);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   252
DeleteDC(OptBGroundDC)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   253
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   254
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   255
procedure DoCreateControls;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   256
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   257
HBGStatic      := CreateWindow('STATIC','bg image static'  ,WS_CHILD or WS_VISIBLE or SS_OWNERDRAW, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), hwndMain, cBGStatic, HInstance, nil);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   258
/// main menu ///
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   259
HLocalGameBtn  := CreateWindow('button','local game button',WS_CHILD or WS_VISIBLE or BS_OWNERDRAW, trunc(510 * scrx), trunc(400 *scry), trunc(309* scrx) , trunc(22*scry) , hwndMain , cLocalGameBtn, HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   260
HNetGameBtm    := CreateWindow('button',  'net game button',WS_CHILD or WS_VISIBLE or BS_OWNERDRAW, trunc(530 * scrx), trunc(450 *scry), trunc(272* scrx) , trunc(22*scry) , hwndMain ,   cNetGameBtn, HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   261
HDemoBtn       := CreateWindow('button', 'play demo button',WS_CHILD or WS_VISIBLE or BS_OWNERDRAW, trunc(570 * scrx), trunc(500 *scry), trunc(181* scrx) , trunc(22*scry) , hwndMain ,      cDemoBtn, HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   262
HSettingsBtn   := CreateWindow('button', 'settings  button',WS_CHILD or WS_VISIBLE or BS_OWNERDRAW, trunc(590 * scrx), trunc(550 *scry), trunc(147* scrx) , trunc(22*scry) , hwndMain ,  cSettingsBtn, HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   263
HExitGameBtn   := CreateWindow('button', 'exit game button',WS_CHILD or WS_VISIBLE or BS_OWNERDRAW, trunc(530 * scrx), trunc(600 *scry), trunc(272* scrx) , trunc(22*scry) , hwndMain ,  cExitGameBtn, HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   264
/// local menu ///
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   265
/// net menu ///
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   266
HNetIPEdit     := CreateWindow('EDIT', '255.255.255.255'   ,WS_CHILD or WS_TABSTOP,                     trunc(570* scrx), trunc(400*scry) , 150 , 16 , hwndMain ,  cNetIpEdit,     HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   267
HNetIPStatic   := CreateWindow('STATIC','IP :'             ,WS_CHILD or SS_SIMPLE,                      trunc(520* scrx), trunc(400*scry) , 50  , 16 , hwndMain ,  cNetIpStatic,   HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   268
HNetNameEdit   := CreateWindow('EDIT', 'Hedgewarrior'      ,WS_CHILD or WS_TABSTOP,                     trunc(570* scrx), trunc(420*scry) , 150 , 16 , hwndMain ,  cNetNameEdit,   HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   269
HNetNameStatic := CreateWindow('STATIC','Name : '          ,WS_CHILD or SS_SIMPLE,                      trunc(520* scrx), trunc(420*scry) , 50  , 16 , hwndMain ,  cNetNameStatic, HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   270
HNetConnectionStatic
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   271
               := CreateWindow('STATIC','not connected'    ,WS_CHILD,                                   trunc(520* scrx), trunc(450*scry) , 90 , 16 , hwndMain ,  cNetConnStatic,  HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   272
HNetJoinBtn    := CreateWindow('BUTTON','Join Game'        ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(520* scrx), trunc(550*scry) , 90 , 20 , hwndMain ,  cNetJoinBtn,     HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   273
HNetBeginBtn   := CreateWindow('BUTTON','Begin Game'       ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(520* scrx), trunc(575*scry) , 90 , 20 , hwndMain ,  cNetBeginBtn,    HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   274
HNetBackBtn    := CreateWindow('BUTTON','Back'             ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(520* scrx), trunc(600*scry) , 90 , 20 , hwndMain ,  cNetBackBtn,     HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   275
/// demo menu ///
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   276
HDemoList      := CreateWindow('LISTBOX',''                ,WS_CHILD or WS_TABSTOP, trunc(530* scrx),   trunc(400*scry) , trunc(200* scrx), trunc(200*scry), hwndMain,  cDemoList, HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   277
HDemoBeginBtn  := CreateWindow('BUTTON','Play demo'        ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(750* scrx), trunc(400*scry) , 100 , 20 , hwndMain ,  cDemoBeginBtn,   HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   278
HDemoAllBtn    := CreateWindow('BUTTON','Play all demos'   ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(750* scrx), trunc(425*scry) , 100 , 20 , hwndMain ,  cDemoAllBtn,     HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   279
HDemoBackBtn   := CreateWindow('BUTTON','Back'             ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(750* scrx), trunc(450*scry) , 100 , 20 , hwndMain ,  cDemoBackBtn,    HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   280
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   281
/// settings menu ///
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   282
HSetResEdit    := CreateWindow('COMBOBOX', ''              ,WS_CHILD or CBS_DROPDOWNLIST or WS_TABSTOP, trunc(530* scrx), trunc(420*scry) , 150 , 100 , hwndMain ,  cSetResEdit,   HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   283
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   284
SendMessage(HSetResEdit, CB_ADDSTRING, 0, LPARAM(PChar('640x480')));
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   285
SendMessage(HSetResEdit, CB_ADDSTRING, 0, LPARAM(PChar('800x600')));
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   286
SendMessage(HSetResEdit, CB_ADDSTRING, 0, LPARAM(PChar('1024x768')));
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   287
SendMessage(HSetResEdit, CB_ADDSTRING, 0, LPARAM(PChar('1280x1024')));
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   288
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   289
HFullScrCheck  := CreateWindow('BUTTON','Fullscreen'       ,WS_CHILD or BS_AUTOCHECKBOX or WS_TABSTOP,  trunc(530* scrx), trunc(450*scry) , 110 , 20 , hwndMain ,  cSetFScrCheck,  HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   290
HSetDemoCheck  := CreateWindow('BUTTON','Record Demo'      ,WS_CHILD or BS_AUTOCHECKBOX or WS_TABSTOP,  trunc(530* scrx), trunc(475*scry) , 110 , 20 , hwndMain ,  cSetDemoCheck,  HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   291
HSetSndCheck   := CreateWindow('BUTTON','Enable Sound'     ,WS_CHILD or BS_AUTOCHECKBOX or WS_TABSTOP,  trunc(530* scrx), trunc(500*scry) , 110 , 20 , hwndMain ,  cSetSndCheck,   HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   292
HSetSaveBtn    := CreateWindow('BUTTON','Save Settings'    ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(530* scrx), trunc(580*scry) , 100 , 20 , hwndMain ,  cSetSaveBtn,    HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   293
HSetBackBtn    := CreateWindow('BUTTON','Back'             ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(730* scrx), trunc(580*scry) , 90  , 20 , hwndMain ,  cSetBackBtn,    HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   294
HSetShowTeamOptionsBtn    := CreateWindow('BUTTON','Show Team Options' ,WS_CHILD or BS_FLAT or WS_TABSTOP, trunc(700* scrx), trunc(420*scry) , 140  , 20 , hwndMain ,  cSetShowTeamOptions,    HInstance,  nil );
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   295
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   296
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   297
procedure DoCreateMainWindow;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   298
var  wc: WNDCLASS;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   299
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   300
FillChar(wc, sizeof(wc), 0);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   301
wc.style         := CS_VREDRAW or CS_HREDRAW;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   302
wc.hbrBackground := COLOR_BACKGROUND;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   303
wc.lpfnWndProc   := @MainWndProc;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   304
wc.hInstance     := hInstance;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   305
wc.lpszClassName := cAppName;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   306
wc.hCursor := LoadCursor(hwndMain,IDC_ARROW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   307
if RegisterClass(wc) = 0 then begin MessageBox(0,'RegisterClass failed for main wnd','Failed',MB_OK); halt; end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   308
hwndMain := CreateWindowEx( 0, cAppName, cAppTitle, WS_POPUP,
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   309
	                    0, 0,
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   310
	                    GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   311
                            0, 0, hInstance, nil);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   312
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   313
ShowWindow(hwndMain,SW_SHOW);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   314
UpdateWindow(hwndMain)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   315
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   316
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   317
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 1
diff changeset
   318
end.