Advertisement
Ham62

Untitled

Mar 17th, 2017
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. ********* FreeBASIC *********
  2. Sub DrawRect(X as Short, Y as Short, iWid as Short, iHei as Short, ConColor as uByte, ConChar as uByte)
  3. Dim as uShort CharBlock = (ConColor SHL 8) OR ConChar
  4.  
  5. var RectPart = (X + (Y * iWidth))
  6. var RectY = 0
  7. while RectY <> iHei
  8. For RectX as Integer = 0 to iWid-1
  9. pNewScreen[RectPart+RectX] = CharBlock
  10. Next RectX
  11. RectPart += iWidth: RectY += 1
  12. wend
  13. End Sub
  14.  
  15. ********* C# port *********
  16. public static void DrawRect(short X, short Y, short Wid, short Hei, byte ConColor, byte ConChar)
  17. {
  18. ushort CharBlock = (ushort)(ConChar | (ConColor << 8));
  19.  
  20. int RectPart = (X + (Y * Width));
  21. int RectY = 0;
  22. while (RectY != Hei)
  23. {
  24. for (int RectX = 0; RectX < Wid; RectX++)
  25. {
  26. pNewScreen[RectPart + RectX] = CharBlock;
  27. }
  28. RectPart += Width;
  29. RectY += 1;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement