Browse Source

remove explicit filesystem dependency

Jeremie Roy 12 years ago
parent
commit
d470ac2567
2 changed files with 31 additions and 31 deletions
  1. 31 0
      examples/10-font/font.cpp
  2. 0 31
      examples/common/font/text_buffer_manager.cpp

+ 31 - 0
examples/10-font/font.cpp

@@ -12,7 +12,38 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
 
 
+
 static const char* s_shaderPath = NULL;
 static const char* s_shaderPath = NULL;
+long int fsize(FILE* _file)
+{
+	long int pos = ftell(_file);
+	fseek(_file, 0L, SEEK_END);
+	long int size = ftell(_file);
+	fseek(_file, pos, SEEK_SET);
+	return size;
+}
+
+static const bgfx::Memory* loadShader(const char* _shaderPath, const char* _shaderName)
+{
+	char out[512];
+	strcpy(out, _shaderPath);
+	strcat(out, _shaderName);
+	strcat(out, ".bin");
+
+	FILE* file = fopen(out, "rb");
+	if (NULL != file)
+	{
+		uint32_t size = (uint32_t)fsize(file);
+		const bgfx::Memory* mem = bgfx::alloc(size+1);
+		/*size_t ignore =*/ fread(mem->data, 1, size, file);
+		/*BX_UNUSED(ignore);*/
+		fclose(file);
+		mem->data[mem->size-1] = '\0';
+		return mem;
+	}
+
+	return NULL;
+}
 
 
 int _main_(int /*_argc*/, char** /*_argv*/)
 int _main_(int /*_argc*/, char** /*_argv*/)
 {
 {

+ 0 - 31
examples/common/font/text_buffer_manager.cpp

@@ -13,37 +13,6 @@
 #define MAX_TEXT_BUFFER_COUNT 64
 #define MAX_TEXT_BUFFER_COUNT 64
 #define MAX_BUFFERED_CHARACTERS 8192
 #define MAX_BUFFERED_CHARACTERS 8192
 
 
-long int fsize(FILE* _file)
-{
-	long int pos = ftell(_file);
-	fseek(_file, 0L, SEEK_END);
-	long int size = ftell(_file);
-	fseek(_file, pos, SEEK_SET);
-	return size;
-}
-
-static const bgfx::Memory* loadShader(const char* _shaderPath, const char* _shaderName)
-{
-	char out[512];
-	strcpy(out, _shaderPath);
-	strcat(out, _shaderName);
-	strcat(out, ".bin");
-
-	FILE* file = fopen(out, "rb");
-	if (NULL != file)
-	{
-		uint32_t size = (uint32_t)fsize(file);
-		const bgfx::Memory* mem = bgfx::alloc(size+1);
-		/*size_t ignore =*/ fread(mem->data, 1, size, file);
-		/*BX_UNUSED(ignore);*/
-		fclose(file);
-		mem->data[mem->size-1] = '\0';
-		return mem;
-	}
-
-	return NULL;
-}
-
 // Table from Flexible and Economical UTF-8 Decoder
 // Table from Flexible and Economical UTF-8 Decoder
 // Copyright (c) 2008-2009 Bjoern Hoehrmann <[email protected]>
 // Copyright (c) 2008-2009 Bjoern Hoehrmann <[email protected]>
 // See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.
 // See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.