void loseRender(Board *b, int step){ glResetMatrixStack(); if ( step > 1000 ) return; glMatrixMode(GL_PROJECTION); gluPerspective(20, 256.0 / 192.0, 0.1, 40); float d = (float)step / 6.0; gluLookAt( 5.0 + d, 5.0 + d, 7.0 + d, //camera possition 1.0, 0.0, 1.5, //look at 0.0, 1.0, 0.0); //up glRotateY(step*3); glLight(0, RGB15(31,31,31), 0, floattov10(1.0)-1, 0); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glMaterialf(GL_AMBIENT, RGB15(8,8,8)); glMaterialf(GL_DIFFUSE, RGB15(31,31,31)); glMaterialf(GL_SPECULAR, RGB15(31,31,31)); glMaterialf(GL_EMISSION, RGB15(8,8,8)); glMaterialShinyness(); glPolyFmt( POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 ); glBindTexture(0, textureID); b->draw(); glFlush(0); swiWaitForVBlank(); }
/* * Initialize our window port. Of course, there are no arguments but we * also initialize the graphics subsystem, here, so we'll be prepared for * later. */ void nds_init_nhwindows(int *argc, char **argv) { int i; system_font = read_bdf("font.bdf"); if (system_font == NULL) { iprintf("Error loading font!\n"); return; } if (nds_init_map()) { iprintf("Error loading tiles!\n"); return; } keysSetRepeat(30, 2); for (i = 0; i < MAX_WINDOWS; i++) { windows[i] = NULL; } /* Set up our palettes. */ BG_PALETTE_SUB[255] = RGB15(31,31,31); nds_load_palette("minimap.pal", BG_PALETTE_SUB + 16); BG_PALETTE_SUB[C_CURSOR] = RGB15(31,0, 0); iflags.window_inited = true; /* Get these set up for our windowing routines */ up_arrow = alloc_ppm(16, 16); down_arrow = alloc_ppm(16, 16); okay_button = alloc_ppm(16, 16); cancel_button = alloc_ppm(16, 16); _nds_copy_header_pixels(up_arrow_data, (unsigned char *)up_arrow->bitmap, MAP_COLOUR(CLR_BLACK), MAP_COLOUR(CLR_WHITE)); _nds_copy_header_pixels(down_arrow_data, (unsigned char *)down_arrow->bitmap, MAP_COLOUR(CLR_BLACK), MAP_COLOUR(CLR_WHITE)); _nds_copy_header_pixels(okay_data, (unsigned char *)okay_button->bitmap, MAP_COLOUR(CLR_BLACK), MAP_COLOUR(CLR_WHITE)); _nds_copy_header_pixels(cancel_data, (unsigned char *)cancel_button->bitmap, MAP_COLOUR(CLR_BLACK), MAP_COLOUR(CLR_WHITE)); if (nds_init_cmd() < 0) { nds_error(); } nds_init_msg(); font_bdf_init(); text_dims(system_font, "*", &tag_width, NULL); tag_width *= 4; }
void ds2_main(void) { int err; ds2_setCPUclocklevel(11); //Initial video and audio and other input and output err = ds2io_init(1024); if(err) goto _failure; ConsoleInit(RGB15(31, 31, 31), RGB15(0, 0, 0), DOWN_SCREEN, 2); unsigned int Time = getSysTime(); //go to user main funtion main (0, 0); Time = getSysTime() - Time; printf("%u units\n\nof 42.667 us", Time); ds2_setCPUclocklevel(0); struct key_buf inputdata; do ds2_getrawInput(&inputdata); while (inputdata.key == 0); ds2_setBacklight(3); ds2_plug_exit(); while (1); _failure: ds2_plug_exit(); }
void App_Test::display_Model() { // gluLookAtf32( this->camera.getPosition()->get_vec_ox(),this->camera.getPosition()->get_vec_oy(),this->camera.getPosition()->get_vec_oz(), // this->camera.getLookAt()->get_vec_ox(),this->camera.getLookAt()->get_vec_oy(),this->camera.getLookAt()->get_vec_oz(), // 0,4096,0 // ); // glLoadIdentity(); glEnable(GL_TEXTURE_2D); glEnable(GL_ANTIALIAS); glEnable(GL_OUTLINE); glLight(0, RGB15(31,31,31) , 0, floattov10(-6.0), floattov10(-1.0)); glSetOutlineColor(0,RGB15(0,0,0)); glPolyFmt(POLY_ID(0) | POLY_ALPHA(31)|POLY_CULL_NONE | POLY_FORMAT_LIGHT0 | POLY_TOON_HIGHLIGHT); // glPolyFmt(POLY_ALPHA(31)|POLY_CULL_NONE | POLY_FORMAT_LIGHT0); glColor3b(31,31,31); glBindTexture(GL_TEXTURE_2D, this->textureID[0]); glTranslatef(0,-6,0); glRotatef(90,-1,0,0); glRotatef(-90,0,0,1); glCallList( (u32 *) this->model_selected); glEnd(); }
void updateCenter(AppState & state) { Point bottomLeft = state.convertBufferToScreen(Point(0,0)); Point topRight = state.convertBufferToScreen(Point(MY_BG_W,MY_BG_H)); Point newCenter = state.convertScreenToImage(Point(SCREEN_WIDTH/2, SCREEN_HEIGHT/2)); // printf("--------------\n"); // printf("%d %d\n", bottomLeft.x, bottomLeft.y); // printf("%d %d\n", topRight.x, topRight.y); // printf("%d %d\n", newCenter.x, newCenter.y); if (bottomLeft.x > 0 || bottomLeft.y > 0 || topRight.x < SCREEN_WIDTH || topRight.y < SCREEN_HEIGHT) { //Point newCenter = state.convertScreenToImage(Point(SCREEN_WIDTH/2, SCREEN_HEIGHT/2)); state.scroll_x = MY_BG_W/2-SCREEN_WIDTH/2; state.scroll_y = MY_BG_H/2-SCREEN_HEIGHT/2; state.center_x = newCenter.x; state.center_y = newCenter.y; // printf("%d %d\n", state.center_x, state.center_y); bgHide(3); fillDisplay(RGB15(0,0,0) | BIT(15), state.lastPage, state); drawPage(state.currentPage, RGB15(31,0,0) | BIT(15), state); } bgSetScroll(3, state.scroll_x, state.scroll_y); bgUpdate(); bgShow(3); }
void __attribute__((noreturn)) __sassert(const char* file, int line, const char* cond, const char* msg) { if (isUserMode()) FeOS_swi_assertfail(file, line, cond, msg); videoReset(); videoSetMode(MODE_0_2D); videoSetModeSub(MODE_0_2D); PrintConsole* conmain = consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 0, 1, true, true); memcpy(&oConSub, consoleGetDefault(), sizeof(PrintConsole)); PrintConsole* consub = consoleInit(&oConSub, 0, BgType_Text4bpp, BgSize_T_256x256, 0, 1, false, true); InstallConThunks(); consoleSelect(conmain); BG_PALETTE[0] = RGB15(31,0,31); BG_PALETTE[255] = RGB15(31,31,31); BG_PALETTE_SUB[0] = RGB15(31,0,31); BG_PALETTE_SUB[255] = RGB15(31,31,31); iprintf("\x1b[5CKernel assertion failure!\n\nCondition: %s\n\n%s:%d\n\nMessage: %s\n", cond, file, line, msg); consoleSelect(consub); iprintf("\x1b[5CStacktrace coming soon\n\nInstead, here's a kitten:\n\n"); const char** i; for (i = meow; *i; i ++) iprintf("%s\n", *i); for (;;) swiWaitForVBlank(); }
void robot_clone_wars(int t) { #define SPACE_FLOOR 1 #define FINAL_WALK_ON 1 #define LINES 6 #define SPACING 16384 int i, j; //rotateX(2560); if ( (t & 1) == 0 ) { // different camera for different screens translate(5120, 44032, 20480); rotateZ(1792); } else { rotateX(2560); } #if SPACE_FLOOR push(); translate(0, -6144, -4096*4); rotateX(-12867/2); scale(4096*16, 4096*10, 4096*10); spot(RGB15(0, 7, 3), RGB15(0, 2, 1), 0, -64); pop(); #endif #if SPACE_FLOOR int z = t*256-16384; #else int z = t*256*8-16384*8; #endif if ( z > 0 ) z = 0; int lines = (t-192+8)/8; if ( lines < 2 ) lines = 2; else if ( lines > LINES ) lines = LINES; for ( i = 1 ; i < lines ; i++ ) { translate(0, 0, -8192); for ( j = 0 ; j < i ; j++ ) { if ( j == 2 && i == 5 ) continue; push(); translate(j * SPACING - ((i-1)*SPACING)/2, jump(t-i*4)+z, 0); #if FINAL_WALK_ON if ( t < 512 ) robot(8, 256); else robot(8+t-512, 256); #else robot(8); #endif pop(); } } }
CglScreenMainOverlay::CglScreenMainOverlay(void) { pCanvas=new CglCanvas(&VRAMBuf[16*256],ScreenWidth,ScreenHeight,pf15bit); pCanvas->SetColor(RGB15(0,0,0)); glMemSet32CPU(RGB15(0,0,0),(u32*)pCanvas->GetScanLine(0),ScreenWidth*ScreenHeight*2); SpriteInit(false,15); }
void fs_beam(int t) { int h = 64+8+384-t*4; if ( h < 0 ) h = 0; GFX_POLY_FORMAT = LIGHT0|POLYFRONT|ALPHA(15); spot(RGB15(0, 31, 4), RGB15(0, 31, 4), -32, h-384); }
void initMenu(void) { lcdMainOnTop(); videoSetMode(MODE_5_3D); videoSetModeSub(MODE_5_2D); vramSetPrimaryBanks(VRAM_A_TEXTURE,VRAM_B_TEXTURE,VRAM_C_SUB_BG,VRAM_D_TEXTURE); initD3D(); glInit(); glEnable(GL_TEXTURE_2D); glEnable(GL_ANTIALIAS); glEnable(GL_BLEND); glEnable(GL_OUTLINE); glClearPolyID(63); glClearDepth(0x7FFF); glViewport(0,0,255,191); initVramBanks(2); initTextures(); initMenuScene(); initMenuButtons(); //TEMP glLight(0, RGB15(31,31,31), cosLerp(4096), 0, sinLerp(4096)); glMaterialf(GL_AMBIENT, RGB15(8,8,8)); glMaterialf(GL_DIFFUSE, RGB15(24,24,24)); glMaterialf(GL_SPECULAR, RGB15(0,0,0)); glMaterialf(GL_EMISSION, RGB15(0,0,0)); glSetToonTableRange(0, 15, RGB15(8,8,8)); //TEMP? glSetToonTableRange(16, 31, RGB15(24,24,24)); //TEMP? applyCameraState(&menuCamera,&cameraStates[4]); tempState=cameraStates[4]; testTransition=startCameraTransition(&cameraStates[1],&cameraStates[4],64); setupMenuPage(startMenuPage, startMenuPageLength); logoMain=createTexture("logo.pcx", "menu"); logoRotate=createTexture("rotate_logo.pcx", "menu"); logoAlpha=31; glSetOutlineColor(0,RGB15(0,0,0)); //TEMP? glSetOutlineColor(1,RGB15(0,0,0)); //TEMP? glSetOutlineColor(7,RGB15(0,0,0)); //TEMP? NOGBA("END mem free : %dko (%do)",getMemFree()/1024,getMemFree()); fadeIn(); }
void ClearScreen(void) { for(int i = 0; i < 256 * 192; i++) { VRAM_A[i] = RGB15(0,0,0); } draw::line(0,0,0,SCREEN_HEIGHT,RGB15(31,31,31)); draw::line(SCREEN_WIDTH,0,SCREEN_WIDTH,SCREEN_HEIGHT,RGB15(31,31,31)); draw::line(0,0,SCREEN_WIDTH,0,RGB15(31,31,31)); draw::line(0,SCREEN_HEIGHT,SCREEN_WIDTH,SCREEN_HEIGHT,RGB15(31,31,31)); }
/* Screen_Init Mode 5 gives us 2 text backgrounds 0-1 (tiled mode) and 2 extended rotation backgrounds 2-3. (linear fb) Also we need to map 2 banks of vram so we have enough space for our 512x512 surface. */ LOCALFUNC blnr Screen_Init(void) { videoSetMode(MODE_5_2D); vramSetBankA(VRAM_A_MAIN_BG_0x06000000); vramSetBankB(VRAM_B_MAIN_BG_0x06020000); Display_bg2_Main = bgInit(2, BgType_Bmp8, BgSize_B8_512x512, 0, 0); BG_PALETTE[0] = RGB15(31, 31, 31); BG_PALETTE[1] = RGB15(0, 0, 0); return trueblnr; }
void background(int t) { #if FADES if ( t == 1536 ) { fade_current = 0; fade_target = 16<<2; } #endif if ( t < 1536 ) spot(RGB15(31, 31, 31), RGB15(12, 12, 31), 0, -64); else spot(RGB15(1, 5, 2), RGB15(0, 0, 0), 0, -64); }
void BeatmapElements::ResetColours(bool fill) { mColours.clear(); mCurrentColour = 0; if (fill) { mColours.push_back(RGB15(31,18,0)); mColours.push_back(RGB15(1,30,1)); mColours.push_back(RGB15(1,1,30)); mColours.push_back(RGB15(30,1,1)); } }
void MapDraw::material(int r, int g, int b) { // This seems to work alright. //glMaterialf(GL_DIFFUSE, RGB15(r, g, b) | BIT(15)); /// Bit 15 enables the diffuse color to act like being set with glColor(), only with lighting support. When not using lighting, this is going to be the default color, just like being set with glColor(). glMaterialf(GL_DIFFUSE, RGB15(r, g, b)); glMaterialf(GL_AMBIENT, RGB15(r, g, b)); glMaterialf(GL_SPECULAR, RGB15(20, 20, 20)| BIT(15)); /// Bit 15 would have to be set here to enable a custom specularity table, instead of the default linear one. glMaterialf(GL_EMISSION, RGB15(0, 0, 0)); //ds uses a table for shinyness..this generates a half-ass one // NOTE: do not use this, at least not here, it slows shit down a lot. // glMaterialShinyness(); }
void init3DSettings() { glInit(); glEnable(GL_TEXTURE_2D | GL_ANTIALIAS | GL_BLEND); glClearColor(31, 31, 31, 0); glClearPolyID(63); glClearDepth(GL_MAX_DEPTH); glViewport(0, 0, 255, 191); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-6.4, 6.4, -4.8, 4.8, 6.4, 25); glMaterialf(GL_AMBIENT, RGB15(8, 8, 8)); glMaterialf(GL_DIFFUSE, RGB15(23, 23, 23)); glMaterialf(GL_SPECULAR, BIT(15) | RGB15(8, 8, 8)); glMaterialf(GL_EMISSION, RGB15(5, 5, 5)); glMaterialShinyness(); glLight(0, RGB15(31, 31, 31), floattov10(4.0), 0, floattov10(-0.8)); glLight(1, RGB15(31, 31, 31), floattov10(-4.0), 0, floattov10(-0.8)); glLight(2, RGB15(31, 31, 31), 0, floattov10(-4.0), floattov10(-0.8)); glLight(3, RGB15(31, 31, 31), 0, floattov10(4.0), floattov10(-0.8)); glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 | POLY_FORMAT_LIGHT1 | POLY_FORMAT_LIGHT2 | POLY_FORMAT_LIGHT3); }
void kbd_init() { u16 palette[4]; nds_load_file("/NetHack/kbd.bin", (void *)BG_TILE_RAM(0)); nds_load_file("/NetHack/kbd.map", (void *)BG_MAP_RAM(4)); nds_load_palette("/NetHack/kbd.pal", palette); BG_PALETTE[0] = RGB15(0, 0, 0); /* Regular background */ BG_PALETTE[16] = RGB15(0, 0, 0); BG_PALETTE[1] = palette[0]; /* Key background, normal */ BG_PALETTE[17] = palette[1]; /* Key background, selected */ BG_PALETTE[2] = palette[2]; /* Key text, normal */ BG_PALETTE[18] = palette[3]; /* Key text, selected */ }
void Menu::Init() { iprintf("Menu.Init\n"); KSIN1 = u8(K1 *(360/57.3f)); KSIN2 = u8(K2 *(360/57.3f)); KSIN3 = u8(K3 *(360/57.3f)); for (int i = 0; i< ((2048) - 1); i++) { lsin1[i] = sin(i/(float)K1) * 32+32; lsin2[i] = sin(i/(float)K2) * 16+16; lsin3[i] = sin(i/(float)K3) * 20+20; } for (int i=0; i<256; i++) { u8 r = (u8)(abs(int(16 - 15 * sin(i * M_PI / 16.0f)))); u8 g = (u8)(abs(int(16 - 15 * sin(i * M_PI / 12.0f)))); u8 b = (u8)(abs(int(16 - 15 * sin(i * M_PI / 18.0f)))); pal[i] = RGB15(r,g,b); } irqInit(); irqEnable(IRQ_VBLANK); videoSetMode(MODE_FB0); vramSetBankA(VRAM_A_LCD); }
/* TODO: * add 8bit support */ void visualizePlayingSMP(void) { int off = getPlayingSample(); short * buffer = &((short*)(getoutBuf()))[off]; if(visualizer == NORMAL) { glBegin( GL_TRIANGLE_STRIP); glBindTexture( 0, 0 ); int i, j = (cur_codec.getSampleRate()/60)/128; static int status = 0; static int clr[3] = { 31, 0, 0 }; glColor(RGB15(clr[0], clr[1], clr[2])); int st_1 = (status + 1) % 3; clr[status] --; clr[st_1] ++; if (clr[status] == 0) status = st_1; for(i = 0; i<128; i++) { int val1 = (buffer[0]>>8); int val2 = (buffer[1]>>8); if(cur_codec.getnChannels()>1) { val1+=(buffer[STREAM_BUF_SIZE]>>8); val1>>=1; val2+=(buffer[STREAM_BUF_SIZE+1]>>8); val2>>=1; } drawLine(i*2, val1+96, i*2+2, val2+96); buffer+=j; if(buffer >= (((short*)getoutBuf()) + STREAM_BUF_SIZE)) buffer -= STREAM_BUF_SIZE; }
UINT16 gdi_get_color_16bpp(HGDI_DC hdc, GDI_COLOR color) { BYTE r, g, b; UINT16 color16; GetRGB32(r, g, b, color); if (hdc->rgb555) { if (hdc->invert) { color16 = BGR15(r, g, b); } else { color16 = RGB15(r, g, b); } } else { if (hdc->invert) { color16 = BGR16(r, g, b); } else { color16 = RGB16(r, g, b); } } return color16; }
void PauseState::Draw(StateManager* game) { //On récupère l'actions sur le menu LowLevel::Input *input = LowLevel::InputManager::getInstance()->GetInput(); if(input->butPressedUp || input->butPressedX) { mCurrentSelected = 0; } if(input->butPressedDown || input->butPressedB) { mCurrentSelected = 1; } if(mCurrentSelected == 0 && (input->butPressedA || input->butPressedLeft) ) game->PopState(); else if(mCurrentSelected == 1 && (input->butPressedA || input->butPressedLeft) ) { game->PopState(); game->ChangeState(MenuState::Instance() ); } LowLevel::drawString(256/2-LowLevel::getStringWidth("Pause")/2, 192/2-8, "Pause", 32767); LowLevel::drawRect(20, mCurrentSelected*15+140-2, 256-20, mCurrentSelected*15+150, RGB15(12, 12, 12) ); LowLevel::drawString(256/2-LowLevel::getStringWidth("Resume")/2, 140, "Resume", 32767); LowLevel::drawString(256/2-LowLevel::getStringWidth("Back to main menu")/2, 155, "Back to main menu", 32767); }
uint16 gdi_get_color_16bpp(HDC hdc, COLORREF color) { uint8 r, g, b; uint16 color16; GetRGB32(r, g, b, color); if(hdc->rgb555) { if (hdc->invert) { color16 = BGR15(r, g, b); } else { color16 = RGB15(r, g, b); } } else { if (hdc->invert) { color16 = BGR16(r, g, b); } else { color16 = RGB16(r, g, b); } } return color16; }
void drawCenteredString(char* str, int32 scale, u16 y) { if(!str)return; int l=strlen(str); drawString(str, RGB15(31,31,31), scale, inttof32(128)-(l*scale)*4, inttof32(y)); }
void GameOver::Render(GameEngine* game) { glBegin2D(); glBoxFilledGradient( 0, 0, 255, 191, RGB15( 31, 0, 0 ), RGB15( 0, 31, 0 ), RGB15( 31, 0, 31 ), RGB15( 0, 31, 31 ) ); glEnd2D(); glFlush(0); swiWaitForVBlank(); }
void displayChannel(u8 chn) { char cstr[3] = {0, 0, 0}; sprintf(cstr, "%u", chn); drawFullBox(206, 155, 14, 9, RGB15(26, 26, 26) | BIT(15)); drawString(cstr, 206, 155); }
void displayOctave(u8 chn) { char cstr[3] = {0, 0, 0}; sprintf(cstr, "%u", chn); drawFullBox(102, 155, 14, 9, RGB15(26, 26, 26) | BIT(15)); drawString(cstr, 102, 155); }
void drawString(const char* str, u8 tx, u8 ty) { // Draw text u8 pos=0, charidx, i, j; u16 drawpos = 0; u8 col; char *charptr; while(pos<strlen(str)) { charptr = strchr(fontchars, str[pos]); if(charptr==0) { charidx = 39; // '_' } else { charidx = charptr - fontchars; } for(j=0;j<11;++j) { for(i=0;i<8;++i) { // Print a character from the bitmap font // each char is 8 pixels wide, and 8 pixels // are in a byte. col = font_8x11[64*j+charidx]; if(col & BIT(i)) { main_vram[SCREEN_WIDTH*(j+ty)+(i+tx+drawpos)] = RGB15(0,0,0) | BIT(15); } } } drawpos += charwidths_8x11[charidx]+1; pos++; } }
void bsp_start (void) { /* initialize irq management */ BSP_rtems_irq_mngt_init (); /* setup console mode for lower screen */ irqEnable (IRQ_VBLANK); videoSetMode (0); videoSetModeSub (MODE_0_2D | DISPLAY_BG0_ACTIVE); vramSetBankC (VRAM_C_SUB_BG); SUB_BG0_CR = BG_MAP_BASE (31); BG_PALETTE_SUB[255] = RGB15 (31, 31, 31); consoleInitDefault ((u16 *) SCREEN_BASE_BLOCK_SUB (31), (u16 *) CHAR_BASE_BLOCK_SUB (0), 16); /* print status message */ printk ("[+] kernel console started\n"); /* set the cpu mode to system user */ arm_cpu_mode = 0x1f; /* configure clock period */ Configuration.microseconds_per_tick = 10000; /* us */ defaultExceptionHandler (); }
Graphics::Graphics(void) { //irqInit(); //irqSet(IRQ_VBLANK, 0); setColor(RGB15(20,31,10) | (1<<15)); videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE); //videoSetModeSub(MODE_2_2D | DISPLAY_BG3_ACTIVE); vramSetBankA(VRAM_A_MAIN_BG); vramSetBankB(VRAM_B_MAIN_BG); //vramSetBankC(VRAM_C_SUB_BG); REG_BG3CNT = BG_BMP16_256x256 | BG_BMP_BASE(0); REG_BG3PA = 1 << 8; REG_BG3PB = 0; REG_BG3PC = 0; REG_BG3PD = 1 << 8; videoRam = BG_BMP_RAM(0); //REG_BG3CNT_SUB = BG_BMP16_256x256 | BG_BMP_BASE(0); //REG_BG3PA_SUB = 1<< 8; //REG_BG3PB_SUB = 0; //REG_BG3PC_SUB = 0; //REG_BG3PD_SUB = 1 << 8; //memClone = BG_BMP_RAM_SUB(2); }
Game::Game() :vramInitializer(*this), bg(BackGround::Instance()), bmp_both(bg.GetBothBitmap()), rgn_both(bg.GetBothRegion()), is_started(false), is_cleared(false) { initVram(); std::srand(std::time(NULL)); bmp_racket.ptr = (u16 *)img_racketBitmap; bmp_racket.width = 60; bmp_racket.height = 15; bmp_racket.tr_col = RGB15(0, 0, 0) | BIT(15); racket.SetImage(&bmp_racket); racket.SetMovableRange(0, 192 * 2 - 30, 256, 192 * 2); racket.MoveTo((256 - racket.GetWidth()) / 2, 0); bmp_ball.ptr = (u16 *)img_ballBitmap; bmp_ball.width = 16; bmp_ball.height = 16; bmp_ball.tr_col = RGB15(0, 0, 0) | BIT(15); ball.SetImage(&bmp_ball); ball.SetMovableRange(0, 0, 256, 192 * 2 + 30); for (int i = 0; i < N_IMG_BLOCKS; ++i) { bmp_blocks[i].ptr = (u16 *)img_blocksBitmap + (40 * 12 * i); bmp_blocks[i].width = 40; bmp_blocks[i].height = 12; //bmp_blocks[i].tr_col = RGB15(0, 0, 0) | BIT(15); } //debug:set blocks for (int i = 0; i < 30; ++i) { BlockDS *temp = new BlockDS(); temp->SetImage(&bmp_blocks[i % 2]); //temp->MoveTo(std::rand() % (256 - 40), std::rand() % (192 - 12)); temp->MoveTo( ((1 + 2 * (i % 5)) * 256 - 6 * 40) / (2 * 5), ((1 + 2 * (i / 5)) * 192 - 6 * 12) / (2 * 5)// + (std::rand() % 3 - 1) ); blocks.push_back(temp); } }