Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > b3e39ada975d6747d645d7c2ea00cc64 > files > 3

methane-1.5.0-2.fc13.src.rpm

diff -up methane-1.5.0/sources/methane.cpp.fullscreen methane-1.5.0/sources/methane.cpp
--- methane-1.5.0/sources/methane.cpp.fullscreen	2009-11-12 08:41:46.000000000 +0100
+++ methane-1.5.0/sources/methane.cpp	2009-11-12 08:42:36.000000000 +0100
@@ -36,6 +36,7 @@ FILE *methanescoresfptr = NULL;
 
 RenderTarget GLOBAL_RenderTarget = opengl;
 bool GLOBAL_SoundEnable = true;
+bool GLOBAL_FullScreenEnable = true;
 
 //------------------------------------------------------------------------------
 // Keyboard stuff
@@ -59,6 +60,20 @@ public:
 
 	int main(const std::vector<CL_String> &args)
 	{
+		int i;
+
+		for (i = 1; i < args.size(); i++)
+		{
+			if (args[i].compare("-w") == 0)
+				GLOBAL_FullScreenEnable = false;
+			else
+				fprintf(stderr,
+					"Unknown commandline parameter: '%s', ignoring\n\n"
+					"Valid parameters:\n"
+					"'-w': start in windowed mode\n",
+					args[i].c_str());
+		}
+
 		// Create a console window for text-output if not available
 		CL_ConsoleWindow console("Console");
 		try
@@ -103,8 +118,16 @@ public:
 			CL_DisplayWindowDescription desc;
 			desc.set_title("Super Methane Brothers");
 			desc.set_size(CL_Size(SCR_WIDTH*2,SCR_HEIGHT*2), true);
-			desc.set_allow_resize(true);
+			if (GLOBAL_FullScreenEnable)
+			{
+				desc.set_fullscreen(true);
+				desc.set_decorations(false);
+			}
+			else
+				desc.set_allow_resize(true);
 			CL_DisplayWindow window(desc);
+			if (GLOBAL_FullScreenEnable)
+				window.hide_cursor();
 
 			CMethDoc Game(window);
 
@@ -129,8 +152,6 @@ public:
 			int last_time = CL_System::get_time();
 
 			int quit_flag = 0;
-			int disable_scale_flag = 0;
-			int full_screen_flag = 0;
 			int on_options_screen = 1;
 			int option_page = 0;
 			int game_speed = 60;
@@ -276,7 +297,8 @@ public:
 
 	bool get_options()
 	{
-		CL_DisplayWindow window("Methane Options", 640, 480);
+		CL_DisplayWindow window("Methane Options", 640, 480,
+					GLOBAL_FullScreenEnable);
 
 		// Connect the Window close event
 		CL_Slot slot_quit = window.sig_window_close().connect(this, &SuperMethaneBrothers::on_window_close);
@@ -311,6 +333,12 @@ public:
 				}
 			}
 
+			if ( (LastKey == 'f') || (LastKey == 'F') )
+			{
+				LastKey = 0;
+				GLOBAL_FullScreenEnable = !GLOBAL_FullScreenEnable;
+			}
+
 			gc.clear(CL_Colorf(0.0f,0.0f,0.2f));
 
 			int ypos = 40;
@@ -333,6 +361,15 @@ public:
 			{
 				options_font.draw_text(gc, 10, ypos, "Audio - Disabled. Press 'A' to modify");
 			}
+			ypos += 50;
+			if (GLOBAL_FullScreenEnable)
+			{
+				options_font.draw_text(gc, 10, ypos, "Full screen - Enabled. Press 'F' to modify");
+			}
+			else
+			{
+				options_font.draw_text(gc, 10, ypos, "Full screen - Disabled. Press 'F' to modify");
+			}
 
 			ypos += 100;
 			options_font.draw_text(gc, 10, ypos, "Press the spacebar to start");