added VGA8.F8

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-09-13 16:11:23 +08:00
parent dc90b536c3
commit d3a3f70be1
7 changed files with 25 additions and 24 deletions

View File

@ -4,31 +4,32 @@ using namespace hgl;
namespace
{
uint8 *bitmap_font_data=nullptr;
uint8 *bitmap_font_8x16_data=nullptr;
uint8 *bitmap_font_8x8_data=nullptr;
}//namespace
void ClearBitmapFont()
{
SAFE_CLEAR_ARRAY(bitmap_font_8x16_data);
SAFE_CLEAR_ARRAY(bitmap_font_8x8_data);
}
bool LoadBitmapFont()
{
if(bitmap_font_data)
return(true);
ClearBitmapFont();
bitmap_font_data=new uint8[256*16];
if(!filesystem::LoadFileToMemory(OS_TEXT("VGA8.F16"), (void **)&bitmap_font_data))
return(false);
filesystem::LoadFileToMemory(OS_TEXT("VGA8.F16"), (void **)&bitmap_font_8x16_data);
filesystem::LoadFileToMemory(OS_TEXT("VGA8.F8"), (void **)&bitmap_font_8x8_data);
return(true);
}
void ClearBitmapFont()
const uint8 *Get8x16Char(const char ch)
{
SAFE_CLEAR_ARRAY(bitmap_font_data);
return bitmap_font_8x16_data+uchar(ch)*16;
}
const uint GetCharWidth(){return bitmap_font_data?8:0;}
const uint GetCharHeight(){return bitmap_font_data?16:0;}
const uint8 *GetBitmapChar(const char ch)
const uint8 *Get8x8Char(const char ch)
{
return bitmap_font_data+uchar(ch)*16;
return bitmap_font_8x8_data+uchar(ch)*8;
}

View File

@ -6,7 +6,4 @@ using namespace hgl;
bool LoadBitmapFont();
void ClearBitmapFont();
const uint GetCharWidth();
const uint GetCharHeight();
const uint8 *GetBitmapChar(const char ch);
const uint8 *Get8x16Char(const char ch);

View File

@ -67,6 +67,9 @@ set_example_project_folder("DataType/DataArray" QueueTest)
add_executable(PoolTest datatype/PoolTest.cpp)
set_example_project_folder("DataType/DataArray" PoolTest)
add_executable(ActiveIDManagerTest datatype/ActiveIDManagerTest.cpp)
set_example_project_folder("DataType/DataArray" ActiveIDManagerTest)
add_executable(MapTest datatype/MapTest.cpp)
set_example_project_folder("DataType/DataArray" MapTest)

View File

@ -149,8 +149,8 @@ bool InitBitmapFont()
if(!LoadBitmapFont())
return(false);
CHAR_BITMAP_WIDTH=GetCharWidth();
CHAR_BITMAP_HEIGHT=GetCharHeight();
CHAR_BITMAP_WIDTH=8;
CHAR_BITMAP_HEIGHT=16;
return(true);
}
@ -385,7 +385,7 @@ private:
void DrawChar(const char ch,const uint x,const uint y)
{
const uint8 *sp=GetBitmapChar(ch);
const uint8 *sp=Get8x16Char(ch);
if(!sp)return;

BIN
VGA8.F8 Normal file

Binary file not shown.

@ -1 +1 @@
Subproject commit 111c0087eda734f86ff556961cd9bbd5f86330ee
Subproject commit 82c41f1287e60a32e004e5cc914e4f9d9595b182

View File

@ -27,7 +27,7 @@ void StructPoolTest()
//添加所有的人物数据到池中
{
for(auto ui:user_info_array)
pool.Append(ui);
pool.AppendToActive(ui);
}
ShowUserInfoArray(pool.GetActiveArray());
@ -83,7 +83,7 @@ void ObjectPoolTest()
uic->Set(ui);
pool.Append(uic);
pool.AppendToActive(uic);
if(rand()%3==1) //有1/3的概率将这个数据放入释放列表
release_list.Add(uic);