Changeset 102:ba035eba07b4
- Timestamp:
- 11/22/08 15:59:36
(2 months ago)
- Author:
- Cyborg16@cyborg64-win.lan
- branch:
- default
- Message:
Compilation fixes for windows and unittest code.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r85 |
r102 |
|
| 1 | | # Copyright © 2007-2008 Diggory Hardy |
|---|
| | 1 | # Copyright © 2007-2008 Diggory Hardy |
|---|
| 2 | 2 | # License: GNU General Public License version 2 or later (see COPYING) |
|---|
| 3 | 3 | |
|---|
| … | … | |
| 7 | 7 | version (Posix) { |
|---|
| 8 | 8 | buildflags=-L-ldl |
|---|
| 9 | | prebuild = mkdir bin -p |
|---|
| 10 | | } else version (Windows) { |
|---|
| 11 | | prebuild = mkdir bin |
|---|
| 12 | 9 | } |
|---|
| 13 | 10 | |
|---|
| r101 |
r102 |
|
| 252 | 252 | * via hash-maps, which is a little slower than direct access but necessary since the option |
|---|
| 253 | 253 | * must be changed in two separate places. */ |
|---|
| 254 | | void set(T) (char[] symbol, T val) { |
|---|
| | 254 | /+deprecated void set(T) (char[] symbol, T val) { |
|---|
| 255 | 255 | static assert (TIsIn!(T,TYPES) && !TIsIn!(T, CTYPES), "Options.set does not support type "~T.stringof); |
|---|
| 256 | 256 | |
|---|
| … | … | |
| 264 | 264 | logger.error ("Options.set: invalid symbol"); |
|---|
| 265 | 265 | } |
|---|
| 266 | | } |
|---|
| | 266 | }+/ |
|---|
| 267 | 267 | /+ |
|---|
| 268 | 268 | /** Get option symbol of an Options sub-class. |
|---|
| 269 | 269 | * |
|---|
| 270 | 270 | * Using this method to read an option is not necessary, but allows for generic use. */ |
|---|
| 271 | | T get(T) (char[] symbol) { |
|---|
| | 271 | deprecated T get(T) (char[] symbol) { |
|---|
| 272 | 272 | static assert (TIsIn!(T,TYPES), "Options does not support type "~T.stringof); |
|---|
| 273 | 273 | |
|---|
| … | … | |
| 283 | 283 | |
|---|
| 284 | 284 | /** List the names of all options of a specific type. */ |
|---|
| 285 | | char[][] list () { |
|---|
| | 285 | deprecated char[][] list () { |
|---|
| 286 | 286 | char[][] ret; |
|---|
| 287 | 287 | mixin (listMixin!(TYPES)); |
|---|
| r98 |
r102 |
|
| 1 | | /* LICENSE BLOCK |
|---|
| | 1 | /* LICENSE BLOCK |
|---|
| 2 | 2 | Part of mde: a Modular D game-oriented Engine |
|---|
| 3 | | Copyright © 2007-2008 Diggory Hardy |
|---|
| | 3 | Copyright © 2007-2008 Diggory Hardy |
|---|
| 4 | 4 | |
|---|
| 5 | 5 | This program is free software: you can redistribute it and/or modify it under the terms |
|---|
| … | … | |
| 44 | 44 | msg = "Welcome to mde.\nThis executable is only for testing, and\nas such doesn't do anything interesting."; |
|---|
| 45 | 45 | debug msg ~= "\nRunning in debug mode."; |
|---|
| 46 | | font = FontStyle.get("default");// get the default or fallback font |
|---|
| | 46 | font = FontStyle.getDefault; // get the default or fallback font |
|---|
| 47 | 47 | } |
|---|
| 48 | 48 | void sizeEvent (int,int) {}; // Don't care what the size is |
|---|
| … | … | |
| 82 | 82 | //END Main loop setup |
|---|
| 83 | 83 | |
|---|
| | 84 | double pollInterval = miscOpts.pollInterval(); |
|---|
| 84 | 85 | while (run) { |
|---|
| 85 | 86 | mainSchedule.execute (Clock.now()); |
|---|
| 86 | 87 | |
|---|
| 87 | | Thread.sleep (miscOpts.pollInterval); // sleep this many seconds |
|---|
| | 88 | Thread.sleep (pollInterval); // sleep this many seconds |
|---|
| 88 | 89 | } |
|---|
| 89 | 90 | |
|---|
| r101 |
r102 |
|
| 450 | 450 | foreach (name; stage_p.depends) |
|---|
| 451 | 451 | stages[name].rdepends ~= key; |
|---|
| 452 | | auto realMaxThreads = miscOpts.maxThreads; |
|---|
| 453 | | miscOpts.set!(int)("maxThreads", 4); // force up to 4 threads for unittest |
|---|
| | 452 | int realMaxThreads = miscOpts.maxThreads(); |
|---|
| | 453 | miscOpts.maxThreads = 4; // force up to 4 threads for unittest |
|---|
| 454 | 454 | |
|---|
| 455 | 455 | logger.level(Logger.Info); // hide a lot of trace messages |
|---|
| … | … | |
| 491 | 491 | |
|---|
| 492 | 492 | stages = realInit; // restore the real init stages |
|---|
| 493 | | miscOpts.set!(int)("maxThreads", realMaxThreads); |
|---|
| | 493 | miscOpts.maxThreads = realMaxThreads; |
|---|
| 494 | 494 | logger.info ("Unittest complete."); |
|---|
| 495 | 495 | } |
|---|
| r101 |
r102 |
|
| 281 | 281 | FilePath path = new FilePath (fontDir~file); |
|---|
| 282 | 282 | if (path.exists && !path.isFolder) |
|---|
| 283 | | return path.CString; |
|---|
| | 283 | return path.cString; |
|---|
| 284 | 284 | throw new NoFileException ("Unable to find font file: "~file); |
|---|
| 285 | 285 | } |
|---|