Josh Posted September 1, 2010 Share Posted September 1, 2010 LRESULT CALLBACK WndProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam ) { switch( message ) { case WM_DESTROY: PostQuitMessage( 0 ) ; return 0; break; } return DefWindowProc( hwnd, message, wparam, lparam ); } //Create the window WindowsWindow* window=new Window; window->width=width; window->height=height; window->wndclass.cbClsExtra = 0; window->wndclass.cbWndExtra = 0; window->wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); window->wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); window->wndclass.hIcon = LoadIcon( NULL, IDI_APPLICATION ); window->wndclass.lpfnWndProc = WndProc; window->wndclass.lpszClassName = TEXT("le3_window_class"); window->wndclass.lpszMenuName = 0; window->wndclass.style = CS_HREDRAW|CS_VREDRAW; RegisterClass( &window->wndclass ); window->hwnd = CreateWindowA(TEXT("le3_window_class"),TEXT("Leadwerks Engine"),WS_OVERLAPPEDWINDOW,200,200,width,height,NULL,NULL,NULL,NULL); ShowWindow(window->hwnd,SW_SHOW); UpdateWindow(window->hwnd); Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Canardia Posted September 1, 2010 Share Posted September 1, 2010 Yeah well this is kinda shorter, and works on all platforms: SDL_Surface* screen = NULL; //Set up screen screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE ); Or maybe not on all, but on a nice amount of platforms: SDL supports Linux, Windows, Windows CE, BeOS, MacOS, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX. The code contains support for AmigaOS, Dreamcast, Atari, AIX, OSF/Tru64, RISC OS, SymbianOS, and OS/2, but these are not officially supported. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
ESP Posted September 2, 2010 Share Posted September 2, 2010 I was assuming Josh was not being serious Robin Quote Programmer , Intel Quad core, NVIDIA GeForce GT 220, Windows 7 Pro, Galaxy Tab 2 ( 7" and 10"), LE2,LE3,3DWS Link to comment Share on other sites More sharing options...
Rick Posted September 2, 2010 Share Posted September 2, 2010 1) I hope he was trying to funny 2) Win 32 API programming really sucks. 3) Lumooja, you realize with that code you posted there is a ton of code hidden from you that's doing basically what Josh has above. Quote Link to comment Share on other sites More sharing options...
L B Posted September 2, 2010 Share Posted September 2, 2010 I hate the in-parenthesis spaces coding style. Some people find it clean, it just gives me shivers. Besides, wait until you create a GDK window - it's about 3 times that amount of code. Quote Link to comment Share on other sites More sharing options...
Josh Posted September 2, 2010 Author Share Posted September 2, 2010 I mean this is the simplest code possible to create a Windows with the Win32 API. I found another example, and had to strip out tons of unnecessary code to get the result above. I thought it might be useful to anyone trying to create a basic window. I want to minimize the number of external libraries the engine relies on, so SDL is not preferable. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Pixel Perfect Posted September 2, 2010 Share Posted September 2, 2010 I put a wrapper round the Win32 interface and used that to write my editor, I like developing using the win32 API. It's lean and mean and very straight forward once you get used to it. Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Rick Posted September 2, 2010 Share Posted September 2, 2010 You are a warped person Pixel Quote Link to comment Share on other sites More sharing options...
Canardia Posted September 3, 2010 Share Posted September 3, 2010 I want to minimize the number of external libraries the engine relies on, so SDL is not preferable. That's a bad idea, since SDL brings so much good stuff in a small library:- fastest UDP networking library - only library which has forcefeedback for PS3 and XBOX controllers and other joysticks too - window creating function - keyboard reading functions I think SDL is the only cross-platform library which is able to access the hardware on all platforms. If you don't use SDL, you will waste a lot of time trying to implement those essential features yourself so that they work on all platforms, and you should rather focus on the engine itself, and let the peripherial features be handled by SDL. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Josh Posted September 3, 2010 Author Share Posted September 3, 2010 I don't see support for iPhone, Android, XBox, PS3, or Wii: http://www.libsdl.org In fact, 2/3 of the platforms I want to support are unsupported by SDL. Otherwise it would be a great idea. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Canardia Posted September 3, 2010 Share Posted September 3, 2010 SDL works in iPhone (because it's Mac OS X): http://stackoverflow.com/questions/597459/how-mature-is-sdl-for-iphone SDL works on Android (because it's Linux): http://jiggawatt.org/badc0de/android/index.html SDL works on XBOX360 (it's a port): http://code.google.com/p/libsdl360x/ SDL works on PS3 Linux: http://www.ps3news.com/PS3-Linux/ps3-linux-sdl-video-support-patch-now-available/ SDL works on PS3 (it's a port): http://forums.qj.net/ps3-hacks-exploits-homebrew/150471-sdl-1-3-ps3-port.html SDL works in Wii: http://wiibrew.org/wiki/SDL_Wii Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Mumbles Posted September 3, 2010 Share Posted September 3, 2010 "Working" does not mean "supported". Official support is almost always quite helpful. Now, on this site, unofficial support is helpful and friendly too, but on most other sites, people will bite your head off and make you feel like a retard, just because for whatever reason, you don't quite understand something that they think is simple. So I can understand why Josh might want official support for other platforms... Quote LE Version: 2.50 (Eventually) Link to comment Share on other sites More sharing options...
Canardia Posted September 3, 2010 Share Posted September 3, 2010 Maybe LE 3 can have a plugin for whatever library you want to use, which would be useful when the user wants to use his own custom SDL and not rely on any hardcoded library in LE 3. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
kennar Posted September 3, 2010 Share Posted September 3, 2010 For additional information about SDL (though brief): http://www.galaxygameworks.com/ GLFW may also be of some interest (new release today): http://freshmeat.net/projects/glfw Quote Link to comment Share on other sites More sharing options...
Admin Posted September 3, 2010 Share Posted September 3, 2010 Maybe LE 3 can have a plugin for whatever library you want to use, which would be useful when the user wants to use his own custom SDL and not rely on any hardcoded library in LE 3. You are free to implement your own drivers for device input, window creation, etc. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.