.[ ČeskéHry.cz ].

Laboratoř ČeskýchHer.cz - PasteBin

Vložit nový kód

ČeskéHry.cz - KOMUNITA HERNÍCH VÝVOJÁŘŮ

  1. vdavewf
    17 min
  2. asdgswhwe
    3 hod
  3. bgvfcdx
    4 hod
  4. FullCP
    6 hod
  5. FullCP
    6 hod
  6. t33n young collection Cute teens
    6 hod
  7. t33n young collection Cute teens
    6 hod
  8. Watch for free MOvie full online streaming
    7 hod
  9. https://www.facebook.com/Jelly.Roll.Weight.Loss.Gummies.US.CA.UK.AU.NZ
    7 hod
  10. sdbsdbsdb
    7 hod
Link: http://nopaste.ceske-hry.cz/subdom/nopaste222806
Jazyk: C#
Vloženo: 16.12.2009, 22:36
Stáhnout jako soubor
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6.  
  7. namespace PixelTest
  8. {
  9. class Program
  10. {
  11. unsafe static void Main(string[] args)
  12. {
  13. DateTime start = DateTime.Now;
  14.  
  15. int width = 800;
  16. int height = 600;
  17.  
  18. Col[,] array = new Col[width, height];
  19.  
  20. WriteInfo("malloc(" + width + ", " + height + ")", start);
  21. start = DateTime.Now;
  22.  
  23. for (int i = 0; i != width; i++)
  24. {
  25. for (int j = 0; j != height; j++)
  26. {
  27. array[i,j] = new Col(1, 2, 3);
  28. }
  29. }
  30.  
  31. WriteInfo("init(" + width + ", " + height + ")", start);
  32.  
  33. Random r = new Random();
  34.  
  35. while (true)
  36. {
  37. start = DateTime.Now;
  38.  
  39. Col* arrayPtr = null;
  40.  
  41. for (int i = 0; i != width; i++)
  42. {
  43. fixed (Col* ptr = &array[i, 0])
  44. {
  45. arrayPtr = ptr;
  46. for (int j = 0; j != height; j++)
  47. {
  48. arrayPtr->a = (arrayPtr->b) * (arrayPtr->c);
  49. arrayPtr->b = (arrayPtr->a) * (arrayPtr->c);
  50. arrayPtr->c = (arrayPtr->a) * (arrayPtr->b);
  51. arrayPtr++;
  52. }
  53. }
  54. }
  55.  
  56. Console.SetCursorPosition(0, 2);
  57. WriteInfo("re-set(" + width + ", " + height + ")", start);
  58. }
  59.  
  60. }
  61.  
  62. static void WriteInfo(string prefix, DateTime start)
  63. {
  64. Console.WriteLine(prefix + ": " + Math.Round((DateTime.Now - start).TotalMilliseconds) + " ms -> " + Math.Round(1000 / (DateTime.Now - start).TotalMilliseconds) + " fps ");
  65. }
  66. }
  67. struct Col
  68. {
  69. public float a;
  70. public float b;
  71. public float c;
  72.  
  73. public Col(float a, float b, float c)
  74. {
  75. this.a = a;
  76. this.b = b;
  77. this.c = c;
  78. }
  79. }
  80. }
  81.