delphix problem - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

delphix problem

hi..
when i try to run my program i just get a black screen
nothing's drawing!!
could you tell me what's wrong with the source code??

-----------------------------------------------------

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DXInput, DXDraws, DXClass;

type
TForm1 = class(TForm)
DXTimer1: TDXTimer;
DXDraw1: TDXDraw;
DXImageList1: TDXImageList;
DXInput1: TDXInput;
procedure DXDraw1Initialize(Sender: TObject);
procedure DXDraw1Finalize(Sender: TObject);
procedure DXTimer1Timer(Sender: TObject; LagCount: Integer);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.DXDraw1Initialize(Sender: TObject);
begin
DXTimer1.Enabled := True;
end;

procedure TForm1.DXDraw1Finalize(Sender: TObject);
begin
DXTimer1.Enabled := False;
end;

procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
begin
if not DXDraw1.CanDraw then Close;
DXDraw1.Surface.Fill(0);
DXImageList1.Items[0].Draw(DXDraw1.Surface,0,0,0);
DXDraw1.Flip;
end;

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

end.

Comments

  • BofjasBofjas Posts: 15Member
    : hi..
    : when i try to run my program i just get a black screen
    : nothing's drawing!!
    : could you tell me what's wrong with the source code??
    :
    : -----------------------------------------------------
    :
    : unit Unit1;
    :
    : interface
    :
    : uses
    : Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DXInput, DXDraws, DXClass;
    :
    : type
    : TForm1 = class(TForm)
    : DXTimer1: TDXTimer;
    : DXDraw1: TDXDraw;
    : DXImageList1: TDXImageList;
    : DXInput1: TDXInput;
    : procedure DXDraw1Initialize(Sender: TObject);
    : procedure DXDraw1Finalize(Sender: TObject);
    : procedure DXTimer1Timer(Sender: TObject; LagCount: Integer);
    : procedure FormKeyDown(Sender: TObject; var Key: Word;
    : Shift: TShiftState);
    : private
    : { Private declarations }
    : public
    : { Public declarations }
    : end;
    :
    : var
    : Form1: TForm1;
    :
    : implementation
    :
    : {$R *.dfm}
    :
    : procedure TForm1.DXDraw1Initialize(Sender: TObject);
    : begin
    : DXTimer1.Enabled := True;
    : end;
    :
    : procedure TForm1.DXDraw1Finalize(Sender: TObject);
    : begin
    : DXTimer1.Enabled := False;
    : end;
    :
    : procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
    : begin
    : if not DXDraw1.CanDraw then Close;
    : DXDraw1.Surface.Fill(0);
    : DXImageList1.Items[0].Draw(DXDraw1.Surface,0,0,0);
    : DXDraw1.Flip;
    : end;
    :
    : procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
    : Shift: TShiftState);
    : begin
    : if (Key = VK_ESCAPE) then Close;
    : end;
    :
    : end.
    :
    :

    Maybe you don't have choosen Double buffering in DXdraw's options?

    [size=1]b[/size][blue][size=5]o[/size][/blue][size=1]fj@as[/size]

  • boddebodde Posts: 8Member
    no,i got it...
    it's because my pic is 24 bit
    and i have 640x480x8 in DXDraw1.Options..

    but i get a message when i try to change resolution in full screen mode
    :-(
Sign In or Register to comment.