探検
ドラゴンクエストクローンを作ろう
1dq
03/03/01 02:44ID:A/IG49Gl ドラゴンクエストクローンを作ろう
03/03/03 07:04ID:pxhSxl9y
>>15
DirectDrawでのTCanvasの使い方がなっていない。
WindowsAPIを使うなどとは・・・。
以下のようなクラスを作って
interface
uses
Windows, Graphics, DirectX;
type
TDirectDrawCanvas = class(TCanvas)
protected
FSurface: IDirectDrawSurface;
FDeviceContext: HDC;
FEnabled: Boolean;
procedure CreateHandle; override;
public
constructor Create(ASurface: IDirectDrawSurface);
destructor Destroy; override;
procedure Release;
property Enabled: Boolean read FEnabled;
end;
implementation
DirectDrawでのTCanvasの使い方がなっていない。
WindowsAPIを使うなどとは・・・。
以下のようなクラスを作って
interface
uses
Windows, Graphics, DirectX;
type
TDirectDrawCanvas = class(TCanvas)
protected
FSurface: IDirectDrawSurface;
FDeviceContext: HDC;
FEnabled: Boolean;
procedure CreateHandle; override;
public
constructor Create(ASurface: IDirectDrawSurface);
destructor Destroy; override;
procedure Release;
property Enabled: Boolean read FEnabled;
end;
implementation
03/03/03 07:05ID:pxhSxl9y
開業多すぎうざい。連投規制に引っかかるかも知れんので続きは後になるかも
{ TDirectDrawCanvas }
constructor TDirectDrawCanvas.Create(ASurface: IDirectDrawSurface);
begin
inherited Create;
FSurface := ASurface;
FDeviceContext := 0;
FEnabled := ASurface.IsLost = DD_OK;
end;
destructor TDirectDrawCanvas.Destroy;
begin
Release;
inherited;
end;
procedure TDirectDrawCanvas.Release;
begin
if FDeviceContext <> 0 then begin
Handle := 0;
FSurface.ReleaseDC(FDeviceContext);
FDeviceContext := 0;
end;
end;
{ TDirectDrawCanvas }
constructor TDirectDrawCanvas.Create(ASurface: IDirectDrawSurface);
begin
inherited Create;
FSurface := ASurface;
FDeviceContext := 0;
FEnabled := ASurface.IsLost = DD_OK;
end;
destructor TDirectDrawCanvas.Destroy;
begin
Release;
inherited;
end;
procedure TDirectDrawCanvas.Release;
begin
if FDeviceContext <> 0 then begin
Handle := 0;
FSurface.ReleaseDC(FDeviceContext);
FDeviceContext := 0;
end;
end;
03/03/03 07:08ID:pxhSxl9y
procedure TDirectDrawCanvas.CreateHandle;
begin
if FDeviceContext = 0 then begin
FEnabled := FSurface.GetDC(FDeviceContext) = DD_OK;
if FEnabled then
Handle := FDeviceContext
else begin
Handle := 0;
FDeviceContext := 0;
end;
end;
end;
使い方は
Canvas := TCanvas.Create(BackBufferSurface);
しておいて
with Canvas do
if Enabled then try
Pen.Style := psSolid;
:
finally
Release;
end;
begin
if FDeviceContext = 0 then begin
FEnabled := FSurface.GetDC(FDeviceContext) = DD_OK;
if FEnabled then
Handle := FDeviceContext
else begin
Handle := 0;
FDeviceContext := 0;
end;
end;
end;
使い方は
Canvas := TCanvas.Create(BackBufferSurface);
しておいて
with Canvas do
if Enabled then try
Pen.Style := psSolid;
:
finally
Release;
end;
レスを投稿する
ニュース
- 高市首相、トランプ米大統領に「早期に会いたい」 日中関係悪化受け… [BFU★]
- 【コメ】卸売業者「簡単に安売りできない」「大暴落起きれば大赤字に」 JA「新米の販売進度が近年になく遅い。コメの回転が悪い」 ★3 [Hitzeschleier★]
- 【将棋】福間香奈 女流六冠が会見 妊娠・出産でタイトル戦の事実上不戦敗 「妊娠したら、どちらか一方を諦めないといけない状況」★2 [冬月記者★]
- かつや、明日からカツ丼(竹)790円→590円、ロースカツ定食830円→630円、カツカレー(竹)990円→790円 画像あり [お断り★]
- 【配信】TikTokで収益化を剥奪される日本人クリエイターが続出 [muffin★]
- 【コメ】卸売業者「簡単に安売りできない」「大暴落起きれば大赤字に」 JA「新米の販売進度が近年になく遅い。コメの回転が悪い」 ★4 [Hitzeschleier★]
- 高市早苗、トランプおやびんに泣きつくwwwwwwwwwwwwwwwwwwwwwwww [834922174]
- 防衛省「了解は言っていない」 [966095474]
- 企業・団体献金の規制強化をめぐる党首間協議について高市「引き継ぎ受けてないし知らん。約束ではない。野田も誘ってくれないし」 [389326466]
- 【定期】暇空 [455031798]
- ケンモメンってなんでこんなに反日が多いの? [866936191]
- 中国、日本人tiktokの収益剥奪開始wmwmwmwmwmwm [834922174]
