BackSprite:=TBackgroundSprite.Create(DXSpriteEngine.Engine); with TBackgroundSprite(BackSprite) do begin SetMapSize(1, 1);{设定背景显示样式为1×1} Image := ImageList.Items.Find('background'); {载入背景图片} Z := -2; {设定背景层次} Tile := True; {设定背景填充样式为平铺} end; PlayerSprite := TPlayerSprite.Create(DXSpriteEngine.Engine); with TPlayerSprite(PlayerSprite) do begin Image := ImageList.Items.Find('player'); Z := 2; Width := Image.Width; Height := Image.Height; end; {载入游戏人物} end; procedure TMainForm.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin {如果按了Esc,则退出} if Key=VK_ESCAPE then Close; {全屏模式和窗口模式的切换} if (ssAlt in Shift) and (Key=VK_RETURN) then begin DXDraw.Finalize; if doFullScreen in DXDraw.Options then begin RestoreWindow; DXDraw.Cursor := crNone; BorderStyle := bsSizeable; DXDraw.Options := DXDraw.Options - [doFullScreen]; end else begin StoreWindow; DXDraw.Cursor := crNone; BorderStyle := bsNone; DXDraw.Options := DXDraw.Options + [doFullScreen]; end;
|
正在阅读:用Delphi + DirectX开发简单RPG游戏用Delphi + DirectX开发简单RPG游戏
2004-02-14 09:34
出处:电脑爱好者
责任编辑:linjixiong
键盘也能翻页,试试“← →”键