//##ModelId=43B25EC1010A void CStarWarsCtrl::InvalidateCtrl() { // in case we haven't established the memory dc's CClientDC dc(this); // if we don't have one yet, set up a memory dc for the control if (m_MainDC.GetSafeHdc() == NULL) { m_MainDC.CreateCompatibleDC(&dc); m_MainBitmap.CreateCompatibleBitmap(&dc, m_rectClient.Width(), m_rectClient.Height()); m_pOldBitmap = m_MainDC.SelectObject(&m_MainBitmap); } DoStars(&dc); DoScrollText(&dc); // finally, force redraw InvalidateRect(m_rectClient); }
int main (int argc, char *argv[]) { void *mod_data; FILE *mod_fd; size_t mod_size; mod_fd = fopen("GLOS-pope.xm","r"); fseek(mod_fd, 0, SEEK_END); mod_size = ftell(mod_fd); fseek(mod_fd, 0, SEEK_SET); mod_data = malloc(mod_size); fread(mod_data, 1, mod_size, mod_fd); fclose(mod_fd); ModPlug_Settings cfg; ModPlug_GetSettings(&cfg); cfg.mChannels = 2; cfg.mBits = 16; cfg.mFrequency = 48000; cfg.mResamplingMode = MODPLUG_RESAMPLE_SPLINE; cfg.mFlags = MODPLUG_ENABLE_OVERSAMPLING; ModPlug_SetSettings(&cfg); module = ModPlug_Load(mod_data, mod_size); srandom(0); memset(¶ms, 0, sizeof params); params.rate = 48000; params.on_speed = 2.0/100.0; params.off_speed = 2.0/30.0; params.start_wait = 8; params.start_dwell = 2; params.curve_dwell = 0; params.corner_dwell = 2; params.curve_angle = cosf(30.0*(M_PI/180.0)); // 30 deg params.end_dwell = 2; params.end_wait = 1; params.snap = 1/100000.0; params.flatness = 0.000005; params.max_framelen = params.rate / 24; params.render_flags = RENDER_GRAYSCALE; if(olInit(10, 30000) < 0) return 1; olSetRenderParams(¶ms); olSetAudioCallback(gen_audio); float time = 0; float ftime; int i,j; int frames = 0; memset(mbuf, 0, sizeof mbuf); font = olGetDefaultFont(); float xpos = 1.0; DoStars(96); DoTitle(111); DoMetaballs(143); DoFire(174); DoTunnel(175+32); DoCubes(175+32+64); DoEuskal(); #if 0 while(1) { int obj; float w; points_left = cur_draw; olPushColor(); //olMultColor(C_GREY((int)(255.0f * cur_draw / count))); olSetVertexShader(cutoff); olDrawIlda(ild); olSetVertexShader(NULL); olPopColor(); /* olSetVertexShader(sinescroller); w = olDrawString(font, xpos, 0.35, 0.4, C_WHITE, "Hello, World! This is a test message displayed using the OpenLase text functions. Sine scrollers FTW!"); if (xpos < (-w-1.5)) xpos = 1.0; olSetVertexShader(NULL);*/ /* olDrawString(font, -1, 0.35, 0.4, C_WHITE, "Hello, World!"); olDrawString(font, -1, -0, 0.4, C_WHITE, "How are you?"); olDrawString(font, -1, -0.35, 0.4, C_WHITE, " (-; :-)");*/ //render_cubes(time); //render_metaballs(time); //ender_fire(); /* olBegin(OL_BEZIERSTRIP); olVertex(0,1,C_WHITE); olVertex(1,1,C_WHITE); olVertex(1,1,C_WHITE); olVertex(1,0,C_WHITE); olVertex(1,-1,C_WHITE); olVertex(1,-1,C_WHITE); olVertex(0,-1,C_WHITE); olEnd();*/ ftime = olRenderFrame(150); frames++; gbl_time += ftime; xpos -= ftime; cur_draw += ftime * count / 5.0; if (cur_draw > count) cur_draw = count; printf("Frame time: %f, FPS:%f\n", ftime, frames/time); } #endif olShutdown(); exit (0); }