comparison mde/input/Config.d @ 74:cee261eba249

Minor tweaks.
author Diggory Hardy <diggory.hardy@gmail.com>
date Mon, 07 Jul 2008 15:54:47 +0100
parents 7fc0a8295c83
children 61ea26abe4dd
comparison
equal deleted inserted replaced
73:08d3b6bcf891 74:cee261eba249
139 file = confDir.makeMTReader (filename, PRIORITY.LOW_HIGH, null, true); 139 file = confDir.makeMTReader (filename, PRIORITY.LOW_HIGH, null, true);
140 140
141 file.dataSecCreator = 141 file.dataSecCreator =
142 delegate MT.IDataSection (MT.ID) { return new Config; }; 142 delegate MT.IDataSection (MT.ID) { return new Config; };
143 143
144 // D2.0: enum MT.ID CONFIGS = "Configs";
145 const MT.ID CONFIGS = cast(MT.ID)"Configs";
146 // Restrict config sections if this tag exists: 144 // Restrict config sections if this tag exists:
147 auto file_configs_p = CONFIGS in file.dataset.header._charAA; 145 auto file_configs_p = cast(MT.ID)"Configs" in file.dataset.header._charAA;
148 MT.ID[] file_configs = null; 146 MT.ID[] file_configs = null;
149 if (file_configs_p) { 147 if (file_configs_p) {
150 file_configs = cast(MT.ID[]) *file_configs_p; 148 file_configs = cast(MT.ID[]) *file_configs_p;
151 } 149 }
152 150
176 "\n\trelMotion:\t" ~ parseFrom!(uint[][][uint])(cfg.relMotion) ); 174 "\n\trelMotion:\t" ~ parseFrom!(uint[][][uint])(cfg.relMotion) );
177 } 175 }
178 } 176 }
179 } 177 }
180 178
181 // D2.0: private enum QUEUE : MT.ID { BUTTON = "B", AXIS = "A", MOUSE = "M" }
182 private struct QUEUE {
183 static const MT.ID BUTTON = cast(MT.ID)"B", AXIS = cast(MT.ID)"A", MOUSE = cast(MT.ID)"M";
184 }
185 private this() {} // Private since this class should only be created from here. 179 private this() {} // Private since this class should only be created from here.
186 180
187 void addTag (char[] tp, MT.ID id, char[] dt) { 181 void addTag (char[] tp, MT.ID id, char[] dt) {
188 if (tp == "uint[][uint]") { 182 if (tp == "uint[][uint]") {
189 if (id == QUEUE.BUTTON) button = cast(outQueue[][uint]) parseTo!(uint[][][uint]) (dt); 183 if (id == "B") button = cast(outQueue[][uint]) parseTo!(uint[][][uint]) (dt);
190 else if (id == QUEUE.AXIS) axis = cast(outQueue[][uint]) parseTo!(uint[][][uint]) (dt); 184 else if (id == "A") axis = cast(outQueue[][uint]) parseTo!(uint[][][uint]) (dt);
191 else if (id == QUEUE.MOUSE) relMotion = cast(outQueue[][uint]) parseTo!(uint[][][uint]) (dt); 185 else if (id == "M") relMotion = cast(outQueue[][uint]) parseTo!(uint[][][uint]) (dt);
192 else logger.warn ("Unexpected tag encountered with ID " ~ cast(char[])id); 186 else logger.warn ("Unexpected tag encountered with ID " ~ cast(char[])id);
193 } // FIXME: add support for name and inheritants. 187 } // FIXME: add support for name and inheritants.
194 } 188 }
195 void writeAll (ItemDelg) { 189 void writeAll (ItemDelg) {
196 // FIXME 190 // FIXME