游戏开发论坛

 找回密码
 立即注册
搜索
查看: 3242|回复: 2

用Asphyre写显示图片的程序,怎么不能装载预设的图片?

[复制链接]

3

主题

4

帖子

8

积分

新手上路

Rank: 1

积分
8
发表于 2005-12-2 03:07:00 | 显示全部楼层 |阅读模式
用Asphyre写一段很简单的小程序,想显示一下图片,图片也已经打包放在当前目录下的asdb文件内,但运行时却老是显示别的Asphyre程序运行时的图片,好象是图片未读入,:(。不知为何,请高手指教。
procedure TForm1.FormCreate(Sender: TObject);
begin
if (not Device.Initialize()) then
  begin
   MessageDlg('Failed to initialize Asphyre device!', mtError, [mbOk], 0);
   Close();
  end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
Device.Finalize();
end;

procedure TForm1.DeviceInitialize(Sender: TObject; var Success: Boolean);
var
  rects : TRect;
begin
  Success := Images.LoadFromASDb(ASDB);
  rects := Rect(0,0,1024,768);
  MyCanvas.Draw(Images[0],rects,0,fxBlend);
  Timer.Enabled := Success;
end;

procedure TForm1.TimerTimer(Sender: TObject);
begin
Device.Render(0, True);
Device.Flip();
end;

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (Key=VK_ESCAPE) then
    Close;
end; [em23]

2

主题

7

帖子

7

积分

新手上路

Rank: 1

积分
7
发表于 2005-12-2 09:04:00 | 显示全部楼层

Re:用Asphyre写显示图片的程序,怎么不能装载预设的图片?

增加一个Device的Render事件 把绘制动作放到里边
procedure TForm1.AsphyreDevice1Render(Sender: TObject);
begin
  MyCanvas.DrawEx(Images[0],Rect(0,0,1024,768),0,fxBlend);
end;
//将ONTIMER中的Device.Render($FF000000, True); 0改为$FF000000,
procedure TForm1.AsphyreTimer1Timer(Sender: TObject);
begin
Device.Render($FF000000, True);
Device.Flip();
end;

3

主题

4

帖子

8

积分

新手上路

Rank: 1

积分
8
 楼主| 发表于 2005-12-3 19:31:00 | 显示全部楼层

Re: 用Asphyre写显示图片的程序,怎么不能装载预设的图片?

老大,我照你说的改了,这下别的图片是不显示了,但屏幕上还是白白的一片,什么都没啊 [em11]。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-22 20:02

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表