?? urun.pas
字號(hào):
//極限1000米
//Author: CrazyWill
//Email: CrazyWill@163.com
unit uRun;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, ImgList, OleCtrls, SHDocVw, MPlayer,
uSkinSelect, uForm_Info, uForm_Author;
type
TForm_Main = class(TForm)
Image6: TImage;
Panel1: TPanel;
Image_Point: TImage;
Image1: TImage;
Image2: TImage;
Image3: TImage;
Image4: TImage;
Timer1: TTimer;
ImageList1: TImageList;
MediaPlayer1: TMediaPlayer;
pnlTITLE: TPanel;
MediaPlayer2: TMediaPlayer;
Image5: TImage;
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormCreate(Sender: TObject);
procedure pnlTITLEClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_Main: TForm_Main;
implementation
uses uRunning;
var
CurrentPosition: integer;
sound: Boolean;
{$R *.dfm}
procedure TForm_Main.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
point_step: integer;
procedure SelectOK;
var
str: string;
begin
case CurrentPosition of
0:
begin
Form_Main.Hide;
Form_Run.Show;
end;
1:
begin
{ str := '游戲操作說明' + #13 + #10 + #13 + #10 +
'選擇“開始游戲”一項(xiàng),進(jìn)入游戲主界面,' + #13 + #10 +
'且游戲處于暫停狀態(tài),按回車鍵正式開始。' + #13 + #10 + #13 + #10 +
'游戲中隨時(shí)按回車鍵暫停與繼續(xù),' + #13 + #10 +
'ESC鍵立即退出游戲,' + #13 + #10 +
'方向鍵操作游戲角色。';
showmessage(str);
}
Hide;
Form_Info.ShowModal;
Show;
end;
2:
begin
Hide;
Form_SkinSelect.ShowModal;
Show;
end;
3:
begin
{ str := '“潮之陽”軟件工作室' + #13 + #10 + #13 + #10 +
' 程序設(shè)計(jì):許昭鵬' + #13 + #10 +
' 界面設(shè)計(jì):陳培淋';
showmessage(str);
}
Hide;
Form_Author.ShowModal;
Show;
end;
4:
begin
close;
end;
end;
end;
begin
if pnlTITLE.Visible then
begin
pnlTITLEClick(Sender);
exit;
end;
point_step := 40;
if (Key = VK_ESCAPE) then
close;
if (Key = VK_DOWN) or (Key = VK_UP) then
begin
case CurrentPosition of
0:
begin
ImageList1.GetBitmap(0, Image1.Picture.Bitmap);
Image1.Refresh;
end;
1:
begin
ImageList1.GetBitmap(2, Image2.Picture.Bitmap);
Image2.Refresh;
end;
2:
begin
ImageList1.GetBitmap(4, Image3.Picture.Bitmap);
Image3.Refresh;
end;
3:
begin
ImageList1.GetBitmap(6, Image4.Picture.Bitmap);
Image4.Refresh;
end;
4:
begin
ImageList1.GetBitmap(8, Image5.Picture.Bitmap);
Image5.Refresh;
end;
end;
end;
case Key of
VK_DOWN:
begin
Inc(CurrentPosition);
if (CurrentPosition > 4) then
CurrentPosition := 0;
Image_Point.Top := CurrentPosition * point_step;
Image_Point.Refresh;
if sound then
MediaPlayer1.Play;
end;
VK_UP:
begin
Dec(CurrentPosition);
if (CurrentPosition < 0) then
CurrentPosition := 4;
Image_Point.Top := CurrentPosition * point_step;
Image_Point.Refresh;
if sound then
MediaPlayer1.Play;
end;
VK_RETURN:
SelectOK;
VK_SPACE:
SelectOK;
end;
case CurrentPosition of
0:
begin
ImageList1.GetBitmap(1, Image1.Picture.Bitmap);
Image1.Refresh;
end;
1:
begin
ImageList1.GetBitmap(3, Image2.Picture.Bitmap);
Image2.Refresh;
end;
2:
begin
ImageList1.GetBitmap(5, Image3.Picture.Bitmap);
Image3.Refresh;
end;
3:
begin
ImageList1.GetBitmap(7, Image4.Picture.Bitmap);
Image4.Refresh;
end;
4:
begin
ImageList1.GetBitmap(9, Image5.Picture.Bitmap);
Image5.Refresh;
end;
end;
end;
procedure TForm_Main.FormCreate(Sender: TObject);
var
fn: string;
begin
Panel1.Color := clBlack;
self.ClientWidth := 400;
self.ClientHeight := 240;
self.Top := (SCREEN.Height - self.Height) div 2;
self.Left := (SCREEN.Width - self.Width) div 2;
Self.Color := clBlack;
CurrentPosition := 0;
imagelist1.GetBitmap(1, Image1.Picture.Bitmap);
imagelist1.GetBitmap(2, Image2.Picture.Bitmap);
imagelist1.GetBitmap(4, Image3.Picture.Bitmap);
imagelist1.GetBitmap(6, Image4.Picture.Bitmap);
imagelist1.GetBitmap(8, Image5.Picture.Bitmap);
fn := ExtractFilePath(Paramstr(0)) + 'SelectChange.Wav';
if FileExists(fn) then
begin
MediaPlayer1.FileName := fn;
MediaPlayer1.Open;
sound := True;
end
else
sound := false;
fn := ExtractFilePath(Paramstr(0)) + 'TITLE.avi';
if FileExists(fn) then
begin
pnlTITLE.BringToFront;
pnlTITLE.Refresh;
with mediaplayer2 do
begin
filename := fn;
open;
play;
end;
end
else
pnlTITLEClick(Sender);
end;
procedure TForm_Main.pnlTITLEClick(Sender: TObject);
begin
MediaPlayer2.Close;
pnlTITLE.SendToBack;
pnlTITLE.Visible := False;
self.BorderStyle := bsDialog;
self.Width := 350;
self.Height := 330;
self.Top := (SCREEN.Height - self.Height) div 2;
self.Left := (SCREEN.Width - self.Width) div 2;
self.Refresh;
end;
procedure TForm_Main.FormClose(Sender: TObject; var Action: TCloseAction);
begin
MediaPlayer1.Close;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -