void Test28() { InitWindow(); static Bitmap bm; bm.w = bm.h = 256; bm.form = BMFORMAT_B8G8R8A8; bm.pal = 0; bm.pix = (uchar*)malloc(bm.w * bm.h * 4); memset(bm.pix, 127, bm.w * bm.h * 4); static int px = 61, py = 89, vx = 2, vy = -3; *(uint*)(bm.pix + (py*bm.w + px) * 4) = -1; static texture t = CreateTexture(&bm, 1); while(!appexit) { px += vx; if(px < 0 || px >= 256) {px -= vx; vx = -vx;} py += vy; if(py < 0 || py >= 256) {py -= vy; vy = -vy;} *(uint*)(bm.pix + (py*bm.w + px) * 4) = -1; renderer->UpdateTexture(t, &bm); BeginDrawing(); InitRectDrawing(); SetTexture(0, t); DrawRect(0, 0, 256, 256, -1); EndDrawing(); HandleWindow(); } }
void Test3() { LoadBCP("data.bcp"); ReadLanguageFile(); InitWindow(); //InitRectDrawing(); //IDirect3DTexture9 *mytex = GetTexture("Interface\\LOADING SCREEN 1.tga"); //IDirect3DPixelShader9 *psh = LoadPixelShader("test.psh"); InitScene(); LoadMap("testmap.bcm"); while(!appexit) { BeginDrawing(); //ddev->SetRenderState(D3DRS_ZENABLE, FALSE); //ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); //ddev->SetPixelShader(psh); //ddev->SetTexture(0, mytex); //DrawRect(0, 0, 640, 480, -1); DrawScene(); EndDrawing(); HandleWindow(); if(keyheld[VK_UP]) camerapos += Vector3(0.0f, 0.0f, walkstep); if(keyheld[VK_DOWN]) camerapos -= Vector3(0.0f, 0.0f, walkstep); if(keyheld[VK_LEFT]) camerapos -= Vector3(walkstep, 0.0f, 0.0f); if(keyheld[VK_RIGHT]) camerapos += Vector3(walkstep, 0.0f, 0.0f); if(keyheld['E']) camerapos += Vector3(0.0f, walkstep, 0.0f); if(keyheld['D']) camerapos -= Vector3(0.0f, walkstep, 0.0f); } }
void Test22() { int curgrp = 0; char tb[512]; printf("Use LTTT? "); int uselt = atoi(fgets(tb, 511, stdin)); LoadBCP("data.bcp"); InitWindow(); InitFont(); if(uselt) LoadLTTT("Maps\\Map_Textures\\128_4Peaks.lttt"); LoadMapTextures(); //MessageBox(hWindow, "Terrain textures loaded.", appName, 64); printf("%u groups:\n", maptexgroup.len); for(int i = 0; i < maptexgroup.len; i++) { MapTextureGroup *g = maptexgroup.getpnt(i); printf(" * %s\n", g->name); printf(" %u textures:\n", g->tex->len); for(int j = 0; j < g->tex->len; j++) printf(" - %u\n", g->tex->getpnt(j)->id); } //texture t = GetTexture("Warrior Kings Game Set\\Textures\\Tavern.pcx"); while(!appexit) { BeginDrawing(); InitRectDrawing(); //SetTexture(0, maptexgroup.getpnt(0)->tex->getpnt(0)->t); //SetTexture(0, t); //DrawRect(0, 0, 256, 256, -1); MapTextureGroup *g = maptexgroup.getpnt(curgrp); sprintf(tb, "%s (%u/%u)", g->name, curgrp, maptexgroup.len); DrawFont(0, 0, tb); for(int i = 0; i < g->tex->len; i++) { MapTexture *t = g->tex->getpnt(i); SetTexture(0, t->t); DrawRect(i * 65, 32, 64, 64, -1, t->x / 256.f, t->y / 256.f, t->w / 256.f, t->h / 256.f); sprintf(tb, "%u", t->id); DrawFont(i * 65, 96, tb); } if(keypressed[VK_LEFT]) { if(curgrp > 0) curgrp--; } if(keypressed[VK_RIGHT]) { if(curgrp < maptexgroup.len-1) curgrp++; } EndDrawing(); HandleWindow(); } }
void Test5() { LoadBCP("data.bcp"); ReadLanguageFile(); InitWindow(); LoadGameSet("Warrior Kings Game Set\\small extensions.cpp"); printf("Game set loaded!\n"); printf("Declared items:\n"); for(int i = 0; i < strItems.len; i++) printf(" - %s\n", strItems[i]); printf("Defined values:\n"); for(int i = 0; i < defvalue.len; i++) printf(" - %s = %f\n", strDefValue[i], defvalue[i]); printf("Appearance tags:\n"); for(int i = 0; i < strAppearTag.len; i++) printf(" - %s\n", strAppearTag[i]); printf("ObjDefs:\n"); for(int i = 0; i < strObjDef.len; i++) printf(" - %s (%s)\n", strObjDef[i], CLASS_str[typeObjDef[i]]); printf("Looking at first object:\n"); printf(" - Tooltip: %s\n", objdef[0].tooltip); printf(" - First start item: %f\n", objdef[0].startItems[0]); printf(" - Shadow: %i\n", objdef[0].shadowtype); printf("2nd's subtypes:\n"); for(int i = 0; i < pstObjDef[1]->len; i++) printf(" - %s\n", (pstObjDef[1])->getdp(i)); printf("1st's subtypes (%i):\n", pstObjDef[0]->len); for(int i = 0; i < pstObjDef[0]->len; i++) printf(" - %s\n", (pstObjDef[0])->getdp(i)); printf("These ObjDefs have \"Default\" subtype and \"Default\" appearance:\n"); for(int i = 0; i < strObjDef.len; i++) printf("- %s: %s\n", strObjDef[i], objdef[i].subtypes[0].appear[0].def?"Yes":"No"); // :S getch(); //InitMeshDrawing(); int a = FindObjDef(CLASS_BUILDING, "Manor"); while(!appexit) { BeginDrawing(); BeginMeshDrawing(); SetModelMatrices(); objdef[a].subtypes[0].appear[0].def->draw(); // :S EndDrawing(); HandleWindow(); } }
void Test21() { InitWindow(); while(!appexit) { BeginDrawing(); EndDrawing(); HandleWindow(); Sleep(1000/30); } }
void Test15() { InitWindow(); LoadBCP("data.bcp"); InitFont(); /* GUIPage gpage; GUISimpleButton gbutton(2, 2, 64, 64, OnTestButtonClick); GUITextButton gtxtbutton(2, 80, 100, 16, OnTestButtonClick, "Hello!"); gpage.add(&gbutton); gpage.add(>xtbutton); //actualpage = &gpage; InitMenuBar(); menubar.parent = &gpage; actualpage = &menubar; */ actualpage = new GEContainer; GEMenuBar *b = new GEMenuBar(mbs, mbe, 2, actualpage); actualpage->add(b); b->setRect(0, 0, 640, 20); GEWindow *win = new GEWindow; actualpage->add(win); win->setCaption("Test15"); win->setRect(32, 32, 150, 150); win->onResize(); win->bgColor = 0x80008000; GETextButton *t = new GETextButton; win->add(t); t->setRect(16, 36, 64, 64); t->setCaption("LOL!"); GEScrollBar *sb = new GEScrollBar; win->add(sb); sb->setRect(90, 36, 16, 80); while(!appexit) { BeginDrawing(); InitRectDrawing(); actualpage->draw(0, 0); EndDrawing(); HandleWindow(); } }
void Test4() { LoadBCP("data.bcp"); InitWindow(); Mesh tm("Warrior Kings Game Set\\Characters\\Abaddon\\ABADDON_MOVE.MESH3"); Mesh tn("Warrior Kings Game Set\\Characters\\Michael\\MICHAEL1.MESH3"); //InitMeshDrawing(); while(!appexit) { BeginDrawing(); BeginMeshDrawing(); SetModelMatrices(); tm.draw(1); tn.draw(2); EndDrawing(); HandleWindow(); } }
void Test14() { InitWindow(); LoadBCP("data.bcp"); InitFont(); ReadLanguageFile(); char *msg = GetLocText("AI_BIOG_PAUL_THE_SIMPLE"); while(!appexit) { BeginDrawing(); InitRectDrawing(); //DrawRect(2, 2, 64, 64, 0xFF); //for(int i = 0; i < 40; i++) // DrawFont(i*12, i*12, "Hello! \x21\x22\x7d\x7e\xa1\xa2\xa3"); //DrawFont(0, 0, msg); deffont->DrawInRect(scrw, 0, 0, msg, 0xFF00FFFF); EndDrawing(); HandleWindow(); } }
void Test27() { scrw = 1024; scrh = 768; LoadBCP("data.bcp"); InitWindow(); ImGuiImpl_Init(); LoadMapTextures(); //mapfogcolor = 0xFF204080; while(!appexit) { ImGuiImpl_NewFrame(); IGAutotileTest(); BeginDrawing(); renderer->InitImGuiDrawing(); ImGui::Render(); EndDrawing(); HandleWindow(); } }
void MIR_HandleEvent(MirWindow* mirwindow, MirEvent const* ev, void* context) { MirEventType event_type = MIR_mir_event_get_type(ev); SDL_Window* window = (SDL_Window*)context; if (window) { switch (event_type) { case (mir_event_type_input): HandleInput(MIR_mir_event_get_input_event(ev), window); break; case (mir_event_type_resize): HandleResize(MIR_mir_event_get_resize_event(ev), window); break; case (mir_event_type_window): HandleWindow(MIR_mir_event_get_window_event(ev), window); break; default: break; } } }
void Test29() { LoadBCP("data.bcp"); InitWindow(); ImGuiImpl_Init(); while(!appexit) { ImGuiImpl_NewFrame(); ImGui::Begin("File explorer"); ImGui::Columns(2, "DirsFilesCols", true); ImGui::Text("Directory"); ImGui::NextColumn(); ImGui::Text(t29curdir); ImGui::Separator(); ImGui::NextColumn(); ImGui::BeginChild("DirCol"); T29_TreeDir("."); ImGui::EndChild(); ImGui::NextColumn(); ImGui::BeginChild("FileCol"); if(t29curfiles) for(int i = 0; i < t29curfiles->len; i++) ImGui::Text(t29curfiles->getdp(i)); ImGui::EndChild(); ImGui::Columns(1); ImGui::End(); BeginDrawing(); renderer->InitImGuiDrawing(); ImGui::Render(); EndDrawing(); HandleWindow(); } }
void Test25() { LoadBCP("data.bcp"); InitWindow(); float x1 = 0, x2 = 0; texture t1, t2, t3; t1 = GetTexture("Interface\\FrontEnd\\Background_Scroll_1.tga"); t2 = GetTexture("Interface\\FrontEnd\\Background_Scroll_2.tga"); t3 = GetTexture("Interface\\FrontEnd\\Background_Static_2.tga"); while(!appexit) { BeginDrawing(); InitRectDrawing(); SetTexture(0, t1); DrawRect(0, 0, scrw, scrh, -1, x1, 0, 1, 1); SetTexture(0, t2); DrawRect(0, 0, scrw, scrh, -1, x2, 0, 1, 1); SetTexture(0, t3); DrawRect(0, 0, scrw, scrh, -1, 0, 0, 1, 1); x1 += 0.0003f; x2 -= 0.0003f; if(x1 >= 1) x1 -= 1; if(x2 < 0) x2 += 1; EndDrawing(); HandleWindow(); } }
void Test26() { LoadBCP("data.bcp"); InitWindow(); ImGuiImpl_Init(); float angle, vec[3]; const char *lbs[] = {"Red", "Green", "Blue"}; int lbc = 0; while(!appexit) { ImGuiImpl_NewFrame(); ImGui::Text("Hello, world!"); ImGui::InputFloat3("Vector3", vec); ImGui::SliderAngle("Angle", &angle); ImGui::ListBox("List box", &lbc, lbs, 3, -1); BeginDrawing(); renderer->InitImGuiDrawing(); ImGui::Render(); EndDrawing(); HandleWindow(); } }
void Test24() { LoadBCP("data.bcp"); InitWindow(); Anim tm("Warrior Kings Game Set\\Characters\\Abaddon\\GRAB1.ANIM3"); //Anim tm("Warrior Kings Game Set\\Characters\\Michael\\SPECIALMOVE.ANIM3"); RBatch *batch = renderer->CreateBatch(16384, 16384); Matrix m1, m2; CreateScaleMatrix(&m1, 1.5, 1.5, 1.5); CreateTranslationMatrix(&m2, 0, -4, 0); mWorld = m1 * m2; while(!appexit) { BeginDrawing(); BeginMeshDrawing(); renderer->BeginBatchDrawing(); batch->begin(); SetModelMatrices(); //CreateIdentityMatrix(&mWorld); //tm.mesh->draw(1); //tn.draw(2); //tm.drawInBatch(batch, 0, 1, -1, 0); //batch->flush(); DrawAnim(&tm, batch, 1, timeGetTime()); batch->end(); EndDrawing(); HandleWindow(); } }
bool pawsControlWindow::HandleWindowName(csString widgetStr) { csString widget; widgetStr.Downcase(); if(widgetStr == "options" ) widget = "ConfigWindow"; else if(widgetStr == "stats" || widgetStr =="skills") widget = "SkillWindow"; else if(widgetStr == "spell book" || widgetStr == "spells") widget = "SpellBookWindow"; else if(widgetStr == "inventory" || widgetStr == "inv") widget = "InventoryWindow"; else if(widgetStr == "help") widget = "HelpWindow"; else if(widgetStr == "buddy") widget = "BuddyWindow"; else if(widgetStr == "info") widget = "InfoWindow"; else if(widgetStr == "petition" || widgetStr == "petitions") widget = "PetitionWindow"; else if(widgetStr == "quest") widget = "QuestNotebook"; else if(widgetStr == "gm") widget = "GmGUI"; else if(widgetStr == "shortcut") widget = "ShortcutWindow"; else if(widgetStr == "group") widget = "GroupWindow"; else if(widgetStr == "guild") widget = "GuildWindow"; else if(widgetStr == "glyph") widget = "GlyphWindow"; else if(widgetStr == "sketch") widget = "SketchWindow"; else if(widgetStr == "merchant") widget = "MerchantWindow"; else if(widgetStr == "loot") widget = "LootWindow"; else if(widgetStr == "detail") widget = "DetailWindow"; else if(widgetStr == "exchange") widget = "ExchangeWindow"; else if(widgetStr == "write") widget = "WritingWindow"; else if(widgetStr == "read") widget = "BookReadingWindow"; else if(widgetStr == "questreward") widget = "QuestRewardWindow"; else if(widgetStr == "craft") widget = "CraftWindow"; else if(widgetStr == "ignore") widget = "IgnoreWindow"; else if(widgetStr == "bag" || widgetStr == "smallinventory") widget = "SmallInventoryWindow"; else if(widgetStr == "talk" || widgetStr == "chat" || widgetStr == "communications") widget = "ChatWindow"; else if(widgetStr == "activemagic") widget = "ActiveMagicWindow"; else if(widgetStr == "managepetitions") widget = "PetitionGMWindow"; else if(widgetStr == "quit") { HandleQuit(); return true; } else if(widgetStr == "buy") { psengine->GetCmdHandler()->Execute("/buy"); return true; } if(widget) HandleWindow(widget); else return false; return true; }
bool pawsControlWindow::OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* reporter ) { if(reporter->GetID() == CONTROL_MINIDOWN || reporter->GetID() == CONTROL_MINIUP) { if (mouseButton == csmbRight) { //If the user clicked on the right mouse button, switch to another style if ( !hidden ) //don't allow to change styles while the toolbar is closed NextStyle(); return true; } else if (mouseButton == csmbMiddle) { printf("Resetting toolbar to orginal size (%d,%d)\n",orgw,orgh); SetRelativeFrameSize(orgw,orgh); return true; } } switch ( reporter->GetID() ) { case CONTROL_MINIUP: { if ( !hidden ) Toggle(); return true; } case CONTROL_MINIDOWN: { if ( hidden ) Toggle(); return true; } case CONTROL_QUIT: { HandleQuit(); return true; } //////////////////////////////////////////////////////////////////// //Special cases that need more than the standard to open correctly //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// // These two are from the confirm window buttons for quiting. //////////////////////////////////////////////////////////////////// case CONFIRM_YES: { psengine->QuitClient(); return true; } case CONFIRM_NO: { PawsManager::GetSingleton().SetModalWidget( 0 ); reporter->GetParent()->Hide(); return true; } //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //Default handle for windows //////////////////////////////////////////////////////////////////// default: { pawsWidget* wdg = FindWidget(reporter->GetID()); if (!wdg) return false; pawsControlledWindow* wnd = FindWindowFromButton(wdg->GetName()); if (!wnd) return false; HandleWindow(wnd->GetName()); return true; } } return false; }
void Test23() { int px = 0, pz = 0, ps = 64; LoadBCP("data.bcp"); ReadLanguageFile(); InitWindow(); InitFont(); //LoadSaveGame("Save_Games\\Advanced Economy.lvl"); //LoadMap("Maps\\oritest.bcm"); char mn[512]; if(!AskMap(mn, "Select a map you want to view.")) return; LoadMap(mn); DynList<MapTile*> *ttlist = new DynList<MapTile*>[maptexfilenames.len]; for(int z = 0; z < mapheight; z++) for(int x = 0; x < mapwidth; x++) { MapTile *t = &maptiles[z*mapwidth+x]; ttlist[t->mt->tfid].add(t); } while(!appexit) { BeginDrawing(); InitRectDrawing(); //RBatch *batch = renderer->CreateBatch(1024, 1536); RBatch *batch = renderer->CreateBatch(2*8192, 3*8192); renderer->BeginBatchDrawing(); batch->begin(); Matrix mx; CreateZeroMatrix(&mx); mx._11 = 2.0f / scrw; mx._22 = -2.0f / scrh; mx._41 = -1 - (0.5f / (scrw)); mx._42 = 1 + (0.5f / (scrh)); //mx._41 = -1; mx._42 = 1; mx._44 = 1; renderer->SetTransformMatrix(&mx); for(int i = 0; i < maptexfilenames.len; i++) { int tns = 1; for(DynListEntry<MapTile*> *e = ttlist[i].first; e; e = e->next) { MapTile *c = e->value; int dx = (c->x - px) * ps, dy = (c->z - pz) * ps; if(((uint)dx >= scrw) || ((uint)dy >= scrh)) continue; MapTexture *t = c->mt; if(tns) {SetTexture(0, t->t); tns = 0;} batchVertex *bv; ushort *bi; uint fi; batch->next(4, 6, &bv, &bi, &fi); int a = c->rot, f = ((c->zflip&1)?1:0) ^ ((c->xflip&1)?3:0); bv[0].x = dx; bv[0].y = dy; bv[1].x = dx + ps; bv[1].y = dy; bv[2].x = dx + ps; bv[2].y = dy + ps; bv[3].x = dx; bv[3].y = dy + ps; bv[((0^f)+a)&3].u = t->x / 256.f; bv[((0^f)+a)&3].v = t->y / 256.f; bv[((1^f)+a)&3].u = (t->x+t->w) / 256.f; bv[((1^f)+a)&3].v = t->y / 256.f; bv[((2^f)+a)&3].u = (t->x+t->w) / 256.f; bv[((2^f)+a)&3].v = (t->y+t->h) / 256.f; bv[((3^f)+a)&3].u = t->x / 256.f; bv[((3^f)+a)&3].v = (t->y+t->h) / 256.f; for(int j = 0; j < 4; j++) {bv[j].z = 0; bv[j].color = -1; }//bv[j].x -= 0.5f; bv[j].y -= 0.5f;} // L-> this will drop FPS because it rereads the locked buffer! bi[0] = fi+0; bi[1] = fi+1; bi[2] = fi+3; bi[3] = fi+1; bi[4] = fi+3; bi[5] = fi+2; } batch->flush(); } batch->end(); delete batch; if(keypressed[VK_LEFT]) px--; if(keypressed[VK_RIGHT]) px++; if(keypressed[VK_UP]) pz--; if(keypressed[VK_DOWN]) pz++; if(keypressed[VK_MULTIPLY]) ps <<= 1; if(keypressed[VK_DIVIDE]) ps >>= 1; if(ps <= 0) ps = 1; EndDrawing(); HandleWindow(); } }