本文整理汇总了C#中FOS_System.GetCharPointer方法的典型用法代码示例。如果您正苦于以下问题:C# FOS_System.GetCharPointer方法的具体用法?C# FOS_System.GetCharPointer怎么用?C# FOS_System.GetCharPointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FOS_System
的用法示例。
在下文中一共展示了FOS_System.GetCharPointer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
public static unsafe void Write(FOS_System.String str)
{
if (!Initialised) return;
//If string is null, just don't write anything
if (str == null)
{
//Do not make this throw an exception. The BasicConsole
// is largely a debugging tool - it should be reliable,
// robust and not throw exceptions.
return;
}
if (PrimaryOutputEnabled)
{
int strLength = str.length;
int maxOffset = rows * cols;
//This block shifts the video memory up the required number of lines.
if (offset + strLength > maxOffset)
{
int amountToShift = (offset + strLength) - maxOffset;
amountToShift = amountToShift + (80 - (amountToShift % 80));
offset -= amountToShift;
char* vidMemPtr_Old = vidMemBasePtr;
char* vidMemPtr_New = vidMemBasePtr + amountToShift;
char* maxVidMemPtr = vidMemBasePtr + (cols * rows);
while (vidMemPtr_New < maxVidMemPtr)
{
vidMemPtr_Old[0] = vidMemPtr_New[0];
vidMemPtr_Old++;
vidMemPtr_New++;
}
}
//This block outputs the string in the current foreground / background colours.
char* vidMemPtr = vidMemBasePtr + offset;
char* strPtr = str.GetCharPointer();
while (strLength > 0)
{
vidMemPtr[0] = (char)((*strPtr & 0x00FF) | colour);
strLength--;
vidMemPtr++;
strPtr++;
offset++;
}
}
if (SecondaryOutput != null && SecondaryOutputEnabled)
{
SecondaryOutput(str);
}
}