Browse Source

Fixed XInput key mappings

Marko Pintera 11 years ago
parent
commit
7912eda84e
5 changed files with 70 additions and 50 deletions
  1. 28 24
      BansheeCore/Include/BsInputFwd.h
  2. 20 12
      BansheeOISInput/Source/BsInputHandlerOIS.cpp
  3. 6 9
      ExampleProject/Main/Main.cpp
  4. 4 0
      Notes.txt
  5. 12 5
      Polish.txt

+ 28 - 24
BansheeCore/Include/BsInputFwd.h

@@ -201,30 +201,34 @@ namespace BansheeEngine
 		BC_GAMEPAD_RS = 0x40000116,
 		BC_GAMEPAD_BACK = 0x40000117,
 		BC_GAMEPAD_START = 0x40000118,
-		BC_GAMEPAD_BTN1 = 0x40000119,
-		BC_GAMEPAD_BTN2 = 0x4000011A,
-		BC_GAMEPAD_BTN3 = 0x4000011B,
-		BC_GAMEPAD_BTN4 = 0x4000011C,
-		BC_GAMEPAD_BTN5 = 0x4000011D,
-		BC_GAMEPAD_BTN6 = 0x4000011E,
-		BC_GAMEPAD_BTN7 = 0x4000011F,
-		BC_GAMEPAD_BTN8 = 0x40000120,
-		BC_GAMEPAD_BTN9 = 0x40000121,
-		BC_GAMEPAD_BTN10 = 0x40000122,
-		BC_GAMEPAD_BTN11 = 0x40000123,
-		BC_GAMEPAD_BTN12 = 0x40000124,
-		BC_GAMEPAD_BTN13 = 0x40000125,
-		BC_GAMEPAD_BTN14 = 0x40000126,
-		BC_GAMEPAD_BTN15 = 0x40000127,
-		BC_GAMEPAD_BTN16 = 0x40000128,
-		BC_GAMEPAD_BTN17 = 0x40000129,
-		BC_GAMEPAD_BTN18 = 0x4000012A,
-		BC_GAMEPAD_BTN19 = 0x4000012B,
-		BC_GAMEPAD_BTN20 = 0x4000012C,
-		BC_Count = 0x0000012C,
-		BC_NumKeys = 0xEE, // IMPORTANT: Make sure to update these if you modify the values above
-		BC_NumMouse = 0x20,
-		BC_NumGamepad = 0x1E,
+		BC_GAMEPAD_DPAD_LEFT = 0x40000119,
+		BC_GAMEPAD_DPAD_RIGHT = 0x4000011A,
+		BC_GAMEPAD_DPAD_UP = 0x4000011B,
+		BC_GAMEPAD_DPAD_DOWN = 0x4000011C,
+		BC_GAMEPAD_BTN1 = 0x4000011D,
+		BC_GAMEPAD_BTN2 = 0x4000011E,
+		BC_GAMEPAD_BTN3 = 0x4000011F,
+		BC_GAMEPAD_BTN4 = 0x40000120,
+		BC_GAMEPAD_BTN5 = 0x40000121,
+		BC_GAMEPAD_BTN6 = 0x40000122,
+		BC_GAMEPAD_BTN7 = 0x40000123,
+		BC_GAMEPAD_BTN8 = 0x40000124,
+		BC_GAMEPAD_BTN9 = 0x40000125,
+		BC_GAMEPAD_BTN10 = 0x40000126,
+		BC_GAMEPAD_BTN11 = 0x40000127,
+		BC_GAMEPAD_BTN12 = 0x40000128,
+		BC_GAMEPAD_BTN13 = 0x40000129,
+		BC_GAMEPAD_BTN14 = 0x4000012A,
+		BC_GAMEPAD_BTN15 = 0x4000012B,
+		BC_GAMEPAD_BTN16 = 0x4000012C,
+		BC_GAMEPAD_BTN17 = 0x4000012D,
+		BC_GAMEPAD_BTN18 = 0x4000012E,
+		BC_GAMEPAD_BTN19 = 0x4000012F,
+		BC_GAMEPAD_BTN20 = 0x40000130,
+		BC_Count = 304,
+		BC_NumKeys = 238, // IMPORTANT: Make sure to update these if you modify the values above
+		BC_NumMouse = 32,
+		BC_NumGamepad = 34,
 	};
 
 	/**

+ 20 - 12
BansheeOISInput/Source/BsInputHandlerOIS.cpp

@@ -309,31 +309,39 @@ namespace BansheeEngine
 		switch (joystickCode)
 		{
 		case 0:
-			return BC_GAMEPAD_A;
+			return BC_GAMEPAD_DPAD_UP;
 		case 1:
-			return BC_GAMEPAD_B;
+			return BC_GAMEPAD_DPAD_DOWN;
 		case 2:
-			return BC_GAMEPAD_X;
+			return BC_GAMEPAD_DPAD_LEFT;
 		case 3:
-			return BC_GAMEPAD_Y;
+			return BC_GAMEPAD_DPAD_RIGHT;
 		case 4:
-			return BC_GAMEPAD_LB;
+			return BC_GAMEPAD_START;
 		case 5:
-			return BC_GAMEPAD_RB;
-		case 6:
 			return BC_GAMEPAD_BACK;
+		case 6:
+			return BC_GAMEPAD_LS;
 		case 7:
-			return BC_GAMEPAD_START;
+			return BC_GAMEPAD_RS;
 		case 8:
-			return BC_GAMEPAD_BTN1;
+			return BC_GAMEPAD_LB;
 		case 9:
-			return BC_GAMEPAD_RS;
+			return BC_GAMEPAD_RB;
 		case 10:
-			return BC_GAMEPAD_BTN2;
+			return BC_GAMEPAD_BTN1;
 		case 11:
 			return BC_GAMEPAD_LS;
+		case 12:
+			return BC_GAMEPAD_A;
+		case 13:
+			return BC_GAMEPAD_B;
+		case 14:
+			return BC_GAMEPAD_X;
+		case 15:
+			return BC_GAMEPAD_Y;
 		}
 
-		return (ButtonCode)(BC_GAMEPAD_BTN3 + (joystickCode - 11));
+		return (ButtonCode)(BC_GAMEPAD_BTN1 + (joystickCode - 15));
 	}
 }

+ 6 - 9
ExampleProject/Main/Main.cpp

@@ -38,7 +38,7 @@ namespace BansheeEngine
 	UINT32 resolutionHeight = 720;
 
 	/**
-	 * Imports all of ours assets and prepares GameObject that handle the example logic.
+	 * Imports all of our assets and prepares GameObject that handle the example logic.
 	 */
 	void setUpExample();
 
