Circular-Studios / Dash

A free and open 3D game engine written in D.
https://circularstudios.com/Dash
MIT License
421 stars 63 forks source link

Feature: SDL Adapter #225

Closed Berulacks closed 10 years ago

Berulacks commented 10 years ago

SDL support should be ready. Needs testing on Windows to see if I broke anything on that platform.

ColdenCullen commented 10 years ago

This appears to work on my Macbook, which is probably the best test I have for these platforms. LGTM.

brooklynlittell commented 10 years ago

I'm crashing not building on Windows 8.1 (Macbook Pro). Here are my errors:

..\Dash\source\dash\utility\input.d(219): Error: undefined identifier Win32, did you mean import win32? ..\Dash\source\dash\utility\input.d(220): Error: cannot implicitly convert expression (Vector(0)) of type Vector!(int, 2) to Vector!(uint, 2)

ColdenCullen commented 10 years ago

@BrandonLittell can you try the fix I just commented to see if that fixes it?

brooklynlittell commented 10 years ago

Yeah, I just ran it. Obviously the vec was fixed, but win32 is still undefined. :cry:

ColdenCullen commented 10 years ago

Did that fix it? You shouldn't need the import, just rename Win32 to Win32GL.

brooklynlittell commented 10 years ago

That fixed it, but we're now running out of page space while linking our .lib.

..\Dash\dash.lib
Warning 178: .LIB pagesize exceeds 512
ColdenCullen commented 10 years ago

That's new. I'm not sure that means we're out of space, it probably just has to start swapping stuff out of RAM to the disk. Which is maaaad slow.

Also, thanks for committing those fixes.

brooklynlittell commented 10 years ago

It starts to copy files for vibe-d (Copying files for vibe-d...), then exits the command and returns to my shell.

ColdenCullen commented 10 years ago

Is that on a dub run or a dub build?

brooklynlittell commented 10 years ago

Damn, it was a dub build. It runs now :wink:

Berulacks commented 10 years ago

:D

ColdenCullen commented 10 years ago

Yeah, the Copying files for xxx... thing doesn't say when it finishes, it just ends.

@BrandonLittell if this works for you now, could you merge it?

brooklynlittell commented 10 years ago

If I press the arrow keys the engine locks up, dies after maybe 30 seconds, and spits out core.exception.OutOfMemoryError@(0). If you're all good with this feature, I'll merge asap.

ColdenCullen commented 10 years ago

@BrandonLittell Womp womp. @Berulacks Maybe fix that?

Berulacks commented 10 years ago

I'm on it.

Berulacks commented 10 years ago

It'll have to be later in the day, when I get out of class and in front of a Windows pc. Does it only happen with the arrow keys?

brooklynlittell commented 10 years ago

Command, alt, and control all seem to kill it, too.

Berulacks commented 10 years ago

Ah, okay. That's what I was worried about. I'll fix it asap.

Berulacks commented 10 years ago

Okay guys, should be working now! I finally got everything set up on my Windows machine, so I tested it as well. Under Windows (running through SDL2) the keys seem to be working fine.

207 = fixed!

ColdenCullen commented 10 years ago

Check your spacing, it looks like you were using hardware tabs set to 8 spaces?

Also, it seems like SDL is locking us in at 60FPS. Can we change this based on config.graphics.vsync?

ColdenCullen commented 10 years ago

Works fine for me on the lab machines. I'll give it a test on my linux box today.

@BrandonLittell Can you test this on your Macbook Pro (OSX)? @PxlBuzzard Can you test this on your Windows 10 box?

Please report back with results.

PxlBuzzard commented 10 years ago

Runs on Windows 10 Preview with no special configuration. One difference I noticed between develop and SDL:

Develop: dash-develop

SDL: dash-sdl

I don't care one way or another about the buttons on the right, but it would be nice to get the icon back in SDL.

Berulacks commented 10 years ago

Ah, I forgot about the icon. Let me get out of lunch and I'll fix that.

ColdenCullen commented 10 years ago

