示例#1
0
uchar *LoadFilePlatform(const char *absfilename, size_t *lenret)
{
    #ifdef ANDROID
        DebugLog(-1, absfilename);
        return SDLLoadFile(absfilename, lenret);

        // FIXME: apk loading not working, just stick a temp src in here for now
        auto src = strstr(absfilename, ".lobster") ?
            "print(gl_window(\"hypocycloid\", 1024, 768))\n"
            "while(gl_frame()):\n"
            "    if(gl_wentdown(\"escape\")): return\n"
            "    gl_clear([0, 0, 0, 0])\n"
            "    gl_translate(gl_windowsize() / 2.0)\n"
            "    gl_scale(gl_windowsize()[1] / 4.0)\n"
            "    scalechange := sin(gl_time() * 50) * 0.2\n"
            "    pts := map(360 * 4 + 1) a:\n"
            "        p := [ 0, 0 ]\n"
            "        for(5) i:\n"
            "            p += sincos(a / 4.0 * pow(3, i)) * pow(0.4 + scalechange, i)\n"
            "        p\n"
            "    gl_linemode(1):\n"
            "        gl_polygon(pts)\n"
            :
            "SHADER color\n"
            "    VERTEX\n"
            "        INPUTS apos:4\n"
            "        UNIFORMS mvp\n"
            "        gl_Position = mvp * apos;\n"
            "    PIXEL\n"
            "        UNIFORMS col\n"
            "        gl_FragColor = col;\n";
        if (lenret) *lenret = strlen(src);
        return (uchar *)strdup(src);
    #else
        return loadfile(absfilename, lenret);
    #endif
}
示例#2
0
uchar *LoadFilePlatform(const char *absfilename, size_t *lenret)
{
    return SDLLoadFile(absfilename, lenret);
    //return loadfile(absfilename, lenret);
}