Example #1
0
        private void GenerateJoystickFiles(CodeGeneratorContext context)
        {
            using (TextWriter
                   __H = File.CreateText(context.Settings.OutputPath + "\\Joystick.h"),
                   __CPP = File.CreateText(context.Settings.OutputPath + "\\Joystick.cpp"))
            {
                __H.WriteLine("#ifndef _JOYSTICK_H_");
                __H.WriteLine("#define _JOYSTICK_H_");
                __H.WriteLine();
                __H.WriteLine("#define RPT_JOY_LEN {0}", JoyInfo.Bytes());
                __H.WriteLine();

                __H.WriteLine("#include <inttypes.h>");
                __H.WriteLine("#include \"functions.h\"");
                __H.WriteLine("#include \"Config.h\" ");
                __H.WriteLine("#include \"Def.h\" ");

                __CPP.WriteLine("#include \"Joystick.h\" ");
                __CPP.WriteLine("#include \"Config.h\" ");
                __CPP.WriteLine("#include \"Def.h\" ");
                __CPP.WriteLine();
                __CPP.WriteLine("JoyData JoyInput;");
                __CPP.WriteLine();

                JoyInfo.GenerateJoyFile(__H, __CPP);

                foreach (var panel in Panels)
                {
                    panel.GenerateJoyFile(context, __H, __CPP);
                }

                __H.WriteLine("#endif");
            }
        }