On my Linux laptop (2014 Razer Blade, Ubuntu 14.04), SDL.initialize() is failing on line 58. Here's the stack trace:

derelict.util.exception.DerelictException@../../../../.dub/packages/derelict-util-1.0.3/source/derelict/util/exception.d(35): DerelictGL3.reload failure: An OpenGL context is not currently active.
----------------
./sample-dash-game(void dash.graphics.adapters.sdl.Sdl.initialize()+0x291) [0xa71d35]
./sample-dash-game(void dash.graphics.graphics.Graphics.initialize()+0x47) [0xa476f3]
./sample-dash-game(_D4dash4core5dgame5DGame5startMFZ9__lambda7FZv+0x9) [0xa7dc3d]
./sample-dash-game(core.time.TickDuration[1] std.datetime.benchmark!(_D4dash4core5dgame5DGame5startMFZ9__lambda7FZv).benchmark(uint)+0x6b) [0xa7dc1f]
./sample-dash-game(void dash.utility.output.bench!(_D4dash4core5dgame5DGame5startMFZ9__lambda7FZv).bench(lazy immutable(char)[])+0x1b) [0xa5b987]
./sample-dash-game(void dash.core.dgame.DGame.start()+0xe2) [0xa3fc52]
./sample-dash-game(void dash.core.dgame.DGame.run()+0x60) [0xa3f840]
./sample-dash-game(_Dmain+0x54) [0xa39554]
./sample-dash-game(_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv+0x1f) [0xc541db]
./sample-dash-game(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x2a) [0xc5412e]
./sample-dash-game(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()+0x30) [0xc54194]
./sample-dash-game(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x2a) [0xc5412e]
./sample-dash-game(_d_run_main+0x193) [0xc540af]
./sample-dash-game(main+0x25) [0xa39b3d]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7fa57fef2ec5]
core.exception.InvalidMemoryOperationError@(0)
Berulacks commented 10 years ago

@ColdenCullen What drivers are you using? Perhaps it's a derelictGL3 error? Also, mind if I save the icon as a .bmp as well? I'm assuming "LoadImage" is a win32 specific thing, so we'll have to use something like SDL_Image to load the icon, and SDL_Image doesn't support .icos (last I checked)

ColdenCullen commented 10 years ago

Oh yeah switching to the Nvidia drivers fixed it, whoops. Now I'm just getting a "FBX not supported" error, which sounds like a @tmr9209 problem. LGTM?

brooklynlittell commented 10 years ago

Runs on my MacBook Pro with Windows 8.1. Special key presses don't kill the engine. :+1:

tmr9209 commented 10 years ago

Sorry, have been busy with my Microsoft interview the past two days. Did you solve the issue or just work around it? On a quick glance that error message means that fbx has invalid data from assimp, although would have to be at PC to figure out the specific reason it errors now.

ColdenCullen commented 10 years ago

@tmr9209 It's definitely an issue with Assimp, the assert comes from here.

@BrandonLittell Any luck running on OSX?

@Berulacks Any updates on icon support? We're now 3 weeks behind on the release this was supposed to go out in.

Berulacks commented 10 years ago

@ColdenCullen GFM doesn't appear to implement SDL_SetWindowIcon, and we can't access the member variables _window and _surface in SDL2Window and SDL2Surface which we would need if we just wanted to call SDL_SetWindowIcon ourselves. I'm looking into it, maybe I'll send them a pull request...

[EDIT] Woops, we can get the _surface.

ColdenCullen commented 10 years ago

@Berulacks You have access to all of the C functions. Also: handle

Berulacks commented 10 years ago

Yeah, I didn't notice handle until my second browse through.

Berulacks commented 10 years ago

Done. SDL_GetWindowFromID saved the day! Though, the guys at gfm should probably add a SDL2Window.setIcon function.

ColdenCullen commented 10 years ago

PR it! I'm sure @p0nce will be happy to review it.

@PxlBuzzard Work for you?

PxlBuzzard commented 10 years ago

Yes, the icon shows up now. :+1: