private static void main2(String[] args) { Config.cmdline(args); try { javabughack(); } catch (InterruptedException e) { return; } setupres(); MainFrame f = new MainFrame(null); if (Utils.getprefb("fullscreen", false)) f.setfs(); f.mt.start(); try { f.mt.join(); } catch (InterruptedException e) { f.g.interrupt(); return; } dumplist(Resource.remote().loadwaited(), Config.loadwaited); dumplist(Resource.remote().cached(), Config.allused); if (ResCache.global != null) { try { Writer w = new OutputStreamWriter(ResCache.global.store("tmp/allused"), "UTF-8"); try { Resource.dumplist(Resource.remote().used(), w); } finally { w.close(); } } catch (IOException e) { } } System.exit(0); }
public void draw(GOut g) { if (screenshot && Config.sshot_noui) { visible = false; } super.draw(g); drawcmd(g, new Coord(20, 580)); if (screenshot && (!Config.sshot_nonames || names_ready)) { visible = true; screenshot = false; try { Coord s = MainFrame.getInnerSize(); String stamp = Utils.sessdate(System.currentTimeMillis()); String ext = Config.sshot_compress ? ".jpg" : ".png"; File f = new File("screenshots/SS_" + stamp + ext); f.mkdirs(); Screenshot.writeToFile(f, s.x, s.y); } catch (GLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } // if(!afk && (System.currentTimeMillis() - ui.lastevent > 300000)) { // afk = true; // Widget slen = findchild(SlenHud.class); // if(slen != null) // slen.wdgmsg("afk"); // } else if(afk && (System.currentTimeMillis() - ui.lastevent < 300000)) { // afk = false; // } }
private void update() { if (party.memb != om) { Collection<Member> old = new HashSet<Member>(avs.keySet()); for (final Member m : (om = party.memb).values()) { if (m.gobid == ign) continue; Avaview w = avs.get(m); if (w == null) { w = new Avaview(Coord.z, this, m.gobid, new Coord(27, 27)) { private Tex tooltip = null; public Object tooltip(Coord c, boolean again) { Gob gob = m.getgob(); if (gob == null) return (tooltip); KinInfo ki = gob.getattr(KinInfo.class); if (ki == null) return (null); return (tooltip = ki.rendered()); } }; avs.put(m, w); } else { old.remove(m); } } for (Member m : old) { ui.destroy(avs.get(m)); avs.remove(m); } List<Map.Entry<Member, Avaview>> wl = new ArrayList<Map.Entry<Member, Avaview>>(avs.entrySet()); Collections.sort( wl, new Comparator<Map.Entry<Member, Avaview>>() { public int compare(Entry<Member, Avaview> a, Entry<Member, Avaview> b) { return (a.getKey().gobid - b.getKey().gobid); } }); int i = 0; for (Map.Entry<Member, Avaview> e : wl) { e.getValue().c = new Coord((i % 2) * 43, (i / 2) * 43 + 24); i++; } } for (Map.Entry<Member, Avaview> e : avs.entrySet()) { e.getValue().color = e.getKey().col; } if ((avs.size() > 0) && (leave == null)) { leave = new Button(Coord.z, 84, this, "Leave party"); } if ((avs.size() == 0) && (leave != null)) { ui.destroy(leave); leave = null; } sz.y = MainFrame.getScreenSize().y - c.y; }
public MinimapPanel(Coord c, Coord sz, Widget parent) { super(c, sz, parent, "Minimap"); mrgn = Coord.z; fbtn.visible = true; cbtn.visible = false; { vcl = new IButton( new Coord(0, -2), this, Resource.loadimg("gfx/hud/slen/dispauth"), Resource.loadimg("gfx/hud/slen/dispauthd")) { private boolean v = false; public void click() { MapView mv = ui.mapview; BufferedImage tmp = down; down = up; up = tmp; hover = tmp; if (v) { mv.disol(2, 3); v = false; } else { mv.enol(2, 3); v = true; } } }; vcl.tooltip = "Show village authority"; } { pcl = new IButton( new Coord(0, 4), this, Resource.loadimg("gfx/hud/slen/dispclaim"), Resource.loadimg("gfx/hud/slen/dispclaimd")) { private boolean v = false; public void click() { MapView mv = ui.mapview; BufferedImage tmp = down; down = up; up = tmp; hover = tmp; if (v) { mv.disol(0, 1); v = false; } else { mv.enol(0, 1); v = true; } } }; pcl.tooltip = "Show claims"; } ui.minimappanel = this; mm = new MiniMap(new Coord(0, 32), minsz, this, ui.mapview); /*(new CheckBox(new Coord(110, 15), this, "Use simple map") { public void changed(boolean val) { Config.useSimpleMap = val; this.setfocus(this); Config.saveOptions(); } }).a = Config.useSimpleMap;*/ new IButton( new Coord(45, 8), this, Resource.loadimg("gfx/hud/buttons/gridu"), Resource.loadimg("gfx/hud/buttons/gridd")) { public void click() { BufferedImage tmp = down; down = up; up = tmp; hover = tmp; mm.grid = !mm.grid; } }.tooltip = "Show minimap grid"; new IButton( new Coord(65, 8), this, Resource.loadimg("gfx/hud/buttons/centeru"), Resource.loadimg("gfx/hud/buttons/centerd")) { public void click() { mm.off = new Coord(); UI.instance.mapview.resetcam(); // Kerrigan } }.tooltip = "Focus minimap and character"; new IButton( new Coord(88, 12), this, Resource.loadimg("gfx/hud/charsh/plusup"), Resource.loadimg("gfx/hud/charsh/plusdown")) { public void click() { mm.setScale(mm.scale + 1); } }; new IButton( new Coord(103, 12), this, Resource.loadimg("gfx/hud/charsh/minusup"), Resource.loadimg("gfx/hud/charsh/minusdown")) { public void click() { mm.setScale(mm.scale - 1); } }; btncave = new IButton( new Coord(121, 8), this, Resource.loadimg("gfx/hud/buttons/saveu"), Resource.loadimg("gfx/hud/buttons/saved")) { public void click() { mm.saveCaveMaps(); } }; btncave.tooltip = "Save cave minimaps"; KerriUtils.makeButtonSC(); KerriUtils.makeButtonOP(); KerriUtils.makeButtonVR(); KerriUtils.makeButtonOH(); pack(); this.c = new Coord(MainFrame.getInnerSize().x - this.sz.x, 7); loadpos(); }
void redraw(GL gl) { GOut g = new GOut(gl, getContext(), MainFrame.getInnerSize()); synchronized (ui) { ui.update(); } if (Config.render_enable) { gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(0, getWidth(), 0, getHeight(), -1, 1); TexRT.renderall(g); if (curf != null) curf.tick("texrt"); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(0, getWidth(), getHeight(), 0, -1, 1); gl.glClearColor(0, 0, 0, 1); gl.glClear(GL.GL_COLOR_BUFFER_BIT); if (curf != null) curf.tick("cls"); synchronized (ui) { ui.draw(g); } if (curf != null) curf.tick("draw"); if (Config.dbtext) { g.atext("FPS: " + fps, new Coord(10, 545), 0, 1); g.atext("Texhit: " + dth, new Coord(10, 530), 0, 1); g.atext("Texmiss: " + dtm, new Coord(10, 515), 0, 1); Runtime rt = Runtime.getRuntime(); long free = rt.freeMemory(), total = rt.totalMemory(); g.atext( String.format( "Mem: %,011d/%,011d/%,011d/%,011d", free, total - free, total, rt.maxMemory()), new Coord(10, 500), 0, 1); g.atext( String.format("LCache: %d/%d", Layered.cache.size(), Layered.cache.cached()), new Coord(10, 485), 0, 1); g.atext( String.format("RT-current: %d", TexRT.current.get(gl).size()), new Coord(10, 470), 0, 1); if (Resource.qdepth() > 0) g.atext( String.format("RQ depth: %d (%d)", Resource.qdepth(), Resource.numloaded()), new Coord(10, 455), 0, 1); } Object tooltip = ui.root.tooltip(mousepos, true); Tex tt = null; if (tooltip != null) { if (tooltip instanceof Text) { tt = ((Text) tooltip).tex(); } else if (tooltip instanceof Tex) { tt = (Tex) tooltip; } else if (tooltip instanceof String) { if (((String) tooltip).length() > 0) tt = (Text.render((String) tooltip)).tex(); } } if (tt != null) { Coord sz = tt.sz(); Coord pos = mousepos.add(sz.inv()); if (pos.x < 0) pos.x = 0; if (pos.y < 0) pos.y = 0; g.chcolor(244, 247, 21, 192); g.rect(pos.add(-3, -3), sz.add(6, 6)); g.chcolor(35, 35, 35, 192); g.frect(pos.add(-2, -2), sz.add(4, 4)); g.chcolor(); g.image(tt, pos); } } Resource curs = ui.root.getcurs(mousepos); if (!curs.loading) { if (cursmode == "awt") { if (curs != lastcursor) { try { setCursor(makeawtcurs(curs.layer(Resource.imgc).img, curs.layer(Resource.negc).cc)); ark.bot.cursor_name = curs.name; ark.bot.cursor_name = ark.bot.cursor_name.replace("gfx/hud/curs/", ""); lastcursor = curs; } catch (Exception e) { cursmode = "tex"; } } } else if (cursmode == "tex") { Coord dc = mousepos.add(curs.layer(Resource.negc).cc.inv()); g.image(curs.layer(Resource.imgc), dc); } } }