浏览代码

added debugPrint

Nicolas Cannasse 8 年之前
父节点
当前提交
ddc1dc4e91
共有 2 个文件被更改,包括 13 次插入0 次删除
  1. 5 0
      libs/directx/directx.cpp
  2. 8 0
      libs/directx/dx/Driver.hx

+ 5 - 0
libs/directx/directx.cpp

@@ -384,6 +384,10 @@ HL_PRIM bool HL_NAME(get_fullscreen_state)() {
 	return ret != 0;
 }
 
+HL_PRIM void HL_NAME(debug_print)( vbyte *b ) {
+	OutputDebugString((LPCWSTR)b);
+}
+
 #define _DRIVER _ABSTRACT(dx_driver)
 #define _POINTER _ABSTRACT(dx_pointer)
 #define _RESOURCE _ABSTRACT(dx_resource)
@@ -438,3 +442,4 @@ DEFINE_PRIM(_VOID, vs_set_shader_resources, _I32 _I32 _REF(_POINTER));
 DEFINE_PRIM(_VOID, generate_mips, _POINTER);
 DEFINE_PRIM(_BOOL, set_fullscreen_state, _BOOL);
 DEFINE_PRIM(_BOOL, get_fullscreen_state, _NO_ARG);
+DEFINE_PRIM(_VOID, debug_print, _BYTES);

+ 8 - 0
libs/directx/dx/Driver.hx

@@ -614,6 +614,10 @@ class Driver {
 	public static function generateMips( res : ShaderResourceView ) {
 	}
 
+	public static function debugPrint( str : String ) {
+		dxDebugPrint(@:privateAccess str.bytes);
+	}
+
 	static function get_fullScreen() return getFullscreenState();
 	static function set_fullScreen(b) {
 		if( !setFullscreenState(b) )
@@ -685,4 +689,8 @@ class Driver {
 		return null;
 	}
 
+	@:hlNative("directx","debug_print")
+	static function dxDebugPrint( str : hl.Bytes ) {
+	}
+
 }