Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 13th, 2011  |  syntax: None  |  size: 1.98 KB  |  views: 311  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include "stdafx.h"
  2. #include "D3D9.h"
  3.  
  4. #pragma comment(lib, "GWEN-Renderer-DirectX9.lib");
  5. #pragma comment(lib, "gwen_static.lib");
  6. #pragma comment(lib, "FreeImage.lib");
  7.  
  8. #include "Gwen/Renderers/DirectX9.h"
  9. #include "Gwen/Controls/Canvas.h"
  10. #include "Gwen/Skins/Simple.h"
  11. #include "Gwen/Controls/Button.h"
  12.  
  13. #include <irrlicht.h>
  14. using namespace irr;
  15. using namespace core;
  16. using namespace scene;
  17. using namespace video;
  18. using namespace io;
  19. using namespace gui;
  20.  
  21. #pragma comment(lib, "Irrlicht.lib")
  22. #pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
  23.  
  24. #define WIN32_LEAN_AND_MEAN
  25. #include "windows.h"
  26.  
  27.  
  28. #include "FileSystem.h"
  29. #include "LoadMap.h"
  30.  
  31. #include "Entity.h"
  32.  
  33.  
  34. int main(int argc, char* arg[])
  35. {
  36.         IrrlichtDevice* device = createDevice( video::EDT_DIRECT3D9, dimension2d<u32>(512,512), 24,
  37.                 false, false, true, 0);
  38.         if(!device)
  39.                 return 1;
  40.        
  41.        
  42.         IVideoDriver* driver = device->getVideoDriver();
  43.         ISceneManager* sceneManager = device->getSceneManager();
  44.         //IGUIEnvironment* guiEnv = device->getGUIEnvironment(); // this one sucks
  45.  
  46.         SExposedVideoData sexp = driver->getExposedVideoData();
  47.         IDirect3DDevice9* g_pD3DDevice = sexp.D3D9.D3DDev9;
  48.  
  49.         Gwen::Renderer::DirectX9* GUIRenderer = new Gwen::Renderer::DirectX9(g_pD3DDevice);
  50.         Gwen::Skin::Simple skin;
  51.         skin.SetRender( GUIRenderer );
  52.  
  53.         Gwen::Controls::Canvas* Canvas = new Gwen::Controls::Canvas( &skin );
  54.         Canvas->SetBounds(10,10,100,100);
  55.  
  56.         Gwen::Controls::Button* pButton = new Gwen::Controls::Button( Canvas );
  57.         pButton->SetBounds( 10, 10, 50, 50 );
  58.         pButton->SetText( "My First Button" );
  59.  
  60.  
  61.         SetupFileSystem();
  62.  
  63.         LoadMap( device, "none.irr" );
  64.  
  65.         ICameraSceneNode* cam = sceneManager->addCameraSceneNode(0, vector3df(2,2,1), vector3df(0,0,0));
  66.  
  67.         while(device->run())
  68.         {
  69.                 driver->beginScene(true, true, SColor(255, 100,100,100));
  70.                 sceneManager->drawAll();
  71.                 driver->endScene();
  72.                 Canvas->RenderCanvas();
  73.         }
  74.         free(Canvas);
  75.         //free(skin);
  76.         //free(GUIRenderer);
  77.         return 0;
  78. }
clone this paste RAW Paste Data