Hi everyone,
So far I've been working on my project without any problems everything works great, I can load images from memory using SQLite binaries I can make animations and everything ! It's almost perfect for a beginning !
But one thing is really messed up ; event though everything works fine I get the "Failed to activate window's context" error... not once .. but twice... I've read and tried different things but none of them have solved the problem. So here it goes :
At first I didnt mind because everything worked fine anyway but I noticed that when the windows is initialized in fullscreen, I can see my taskbar over it... and in windowed mod, the windows doesnt go in front, even if I free the console.
As you can see, I use Windows 8 and I'm developing on VS2012 Ultimate. Does it have anything to do with my specs ? I tried compiling the code in the samples that comes with the lib and got the same error... even though it worked perfectly (even the openGL exemple)...
Here is my main
static void Main
(string[] args
) { _settings
= new Settings
(); _game
= new Game
(ref _settings
); _fw
= new Framework
(ref _settings,
true); _game
.state = Game
.State.InGame; // Début du TEST Panorama _pan
= new Panorama
(1); simple_sprite _pan_test
= _pan
.getSimpleSprite(); Character _char
= new Character
(1); simple_sprite _char_test
= _char
.getSimpleSprite(1, Util
.topPourcent(12)); _game
.Animate(new Animation
(_game
.state,
ref _char_test,
new Vector2f
(Program
.settings.resolution.res.X + _char_test
.sprite.GetGlobalBounds().Width, Util
.heightPourcent(12)),
Util
.SpritePositionCentered(_char_test
.sprite.GetGlobalBounds(), Util
.heightPourcent(12)),
2000) ); _game
.Animate(new Animation
(_game
.state,
ref _char_test,
0,
255,
2100)); _game
.Animate(new Animation
(_game
.state,
ref _pan_test,
new Color
(0,
0,
0,
255),
new Color
(255,
255,
255,
255),
1000) ); Text _text
= new Text
("Test de police",
new Font
("DigitalDisorder.ttf"), Util
.heightPourcent(4)); _text
.Color = new Color
(255,
0,
0); _text
.Position = Util
.SpritePositionCentered(_text
.GetGlobalBounds(), Util
.heightPourcent(75)); while (_fw
.opened) { fw
.preRender(); _game
.run(); fw
.window.Draw(_pan_test
.sprite); fw
.window.Draw(_char_test
.sprite); fw
.window.Draw(_text
); fw
.postRender(); }; } And here's how I initialize the window
public Framework
(ref Settings settings, Boolean ShowConsole
= false) { if(!ShowConsole
) FreeConsole
(); _desktopMode
= VideoMode
.DesktopMode; ContextSettings contextSettings
= new ContextSettings
(32,
32,
0,
2,
0); if (settings
.windowed) window
= new RenderWindow
(new VideoMode
(settings
.resolution.res.X, settings
.resolution.res.Y, _desktopMode
.BitsPerPixel), settings
.project, Styles
.Default, contextSettings
); else window
= new RenderWindow
(new VideoMode
(settings
.resolution.res.X, settings
.resolution.res.Y, _desktopMode
.BitsPerPixel), settings
.project, Styles
.Fullscreen, contextSettings
); window
.SetVisible(true); if (settings
.vSync) window
.SetVerticalSyncEnabled(true); if (settings
.joysticks > 0) mKeyHandler
.checkConnectedJoystick(settings
.joysticks - 1); window
.Closed += new EventHandler
(OnClosed
); window
.Resized += new EventHandler
<SizeEventArgs
>(OnResized
); window
.KeyPressed += new EventHandler
<KeyEventArgs
>(mKeyHandler
.OnKeyPressed); window
.KeyReleased += new EventHandler
<KeyEventArgs
>(mKeyHandler
.OnKeyReleased); if (settings
.joysticks > 0) { window
.JoystickConnected += new EventHandler
<JoystickConnectEventArgs
>(mKeyHandler
.OnJoystickConnected); window
.JoystickDisconnected += new EventHandler
<JoystickConnectEventArgs
>(mKeyHandler
.OnJoystickDisconnected); window
.JoystickButtonPressed += new EventHandler
<JoystickButtonEventArgs
>(mKeyHandler
.OnJoystickButtonPressed); window
.JoystickButtonReleased += new EventHandler
<JoystickButtonEventArgs
>(mKeyHandler
.OnJoystickButtonRelease); window
.JoystickMoved += new EventHandler
<JoystickMoveEventArgs
>(mKeyHandler
.OnJoystickMoved); } if (settings
.icon.Length != 0) { try { Stream stream
= new MemoryStream
(settings
.icon); Image icon
= new Image
(stream
); window
.SetIcon(32,
32, icon
.Pixels); } catch (Exception e
) { Console
.WriteLine("Icon loading failed : {0}", e
.ToString()); throw; } } window
.SetActive(true); this.preRender(); window
.PushGLStates(); this.postRender(); } I'm lost... normally it shouldnt work with this error, right ?
So at this point I have two options :
- Make the game borderless (and fullcscreen borderless with 1px larger then screen) which is a bit annoying...
- Try using SFML with C++ and translate all my project from C# to C++... even more anoying...
I'd appreciate some help ! Thank you.