@@ -73,7 +73,7 @@ int CALLBACK WinMain(
 
 	// Initializes the application with primary window defined as above and DirectX 11 render system.
 	// You may use other render systems than DirectX 11, however this example for simplicity only uses DirectX 11.
-	// If you wanted other render systems you would need to create separate shaders for them and import them above
+	// If you wanted other render systems you would need to create separate shaders for them and import them
 	// along with (or replace) the DX11 ones.
 	Application::startUp(renderWindowDesc, RenderSystemPlugin::DX11);
 
@@ -135,9 +135,6 @@ namespace BansheeEngine
 		{
 			TextureImportOptions* importOptions = static_cast<TextureImportOptions*>(textureImportOptions.get());
 
-			// We want the texture to be compressed, just a basic non-alpha format
-			importOptions->setFormat(PF_BC1);
-
 			// We want maximum number of mipmaps to be generated
 			importOptions->setGenerateMipmaps(true);
 		}
@@ -218,7 +215,7 @@ namespace BansheeEngine
 		TechniquePtr technique = exampleShader->addTechnique(RenderSystemDX11, RendererDefault);
 
 		// Add a new pass to the technique. Each technique can have multiple passes that allow you to render the same
-		// object multiple times using different shaders.
+		// object multiple times using different GPU programs.
 		PassPtr pass = technique->addPass();
 		pass->setVertexProgram(exampleVertexGPUProg);
 		pass->setFragmentProgram(exampleFragmentGPUProg);
@@ -351,11 +348,11 @@ namespace BansheeEngine
 		// make the depth mid-range as there are no other widgets.
 		gui->setDepth(128);
 
-		// GUI skin defines how are all child elements of the GUI widget renderer. It contains all their styles
+		// GUI skin defines how are all child elements of the GUI widget renderered. It contains all their styles
 		// and default layout properties. We use the default skin that comes built into Banshee.
 		gui->setSkin(BuiltinResources::instance().getGUISkin());
 
-		// Create a GUI area that is used for displaying messages about buttons for toggling profiler overlays.
+		// Create a GUI area that is used for displaying messages about toggling profiler overlays.
 		// This area will stretch the entire surface of its parent widget, even if the widget is resized.
 		GUIArea* topArea = GUIArea::createStretchedXY(*gui, 0, 0, 0, 0);
 
@@ -367,7 +364,7 @@ namespace BansheeEngine
 		topLayout.addElement(GUILabel::create(HString(L"Press F1 to toggle CPU profiler overlay")));
 		topLayout.addElement(GUILabel::create(HString(L"Press F2 to toggle GPU profiler overlay")));
 
-		// Add a flexible space that fills up any remaining area in the area, making the two labels above be aligned
+		// Add a flexible space that fills up any remaining area in the layout, making the two labels above be aligned
 		// to the top of the GUI widget (and the screen).
 		topLayout.addFlexibleSpace();
 

+ 4 - 0
Notes.txt

@@ -56,6 +56,10 @@ Reminders:
   - Possible improvement: I keep bounds for the entire mesh and not per-submesh
   - Possible improvement: I don't serialize Mesh bounds and they are recalculated whenever a mesh is loaded
   - Add better mip map and compression options to the texture importer. Right now I'm ignoring a lot of the options even though I support them.
+  - Add separable pass sorting to RenderQueue
+  - DDS file import
+  - Make hierarchical documentation. Organize stuff based on type. Once I actually generate the documentation add Doxygen grouping tags (or whatever they're called)
+  - Make a Getting Started guide, along with the example project. Or just finish up the manual.
 
 Potential optimizations:
  - bulkPixelConversion is EXTREMELY poorly unoptimized. Each pixel it calls a separate method that does redudant operations every pixel.

+ 12 - 5
Polish.txt

@@ -1,11 +1,22 @@
 Polish TODO:
  - Finalize example with resolution settings and proper GUI
+  - Ensure that going fullscreen and windowed works fine
  - Add an example model
  - Test release build
  - Test if example shuts down fine
 
  - Add license text to all files
+
  - Make a separate release branch with no editor/script stuff, and without .txt files and other development data
+  - Before I branch make a separate solution with example only projects
+  - Also remove all non-example code (e.g. plugin loading and similar)
+  - This is so I can then merge that code back in that branch when ready
+  - For other stuff I need to delete, use git permanent delete
+
+ - Add a .zip with dependencies
+ - Add a .zip with source and dependencies
+ - Test checking out source and extracting dependencies and see if it compiles
+ - Test compiling on another PC
 
 Re-test gamepad buttons now that XInput is active
 
@@ -22,12 +33,8 @@ Not so critical
        - A lot could be made private
      - Has two methods for retrieveing ElementType
      - getVisibleBounds doesn't make sense
-  - Make hierarchical documentation. Organize stuff based on type. Once I actually generate the documentation add Doxygen grouping tags (or whatever they're called)
   - There's still a crash regarding an uninitialized mCachedPtr on a C# class when shutting down. Attempt to find consistent repro steps.
-  - Make a Getting Started guide, along with the example project. Or just finish up the manual.
-  - Compress and generate mips for texture on input (testing NVTT stuff)
   - Perform optimizations as needed to get reasonable performance
   - Consider removing SceneManager from Core? I have two scene manager base classes.
   - GpuParamBlockBuffer and GpuParams::cloneForCore are very clumsy in how they deal in keeping two separate param blocks. Rethink this a bit.
-  - Add separable pass sorting to RenderQueue
-  - DDS file import
+  - Test texture compression and mip generation with DX9 and OpenGL