int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow){
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

	hFont = CreateDefaultFont(-14, loadfontname("tech\\font").c_str());
	religion = new std::vector<std::string>(50);
	pattern = new std::vector<std::string>(20);
	weapon = new std::vector<std::string>(20);
	legacy = new std::vector<std::string>(50);
	interfacev = new std::vector<std::string>(10);
	database = new std::vector<hero>();

    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_TESROLEGENERATOR, szWindowClass, MAX_LOADSTRING);
    MyRegisterClass(hInstance);
    if (!InitInstance (hInstance, nCmdShow)) { return FALSE; }
    HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_TESROLEGENERATOR));
    MSG msg;
    while (GetMessage(&msg, nullptr, 0, 0))  { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } }
    return (int) msg.wParam;
}
Ejemplo n.º 2
0
static void
loadfont(int n, int s)
{
    char file[256];
    int i, fd, t, deep;
    static char *try[3] = {"", "times/R.", "pelm/"};
    Subfont *f;
    Font *ff;

    try[0] = fname[n];
    for (t = 0; t < 3; t++) {
        i = s * mag * charmap[fmap[n]].xheight/0.72;	/* a pixel is 0.72 points */
        if (i < MINSIZE)
            i = MINSIZE;
        dprint(2, "size %d, i %d, mag %g\n", s, i, mag);
        for(; i >= MINSIZE; i--) {
            /* if .font file exists, take that */
            snprint(file, sizeof file, "%s/%s%d.font",
                    libfont, try[t], i);
            ff = openfont(display, file);
            if(ff != 0) {
                fonttab[n][s] = ff;
                dprint(2, "using %s for font %d %d\n", file, n, s);
                return;
            }
            /* else look for a subfont file */
            for (deep = log2[screen->depth]; deep >= 0; deep--) {
                snprint(file, sizeof file, "%s/%s%d.%d",
                        libfont, try[t], i, deep);
                dprint(2, "trying %s for %d\n", file, i);
                if ((fd = open(file, 0)) >= 0) {
                    f = readsubfont(display, file, fd, 0);
                    if (f == 0) {
                        fprint(2, "can't rdsubfontfile %s: %r\n", file);
                        exits("rdsubfont");
                    }
                    close(fd);
                    ff = mkfont(f, 0);
                    if(ff == 0) {
                        fprint(2, "can't mkfont %s: %r\n", file);
                        exits("rdsubfont");
                    }
                    fonttab[n][s] = ff;
                    dprint(2, "using %s for font %d %d\n", file, n, s);
                    return;
                }
            }
        }
    }
    fprint(2, "can't find font %s.%d or substitute, quitting\n", fname[n], s);
    exits("no font");
}

void
loadfontname(int n, char *s)
{
    int i;
    Font *f, *g = 0;

    if (strcmp(s, fname[n]) == 0)
        return;
    if(fname[n] && fname[n][0]) {
        if(lastload[n] && strcmp(lastload[n], fname[n]) == 0)
            return;
        strcpy(lastload[n], fname[n]);
    }
    fontlookup(n, s);
    for (i = 0; i < NSIZE; i++)
        if (f = fonttab[n][i]) {
            if (f != g) {
                freefont(f);
                g = f;
            }
            fonttab[n][i] = 0;
        }
}

void
allfree(void)
{
    int i;

    for (i=0; i<NFONT; i++)
        loadfontname(i, "??");
}


void
readmapfile(char *file)
{
    Biobuf *fp;
    char *p, cmd[100];

    if ((fp=Bopen(file, OREAD)) == 0) {
        fprint(2, "proof: can't open map file %s\n", file);
        exits("urk");
    }
    while((p=Brdline(fp, '\n')) != 0) {
        p[Blinelen(fp)-1] = 0;
        scanstr(p, cmd, 0);
        if(p[0]=='\0' || eq(cmd, "#"))	/* skip comments, empty */
            continue;
        else if(eq(cmd, "xheight"))
            buildxheight(fp);
        else if(eq(cmd, "map"))
            buildmap(fp);
        else if(eq(cmd, "special"))
            buildtroff(p);
        else if(eq(cmd, "troff"))
            buildtroff(p);
        else
            fprint(2, "weird map line %s\n", p);
    }
    Bterm(fp);
}