探検
ドラゴンクエストクローンを作ろう
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;
レスを投稿する
ニュース
- 高市首相、トランプ米大統領に「早期に会いたい」 日中関係悪化受け… ★4 [BFU★]
- 「もうキモくてキモくて…」29歳女性が語る“おぢアタック”の実態。「俺ならイケるかも」年下女性を狙う勘違い中年男性には共通点が [Hitzeschleier★]
- 【コメ】卸売業者「簡単に安売りできない」「大暴落起きれば大赤字に」 JA「新米の販売進度が近年になく遅い。コメの回転が悪い」 ★5 [Hitzeschleier★]
- テレビ朝日 本社から男性が転落し死亡。関連会社社員か 当たった通行人が左肩軽傷 [阿弥陀ヶ峰★]
- 「これいいじゃん!!!」 セブン-イレブンの1620円で買える“1人用クリスマスケーキ”🎂に注目殺到「天才すぎる」 [パンナ・コッタ★]
- テレビ朝日本社から20~30代の関連会社社員とみられる男性が転落し死亡 六本木けやき坂通りの通行人にはけが人なし [少考さん★]
- 【高市速報】中国、最後通牒 [308389511]
- 【高市速報】中国、世界の敵になり始めるwwwwwwwwwwwwww [308389511]
- しね✋ーーーーー☀
- 【速報】テレビ朝日本社から20代〜30代の男性が飛び降り自殺して死亡 東京・六本木 [597533159]
- このラーメンに1000円出せる?
- 【速報】福島原発でキセノン135が検出されてる模様、再臨界か [668970678]
