変愚蛮怒のメインリポジトリです
修订版 | b0f9b6abd541c3c535585b9675eb3fb88ce830eb (tree) |
---|---|
时间 | 2016-11-05 01:03:12 |
作者 | Deskull <desull@user...> |
Commiter | Deskull |
GDI+の初期化処理と画像ファイルロード処理を追加 / Add initializing and image file loading of GDI+
@@ -76,10 +76,13 @@ | ||
76 | 76 | |
77 | 77 | #ifdef WINDOWS |
78 | 78 | #include <windows.h> |
79 | +#include <gdiplus.h> | |
79 | 80 | #include <direct.h> |
80 | 81 | #include <locale.h> |
81 | 82 | #include "z-term.h" |
82 | 83 | #include "png-util.h" |
84 | +using namespace Gdiplus; | |
85 | + | |
83 | 86 | |
84 | 87 | /* |
85 | 88 | * Extract the "WIN32" flag from the compiler |
@@ -1050,6 +1053,16 @@ static void validate_dir(cptr s, bool vital) | ||
1050 | 1053 | } |
1051 | 1054 | } |
1052 | 1055 | |
1056 | +bool load_image(HWND hwnd, Image *image, char *filename) | |
1057 | +{ | |
1058 | + size_t r; | |
1059 | + char buf[200]; | |
1060 | + wchar_t wchar[200]; | |
1061 | + path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_GRAF, filename); | |
1062 | + mbstowcs_s(&r, wchar, 200, buf, _TRUNCATE); | |
1063 | + image = new Image(wchar); | |
1064 | + return true; | |
1065 | +} | |
1053 | 1066 | |
1054 | 1067 | /* |
1055 | 1068 | * Get the "size" for a window |
@@ -1692,9 +1705,6 @@ static bool init_graphics(void) | ||
1692 | 1705 | int wid, hgt, twid, thgt, ox, oy; |
1693 | 1706 | cptr name; |
1694 | 1707 | |
1695 | - path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_GRAF, "Ugluk.png"); | |
1696 | - //paint_test(hwndSaver); | |
1697 | - | |
1698 | 1708 | if (arg_graphics == GRAPHICS_ADAM_BOLT) |
1699 | 1709 | { |
1700 | 1710 | wid = 16; |
@@ -5776,6 +5786,11 @@ int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, | ||
5776 | 5786 | angband_color_table[i][0] = win_pal[i]; |
5777 | 5787 | } |
5778 | 5788 | |
5789 | + /* Initialize GDI+ */ | |
5790 | + GdiplusStartupInput gdiplusStartupInput; | |
5791 | + ULONG_PTR gdiplusToken; | |
5792 | + GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); | |
5793 | + | |
5779 | 5794 | /* Prepare the windows */ |
5780 | 5795 | init_windows(); |
5781 | 5796 |