前田稔(Maeda Minoru)の超初心者のプログラム入門
ファイル名 | 説明 |
---|---|
DRForm.cpp | Direct Draw |
DX.BAT | 「Command Line から DirectX を動かす」から取得 |
#using <System.dll> #using <System.Windows.Forms.dll> #using <System.Drawing.dll> #using <Microsoft.DirectX.dll> #using <Microsoft.DirectX.DirectDraw.dll> using namespace System; using namespace System::Windows::Forms; using namespace System::Drawing; using namespace Microsoft::DirectX; using namespace Microsoft::DirectX::DirectDraw; |
ref class DXDraw : public System::Windows::Forms::Form { Microsoft::DirectX::DirectDraw::Device ^draw; public: // Constructor DXDraw() { draw = nullptr; // caption の設定 this->Text = "Dirext Draw"; this->Resize += gcnew System::EventHandler(this, &DXDraw::DXDraw_SizeChanged); this->SizeChanged += gcnew System::EventHandler(this, &DXDraw::DXDraw_SizeChanged); this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &DXDraw::DXDraw_Paint); draw = gcnew Device(); draw->SetCooperativeLevel(this, CooperativeLevelFlags::Normal); } |
void DXDraw_SizeChanged(Object ^sender, EventArgs ^e) { Draw(); } void DXDraw_Paint(Object ^sender, PaintEventArgs ^e) { Draw(); } void Draw() { } |
int main() { DXDraw ^frm; frm = gcnew DXDraw(); if (frm) { Application::Run(frm); } return 0; } |