Rungineゲームエンジンの使用を開始する

Runner Engine(略してRungine)は、ゲームやマルチメディアアプリケーションを作成するための新しい2D / 3Dエンジンです。 開発者が開発速度を上げるのに役立つ柔軟なツールセットがありますが、まだ開発中です。 エンジンには、コア(独自のユーティリティセットを備えたカーネル)、GUI、Graphic2Dが含まれます。 Runner Engineは現在、DirectX9のみをサポートしています。 OpenGLをサポートするための作業が進行中です。 将来的には、DirectX10およびDirectX11のサポートに関する作業を継続する予定です。



サポートされているプラ​​ットフォーム:Windows



エンジンは現在開発中です。 誰かが仕事でこのエンジンを見ることに非常に興味があるなら、中間デモバージョンを作成することができます。



初期化:



最初のステップは、エンジンdllを接続することです。

#include "..\..\RunnerEngine\Runner.h" #pragma comment(lib, "../../Bin/Runner.lib")
      
      







デバイスを宣言します。

 RDevice rdevice; //     Create: if(!rdevice.Create(800, 600, Mode::Windowed, API::Direct3D9)) { return 0; }
      
      







全体の作業サイクルは次のとおりです。

 //,     while(rdevice.EnterMsgLoop(true)) { rdevice.Clear();//   //   if(rdevice.BeginScene()) { //    rdevice.EndScene();//  rdevice.Present();//   } }
      
      





それだけです 初期化、私たちは考え出した。 これで、画像を表示したり、画像を描画したりできます。





こんにちはランナー

こんにちは、ランナーはRungine SDKの最初の例です。 Rungineを初期化し、簡単な画像を描画する方法を示します。



説明付きのソースコード:

 // : #include "..\..\RunnerEngine\Runner.h" #pragma comment(lib, "../../Bin/Runner.lib") String MediaDir = "../Media/HelloRunner/"; RDevice rdevice;//      Picture im;//  RFont font; int WINAPI WinMain( HINSTANCE hinstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd) { RFile f; // : int width = 800; int height = 600; bool mode = Mode::Windowed; int api = API::Direct3D9; //  : if(!FileUtility::FileExists(MediaDir + "../Samples.dat")) //  ,     Visual Studio: MediaDir = "../" + MediaDir; /*   , ,   (/)   API: */ if(f.OpenRead((MediaDir + "../Samples.dat").ToChar())) { f.Read(&width,sizeof(width)); f.Read(&height,sizeof(height)); f.Read(&mode,sizeof(mode)); f.Read(&api,sizeof(api)); f.Close(); } // Runner Engine   //  WidthHeight : if(!rdevice.Create(width, height, mode, api)) { return 0; } //   Tahoma 10  font.Create(&rdevice, Fonts::Tahoma); // im,   RunnerBackground.tga: im.Create(&rdevice, MediaDir + "RunnerBackground.tga"); //  : Window::SetTitle("Runner Engine. Tutorial: Hellow World"); //,     while(rdevice.EnterMsgLoop(true)) { //true  ,       ,   //  rdevice.Clear();//   //   if(rdevice.BeginScene()) { //    im.Draw(0,0,Window::GetWidth(),Window::GetHeight(), Colors::White); // : font.Begin(); font.Draw2DText(10,10,"Press ESC to exit",Colors::White); font.Draw2DText(10,25,String("FPS: ") + rdevice.GetFPS(), Colors::White); font.End(); rdevice.EndScene();//  rdevice.Present();//   } //    ESC: if(Keyboard::GetKey(KEY_ESCAPE)) { Window::Destroy();//   } } return 0; } //     hWnd : Window::GetHWND();
      
      







起動された例は次のようになります。

画像



歯車:

Gearsは、相互接続された2つのギアを使用した単純なアニメーションの例です。



 #include "..\..\RunnerEngine\Runner.h" #pragma comment(lib, "../../Bin/Runner.lib") String MediaDir = "../Media/Gears/"; RDevice rdevice;//      // : Picture Gear1;//  Picture Gear2;//  Picture Symbol;//  RFont font; //      : int g1_count = 12; int g2_count = 12; float angle = 0.0f;//     bool Create() { RFile f; // : int width = 800; int height = 600; bool mode = Mode::Windowed; int api = API::Direct3D9; //  : if(!FileUtility::FileExists(MediaDir + "../Samples.dat")) //  ,     Visual Studio: MediaDir = "../" + MediaDir; /*  , ,   (/)   API: */ if(f.OpenRead((MediaDir + "../Samples.dat").ToChar())) { f.Read(&width,sizeof(width)); f.Read(&height,sizeof(height)); f.Read(&mode,sizeof(mode)); f.Read(&api,sizeof(api)); f.Close(); } // Runner Engine   //  WidthHeight : if(!rdevice.Create(width, height, mode, api)) { return false; } rdevice.SetTexFilter(TexFilter::ANISOTROPIC,TexFilter::ANISOTROPIC,16); //   Tahoma 10  font.Create(&rdevice, Fonts::Tahoma); // : Gear1.Create(&rdevice, MediaDir + "Gear1.dds"); Gear2.Create(&rdevice, MediaDir + "Gear2.dds"); Symbol.Create(&rdevice, MediaDir + "Symbol.tga"); return true; } void UpdateFPS() { //  fps(   ): static int old_fps = 0; //   fps: int new_fps = rdevice.GetFPS(); if(old_fps != new_fps) { //  : Window::SetTitle(String("Runner Engine. Tutorial 2: Gears ")+ new_fps +" fps"); old_fps = new_fps; } } void Render() { //,    : while(rdevice.EnterMsgLoop()) { UpdateFPS(); /*        ,    :*/ angle += rdevice.GetElapsedTime()/500.0f; /* ..    ,   g1_count ,    g2_count,       , .. ,      g2_count/g1_count       . ..       :*/ float angle2 = -(g2_count/g1_count)*angle; /*       .        .*/ rdevice.Clear(Colors::System::Background);//   rdevice.SetTexWithAlphaChanel(1);//   //   if(rdevice.BeginScene()) { //    800600,   //       //       //800600: float kx = (float)Window::GetWidth()/800; float ky = (float)Window::GetHeight()/600; int x = 170;//*kx; int y = 70;//*ky; //   : int sx = INT(297.0f*kx); int sy = INT(297.0f*ky); // 297        , //   800x600 // : Gear1.Draw(INT((x - 40)*kx), INT((y + 170)*ky),sx,sy, angle); Gear2.Draw(INT((x + 150)*kx), INT((y - 40)*ky),sx,sy, angle2); //     : Point Size = Symbol.GetSize()*Window::GetWidth()/2300; Symbol.Draw(Window::GetWidth() - Size.x, Window::GetHeight() – Size.y, Size.x, Size.y); // : font.Begin(); font.Draw2DText(10,10,"Press ESC to exit",Colors::White); font.Draw2DText(10,25,String("FPS: ") + rdevice.GetFPS(),Colors::White); font.End(); rdevice.EndScene();//  rdevice.Present();//   } //    ESC: if(Keyboard::GetKey(KEY_ESCAPE)) { Window::Destroy();//   } } } int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd) { if(Create()) { Render(); return 0; } }
      
      







起動された例は次のようになります。

画像







All Articles