From 07dd3de1d21518d6edc8ce417d67b8543c4ed9bc Mon Sep 17 00:00:00 2001 From: groogy Date: Tue, 16 Nov 2010 08:09:41 +0000 Subject: [PATCH] Added dependency check for Window module. git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1649 4e206d99-4929-0410-ac5d-dfc041789085 --- bindings/ruby/sfml-window/window/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bindings/ruby/sfml-window/window/main.cpp b/bindings/ruby/sfml-window/window/main.cpp index 2e2e7cfa..ae7087e0 100644 --- a/bindings/ruby/sfml-window/window/main.cpp +++ b/bindings/ruby/sfml-window/window/main.cpp @@ -125,9 +125,24 @@ void CreateStyleEnum( void ) rb_define_const( globalStyleNamespace, "Default", sf::Style::Default ); } +bool CheckDependencies( void ) +{ + if( rb_cvar_defined( globalSFMLNamespace, rb_intern( "SystemLoaded" ) ) == Qtrue ) + { + return true; + } + + return false; +} + void Init_window( void ) { globalSFMLNamespace = rb_define_module( "SFML" ); + if( CheckDependencies() == false ) + { + rb_raise( rb_eRuntimeError, "This module depends on sfml-system" ); + } + rb_define_const( globalSFMLNamespace, "WindowLoaded", Qtrue ); CreateKeyEnum();