| [/trunk] | makefile |
| [3rdparty/bgfx] | README.md |
| [3rdparty/bgfx/3rdparty/ocornut-imgui] | imgui.cpp |
| [3rdparty/bgfx/examples/08-update] | fs_update_3d.sc update.cpp |
| [3rdparty/bgfx/examples/25-c99] | helloworld.c |
| [3rdparty/bgfx/examples/common/entry] | entry_osx.mm entry_sdl.cpp |
| [3rdparty/bgfx/examples/common/imgui] | imgui.cpp imgui.h |
| [3rdparty/bgfx/examples/common/nanovg] | nanovg.cpp nanovg.h nanovg_bgfx.cpp |
| [3rdparty/bgfx/examples/runtime/shaders/dx11] | fs_update_3d.bin |
| [3rdparty/bgfx/examples/runtime/shaders/dx9] | fs_update_3d.bin |
| [3rdparty/bgfx/examples/runtime/shaders/gles] | fs_update_3d.bin |
| [3rdparty/bgfx/examples/runtime/shaders/glsl] | fs_update_3d.bin |
| [3rdparty/bgfx/scripts] | bgfx.lua genie.lua |
| [3rdparty/bgfx/src] | bgfx_shader.sh renderer_d3d11.cpp renderer_d3d9.h renderer_gl.cpp renderer_gl.h vertexdecl.cpp |
| [3rdparty/bgfx/tools/shaderc] | shaderc.cpp |
| [3rdparty/bx/include/bx] | platform.h |
| [3rdparty/bx/scripts] | toolchain.lua |
| [3rdparty/bx/tools/bin/darwin] | genie |
| [3rdparty/bx/tools/bin/linux] | genie |
| [3rdparty/bx/tools/bin/windows] | genie.exe |
| [3rdparty/genie] | .editorconfig README.md makefile |
| [3rdparty/genie/build/gmake.darwin] | genie.make |
| [3rdparty/genie/build/gmake.linux] | genie.make |
| [3rdparty/genie/build/gmake.windows] | genie.make |
| [3rdparty/genie/scripts] | genie.lua |
| [3rdparty/genie/src/actions/make] | make_cpp.lua |
| [3rdparty/genie/src/actions/vstudio] | _vstudio.lua vs2010_vcxproj.lua |
| [3rdparty/genie/src/base] | api.lua bake.lua |
| [3rdparty/genie/src/host] | scripts.c |
| [3rdparty/lua/src] | luaconf.h |
| [3rdparty/mongoose] | mongoose.c |
| [3rdparty/mongoose/docs] | ReleaseNotes.md |
| [3rdparty/mongoose/examples] | .gitignore Makefile |
| [3rdparty/mongoose/examples/web_server] | web_server.c |
| [3rdparty/mongoose/test] | unit_test.c |
| [hash] | gamegear.xml gameking.xml gbcolor.xml megadriv.xml nes.xml pc8801_flop.xml pc98.xml pet_rom.xml pico.xml sms.xml snes.xml snes_strom.xml |
| [src/build] | makedep.c makemak.c |
| [src/emu] | emucore.h emuopts.c emuopts.h luaengine.c mame.c render.c render.h schedule.c video.c video.h |
| [src/emu/bus/nes] | nes_pcb.inc |
| [src/emu/cpu/h8] | h8.c |
| [src/emu/cpu/hmcs40] | hmcs40.c hmcs40d.c hmcs40op.inc |
| [src/emu/cpu/i386] | i386.h i386ops.h pentops.inc |
| [src/emu/cpu/i960] | i960.c |
| [src/emu/cpu/sharc] | sharc.c |
| [src/emu/machine] | machine.mak mcf5206e.c mcf5206e.h tmp68301.c tms6100.c vrc4373.c vrc4373.h |
| [src/emu/netlist] | plists.h |
| [src/emu/sound] | es1373.c es1373.h okim9810.c okim9810.h sound.mak wavwrite.c |
| [src/emu/ui] | filemngr.c filemngr.h ui.c |
| [src/emu/video] | video.mak voodoo_pci.c voodoo_pci.h |
| [src/lib/formats] | a26_cas.c a5105_dsk.c abc800_dsk.c ace_tap.c adam_cas.c adam_dsk.c ami_dsk.c ap_dsk35.c apf_apt.c apollo_dsk.c applix_dsk.c apridisk.c asst128_dsk.c atari_dsk.c atarist_dsk.c atom_tap.c bw12_dsk.c bw2_dsk.c cassimg.c cbm_crt.c cbm_crt.h cbm_tap.c ccvf_dsk.c cgen_cas.c coco_cas.c coco_dsk.c comx35_dsk.c concept_dsk.c coupedsk.c cpis_dsk.c cqm_dsk.c csw_cas.c d64_dsk.c d64_dsk.h d67_dsk.c d71_dsk.c d80_dsk.c d81_dsk.c d82_dsk.c d88_dsk.c dcp_dsk.c dfi_dsk.c dim_dsk.c dip_dsk.c dmk_dsk.c dmv_dsk.c dsk_dsk.c ep64_dsk.c esq16_dsk.c esq8_dsk.c excali64_dsk.c fc100_cas.c fdd_dsk.c fdi_dsk.c flex_dsk.c flopimg.c fm7_cas.c fmsx_cas.c fmtowns_dsk.c g64_dsk.c gtp_cas.c hect_dsk.c hect_tap.c hxcmfm_dsk.c imd_dsk.c ioprocs.c ipf_dsk.c iq151_dsk.c itt3030_dsk.c kaypro_dsk.c kc85_dsk.c kc_cas.c kim1_cas.c lviv_lvt.c m20_dsk.c m5_dsk.c mbee_cas.c mfi_dsk.c mm_dsk.c msx_dsk.c mz_cas.c nanos_dsk.c naslite_dsk.c nes_dsk.c nfd_dsk.c orao_cas.c oric_dsk.c oric_tap.c p6001_cas.c pasti_dsk.c pc98_dsk.c pc98fdi_dsk.c pc_dsk.c phc25_cas.c pmd_cas.c primoptp.c pyldin_dsk.c ql_dsk.c rk_cas.c rx50_dsk.c sc3000_bit.c sf7000_dsk.c smx_dsk.c sol_cas.c sorc_cas.c sorc_dsk.c sord_cas.c spc1000_cas.c st_dsk.c svi_cas.c svi_dsk.c tandy2k_dsk.c td0_dsk.c thom_cas.c thom_dsk.c ti99_dsk.c tiki100_dsk.c trd_dsk.c trs_cas.c trs_dsk.c tvc_cas.c tvc_dsk.c tzx_cas.c uef_cas.c upd765_dsk.c vg5k_cas.c victor9k_dsk.c victor9k_dsk.h vt_cas.c vt_dsk.c vtech1_dsk.c wd177x_dsk.c x07_cas.c x1_tap.c xdf_dsk.c z80ne_dsk.c zx81_p.c |
| [src/lib/util] | avhuff.c aviio.c bitmap.c bitmap.h cdrom.c chd.c chdcd.c chdcodec.c corefile.c corestr.h coretmpl.h cstrpool.c delegate.c delegate.h flac.c harddisk.c huffman.c opresolv.c options.c palette.c png.c tagmap.c xmlfile.c zippath.c |
| [src/mame] | mame.lst mame.mak |
| [src/mame/audio] | hng64.c subs.c |
| [src/mame/drivers] | astinvad.c astrcorp.c atlantis.c cocoloco.c cps1.c dynax.c galaxian.c goldstar.c iteagle.c karnov.c megaplay.c megasys1.c pinball2k.c psikyo.c queen.c re900.c realbrk.c rltennis.c seta.c seta2.c srmp2.c ssrj.c sstrangr.c sub.c subs.c suna16.c supdrapo.c suprgolf.c suprloco.c suprridr.c thedeep.c toaplan2.c ttchamp.c twins.c |
| [src/mame/includes] | dynax.h goldstar.h realbrk.h rltennis.h seta.h seta2.h srmp2.h ssrj.h subs.h suna16.h suprloco.h suprridr.h thedeep.h |
| [src/mame/layout] | unkch.lay |
| [src/mame/machine] | iteagle_fpga.c iteagle_fpga.h subs.c |
| [src/mame/video] | cps1.c decmxc06.c decmxc06.h dynax.c realbrk.c rltennis.c seta.c seta001.c seta001.h seta2.c srmp2.c ssrj.c subs.c suna16.c suprloco.c suprridr.c thedeep.c |
| [src/mess] | mess.lst mess.mak |
| [src/mess/audio] | upd1771.c |
| [src/mess/drivers] | a7800.c elecbowl.c hh_hmcs40.c hh_pic16.c hh_tms1k.c hh_ucom4.c m24.c mbdtower.c sms.c snes.c ti99_4x.c ticalc1x.c tispeak.c |
| [src/mess/includes] | hh_tms1k.h |
| [src/mess/layout] | ebball2.lay ebball3.lay mbdtower.lay ssimon.lay |
| [src/mess/machine] | m24_kbd.c m24_kbd.h |
| [src/mess/tools/floptool] | main.c |
| [src/mess/tools/imgtool] | iflopimg.c imgterrs.c library.c library.h modules.c |
| [src/osd/modules/debugger] | debugwin.c |
| [src/osd/modules/font] | font_windows.c |
| [src/osd/modules/lib] | osdobj_common.c |
| [src/osd/sdl/man] | castool.1 chdman.1 floptool.1 imgtool.1 jedutil.1 ldresample.1 ldverify.1 mame.6 mess.6 romcmp.1 testkeys.1 |
| [src/osd/windows] | windows.mak winprefix.h |
| [src/tools] | chdman.c ldresample.c ldverify.c nltool.c pngcmp.c regrep.c split.c src2html.c tools.mak |
trunk/3rdparty/bgfx/examples/08-update/update.cpp
| r245106 | r245107 | |
| 149 | 149 | loadTexture("texture_compression_ptc24.pvr"), |
| 150 | 150 | }; |
| 151 | 151 | |
| 152 | | const bgfx::Memory* mem8 = bgfx::alloc(32*32*32); |
| 153 | | const bgfx::Memory* mem16f = bgfx::alloc(32*32*32*2); |
| 154 | | const bgfx::Memory* mem32f = bgfx::alloc(32*32*32*4); |
| 155 | | for (uint8_t zz = 0; zz < 32; ++zz) |
| 156 | | { |
| 157 | | for (uint8_t yy = 0; yy < 32; ++yy) |
| 158 | | { |
| 159 | | for (uint8_t xx = 0; xx < 32; ++xx) |
| 160 | | { |
| 161 | | const uint32_t offset = ( (zz*32+yy)*32+xx); |
| 162 | | const uint32_t val = xx ^ yy ^ zz; |
| 163 | | mem8->data[offset] = val<<3; |
| 164 | | *(uint16_t*)&mem16f->data[offset*2] = bx::halfFromFloat( (float)val/32.0f); |
| 165 | | *(float*)&mem32f->data[offset*4] = (float)val/32.0f; |
| 166 | | } |
| 167 | | } |
| 168 | | } |
| 169 | | |
| 170 | | bgfx::TextureHandle textures3d[] = |
| 171 | | { |
| 172 | | bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem8), |
| 173 | | bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R16F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem16f), |
| 174 | | bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R32F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem32f), |
| 175 | | }; |
| 176 | | |
| 177 | 152 | // Create static vertex buffer. |
| 178 | 153 | bgfx::VertexBufferHandle vbh = bgfx::createVertexBuffer(bgfx::makeRef(s_cubeVertices, sizeof(s_cubeVertices) ), PosTexcoordVertex::ms_decl); |
| 179 | 154 | |
| r245106 | r245107 | |
| 181 | 156 | bgfx::IndexBufferHandle ibh = bgfx::createIndexBuffer(bgfx::makeRef(s_cubeIndices, sizeof(s_cubeIndices) ) ); |
| 182 | 157 | |
| 183 | 158 | // Create texture sampler uniforms. |
| 184 | | bgfx::UniformHandle u_texCube = bgfx::createUniform("u_texCube", bgfx::UniformType::Uniform1iv); |
| 159 | bgfx::UniformHandle u_texCube = bgfx::createUniform("u_texCube", bgfx::UniformType::Uniform1iv); |
| 160 | |
| 185 | 161 | bgfx::UniformHandle u_texColor = bgfx::createUniform("u_texColor", bgfx::UniformType::Uniform1iv); |
| 186 | 162 | |
| 187 | | bgfx::UniformHandle u_time = bgfx::createUniform("u_time", bgfx::UniformType::Uniform1f); |
| 163 | bgfx::ProgramHandle program = loadProgram("vs_update", "fs_update"); |
| 164 | bgfx::ProgramHandle programCmp = loadProgram("vs_update", "fs_update_cmp"); |
| 188 | 165 | |
| 189 | | bgfx::ProgramHandle program = loadProgram("vs_update", "fs_update"); |
| 190 | | bgfx::ProgramHandle programCmp = loadProgram("vs_update", "fs_update_cmp"); |
| 191 | | bgfx::ProgramHandle program3d = loadProgram("vs_update", "fs_update_3d"); |
| 192 | | |
| 193 | 166 | const uint32_t textureSide = 2048; |
| 194 | 167 | |
| 195 | 168 | bgfx::TextureHandle textureCube = bgfx::createTextureCube(textureSide, 1 |
| r245106 | r245107 | |
| 237 | 210 | const int64_t freq = bx::getHPFrequency(); |
| 238 | 211 | const double toMs = 1000.0/double(freq); |
| 239 | 212 | float time = (float)( (now - timeOffset)/double(bx::getHPFrequency() ) ); |
| 240 | | bgfx::setUniform(u_time, &time); |
| 241 | 213 | |
| 242 | 214 | // Use debug font to print information about this example. |
| 243 | 215 | bgfx::dbgTextClear(); |
| r245106 | r245107 | |
| 373 | 345 | // Submit primitive for rendering to view 1. |
| 374 | 346 | bgfx::submit(1); |
| 375 | 347 | |
| 376 | | const float xpos = -8.0f - BX_COUNTOF(textures)*0.1f*0.5f; |
| 377 | 348 | |
| 378 | 349 | for (uint32_t ii = 0; ii < BX_COUNTOF(textures); ++ii) |
| 379 | 350 | { |
| 380 | | bx::mtxTranslate(mtx, xpos + ii*2.1f, 4.0f, 0.0f); |
| 351 | bx::mtxTranslate(mtx, -8.0f - BX_COUNTOF(textures)*0.1f*0.5f + ii*2.1f, 4.0f, 0.0f); |
| 381 | 352 | |
| 382 | 353 | // Set model matrix for rendering. |
| 383 | 354 | bgfx::setTransform(mtx); |
| r245106 | r245107 | |
| 399 | 370 | bgfx::submit(1); |
| 400 | 371 | } |
| 401 | 372 | |
| 402 | | for (uint32_t ii = 0; ii < BX_COUNTOF(textures3d); ++ii) |
| 403 | | { |
| 404 | | bx::mtxTranslate(mtx, xpos + ii*2.1f, -4.0f, 0.0f); |
| 405 | | |
| 406 | | // Set model matrix for rendering. |
| 407 | | bgfx::setTransform(mtx); |
| 408 | | |
| 409 | | // Set vertex and fragment shaders. |
| 410 | | bgfx::setProgram(program3d); |
| 411 | | |
| 412 | | // Set vertex and index buffer. |
| 413 | | bgfx::setVertexBuffer(vbh); |
| 414 | | bgfx::setIndexBuffer(ibh, 0, 6); |
| 415 | | |
| 416 | | // Bind texture. |
| 417 | | bgfx::setTexture(0, u_texColor, textures3d[ii]); |
| 418 | | |
| 419 | | // Set render states. |
| 420 | | bgfx::setState(BGFX_STATE_DEFAULT); |
| 421 | | |
| 422 | | // Submit primitive for rendering to view 1. |
| 423 | | bgfx::submit(1); |
| 424 | | } |
| 425 | | |
| 426 | 373 | for (uint32_t ii = 0; ii < 3; ++ii) |
| 427 | 374 | { |
| 428 | | bx::mtxTranslate(mtx, xpos + 8*2.1f, -4.0f + ii*2.1f, 0.0f); |
| 375 | bx::mtxTranslate(mtx, -8.0f - BX_COUNTOF(textures)*0.1f*0.5f + 8*2.1f, -4.0f + ii*2.1f, 0.0f); |
| 429 | 376 | |
| 430 | 377 | // Set model matrix for rendering. |
| 431 | 378 | bgfx::setTransform(mtx); |
| r245106 | r245107 | |
| 465 | 412 | bgfx::destroyTexture(textures[ii]); |
| 466 | 413 | } |
| 467 | 414 | |
| 468 | | for (uint32_t ii = 0; ii < BX_COUNTOF(textures3d); ++ii) |
| 469 | | { |
| 470 | | bgfx::destroyTexture(textures3d[ii]); |
| 471 | | } |
| 472 | | |
| 473 | 415 | bgfx::destroyTexture(texture2d); |
| 474 | 416 | bgfx::destroyTexture(textureCube); |
| 475 | 417 | bgfx::destroyIndexBuffer(ibh); |
| 476 | 418 | bgfx::destroyVertexBuffer(vbh); |
| 477 | | bgfx::destroyProgram(program3d); |
| 478 | 419 | bgfx::destroyProgram(programCmp); |
| 479 | 420 | bgfx::destroyProgram(program); |
| 480 | | bgfx::destroyUniform(u_time); |
| 481 | 421 | bgfx::destroyUniform(u_texColor); |
| 482 | 422 | bgfx::destroyUniform(u_texCube); |
| 483 | 423 | |
trunk/3rdparty/bgfx/examples/common/imgui/imgui.cpp
| r245106 | r245107 | |
| 388 | 388 | , m_halfTexel(0.0f) |
| 389 | 389 | , m_nvg(NULL) |
| 390 | 390 | , m_view(255) |
| 391 | | , m_surfaceWidth(0) |
| 392 | | , m_surfaceHeight(0) |
| 393 | 391 | , m_viewWidth(0) |
| 394 | 392 | , m_viewHeight(0) |
| 395 | 393 | , m_currentFontIdx(0) |
| r245106 | r245107 | |
| 812 | 810 | m_char = _inputChar; |
| 813 | 811 | } |
| 814 | 812 | |
| 815 | | void beginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, uint16_t _surfaceWidth, uint16_t _surfaceHeight, char _inputChar, uint8_t _view) |
| 813 | void beginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, char _inputChar, uint8_t _view) |
| 816 | 814 | { |
| 815 | IMGUI_beginFrame(_mx, _my, _button, _width, _height, _inputChar, _view); |
| 816 | nvgViewId(m_nvg, _view); |
| 817 | |
| 817 | 818 | m_view = _view; |
| 818 | 819 | m_viewWidth = _width; |
| 819 | 820 | m_viewHeight = _height; |
| 820 | | m_surfaceWidth = _surfaceWidth; |
| 821 | | m_surfaceHeight = _surfaceHeight; |
| 822 | | |
| 823 | | const float xscale = float(m_surfaceWidth) /float(m_viewWidth); |
| 824 | | const float yscale = float(m_surfaceHeight)/float(m_viewHeight); |
| 825 | | const int32_t mx = int32_t(float(_mx)*xscale); |
| 826 | | const int32_t my = int32_t(float(_my)*yscale); |
| 827 | | |
| 828 | | IMGUI_beginFrame(mx, my, _button, _width, _height, _inputChar, _view); |
| 829 | | nvgBeginFrameScaled(m_nvg, m_viewWidth, m_viewHeight, m_surfaceWidth, m_surfaceHeight, 1.0f); |
| 830 | | nvgViewId(m_nvg, _view); |
| 831 | | |
| 832 | 821 | bgfx::setViewName(_view, "IMGUI"); |
| 833 | 822 | bgfx::setViewSeq(_view, true); |
| 834 | 823 | |
| 835 | 824 | const bgfx::HMD* hmd = bgfx::getHMD(); |
| 836 | 825 | if (NULL != hmd) |
| 837 | 826 | { |
| 838 | | m_viewWidth = _width / 2; |
| 839 | | m_surfaceWidth = _surfaceWidth / 2; |
| 827 | m_viewWidth = _width / 2; |
| 840 | 828 | |
| 841 | 829 | float proj[16]; |
| 842 | 830 | bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f); |
| r245106 | r245107 | |
| 849 | 837 | const float offset1 = -proj[8] + (hmd->eye[1].viewOffset[0] / dist * proj[0]); |
| 850 | 838 | |
| 851 | 839 | float ortho[2][16]; |
| 852 | | const float viewOffset = _surfaceWidth/4.0f; |
| 853 | | const float viewWidth = _surfaceWidth/2.0f; |
| 854 | | bx::mtxOrtho(ortho[0], viewOffset, viewOffset + viewWidth, (float)m_surfaceHeight, 0.0f, 0.0f, 1000.0f, offset0); |
| 855 | | bx::mtxOrtho(ortho[1], viewOffset, viewOffset + viewWidth, (float)m_surfaceHeight, 0.0f, 0.0f, 1000.0f, offset1); |
| 840 | const float viewOffset = _width/4.0f; |
| 841 | const float viewWidth = _width/2.0f; |
| 842 | bx::mtxOrtho(ortho[0], viewOffset, viewOffset + viewWidth, (float)m_viewHeight, 0.0f, 0.0f, 1000.0f, offset0); |
| 843 | bx::mtxOrtho(ortho[1], viewOffset, viewOffset + viewWidth, (float)m_viewHeight, 0.0f, 0.0f, 1000.0f, offset1); |
| 856 | 844 | bgfx::setViewTransform(_view, NULL, ortho[0], BGFX_VIEW_STEREO, ortho[1]); |
| 857 | 845 | bgfx::setViewRect(_view, 0, 0, hmd->width, hmd->height); |
| 858 | 846 | } |
| 859 | 847 | else |
| 860 | 848 | { |
| 861 | 849 | float ortho[16]; |
| 862 | | bx::mtxOrtho(ortho, 0.0f, (float)m_surfaceWidth, (float)m_surfaceHeight, 0.0f, 0.0f, 1000.0f); |
| 850 | bx::mtxOrtho(ortho, 0.0f, (float)m_viewWidth, (float)m_viewHeight, 0.0f, 0.0f, 1000.0f); |
| 863 | 851 | bgfx::setViewTransform(_view, NULL, ortho); |
| 864 | 852 | bgfx::setViewRect(_view, 0, 0, _width, _height); |
| 865 | 853 | } |
| 866 | 854 | |
| 867 | | updateInput(mx, my, _button, _scroll, _inputChar); |
| 855 | updateInput(_mx, _my, _button, _scroll, _inputChar); |
| 868 | 856 | |
| 869 | 857 | m_hot = m_hotToBe; |
| 870 | 858 | m_hotToBe = 0; |
| r245106 | r245107 | |
| 896 | 884 | |
| 897 | 885 | clearInput(); |
| 898 | 886 | |
| 899 | | nvgEndFrame(m_nvg); |
| 900 | 887 | IMGUI_endFrame(); |
| 901 | 888 | } |
| 902 | 889 | |
| r245106 | r245107 | |
| 950 | 937 | setEnabled(m_areaId); |
| 951 | 938 | } |
| 952 | 939 | |
| 953 | | nvgScissor(m_nvg, area); |
| 940 | nvgScissor(m_nvg |
| 941 | , float(area.m_scissorX) |
| 942 | , float(area.m_scissorY-1) |
| 943 | , float(area.m_scissorWidth) |
| 944 | , float(area.m_scissorHeight+1) |
| 945 | ); |
| 954 | 946 | |
| 955 | 947 | m_insideArea |= area.m_inside; |
| 956 | 948 | |
| r245106 | r245107 | |
| 1088 | 1080 | } |
| 1089 | 1081 | } |
| 1090 | 1082 | |
| 1091 | | nvgScissor(m_nvg, parentArea); |
| 1083 | nvgScissor(m_nvg |
| 1084 | , float(parentArea.m_scissorX) |
| 1085 | , float(parentArea.m_scissorY-1) |
| 1086 | , float(parentArea.m_scissorWidth) |
| 1087 | , float(parentArea.m_scissorHeight+1) |
| 1088 | ); |
| 1092 | 1089 | } |
| 1093 | 1090 | |
| 1094 | 1091 | bool beginArea(const char* _name, int32_t _x, int32_t _y, int32_t _width, int32_t _height, bool _enabled, int32_t _r) |
| r245106 | r245107 | |
| 1162 | 1159 | } |
| 1163 | 1160 | area.m_scissorEnabled = true; |
| 1164 | 1161 | |
| 1165 | | nvgScissor(m_nvg, area); |
| 1162 | nvgBeginFrame(m_nvg, m_viewWidth, m_viewHeight, 1.0f); |
| 1163 | nvgScissor(m_nvg |
| 1164 | , float(area.m_scissorX) |
| 1165 | , float(area.m_scissorY-1) |
| 1166 | , float(area.m_scissorWidth) |
| 1167 | , float(area.m_scissorHeight+1) |
| 1168 | ); |
| 1166 | 1169 | |
| 1167 | 1170 | m_insideArea |= area.m_inside; |
| 1168 | 1171 | return area.m_inside; |
| r245106 | r245107 | |
| 1170 | 1173 | |
| 1171 | 1174 | void endArea() |
| 1172 | 1175 | { |
| 1173 | | m_areaId.pop(); |
| 1174 | 1176 | nvgResetScissor(m_nvg); |
| 1177 | nvgEndFrame(m_nvg); |
| 1175 | 1178 | } |
| 1176 | 1179 | |
| 1177 | 1180 | bool button(const char* _text, bool _enabled, ImguiAlign::Enum _align, uint32_t _rgb0, int32_t _r) |
| r245106 | r245107 | |
| 1200 | 1203 | //|| ImguiAlign::CenterIndented == _align). |
| 1201 | 1204 | { |
| 1202 | 1205 | xx = area.m_widgetX; |
| 1203 | | width = area.m_widgetW - (area.m_widgetX-area.m_contentX); |
| 1206 | width = area.m_widgetW - (area.m_widgetX-area.m_scissorX); |
| 1204 | 1207 | } |
| 1205 | 1208 | |
| 1206 | 1209 | const bool enabled = _enabled && isEnabled(m_areaId); |
| r245106 | r245107 | |
| 1383 | 1386 | //|| ImguiAlign::CenterIndented == _align). |
| 1384 | 1387 | { |
| 1385 | 1388 | xx = area.m_widgetX; |
| 1386 | | width = area.m_widgetW - (area.m_widgetX-area.m_contentX); |
| 1389 | width = area.m_widgetW - (area.m_widgetX-area.m_scissorX); |
| 1387 | 1390 | } |
| 1388 | 1391 | |
| 1389 | 1392 | const bool drawLabel = (NULL != _label && _label[0] != '\0'); |
| r245106 | r245107 | |
| 1522 | 1525 | //|| ImguiAlign::CenterIndented == _align). |
| 1523 | 1526 | { |
| 1524 | 1527 | xx = area.m_widgetX; |
| 1525 | | width = area.m_widgetW - (area.m_widgetX-area.m_contentX); |
| 1528 | width = area.m_widgetW - (area.m_widgetX-area.m_scissorX); |
| 1526 | 1529 | } |
| 1527 | 1530 | |
| 1528 | 1531 | uint8_t selected = _selected; |
| r245106 | r245107 | |
| 1742 | 1745 | //|| ImguiAlign::CenterIndented == _align). |
| 1743 | 1746 | { |
| 1744 | 1747 | xx = area.m_widgetX; |
| 1745 | | width = area.m_widgetW - (area.m_widgetX-area.m_contentX); |
| 1748 | width = area.m_widgetW - (area.m_widgetX-area.m_scissorX); |
| 1746 | 1749 | } |
| 1747 | 1750 | |
| 1748 | 1751 | const int32_t height = width/2; |
| r245106 | r245107 | |
| 1795 | 1798 | //|| ImguiAlign::CenterIndented == _align). |
| 1796 | 1799 | { |
| 1797 | 1800 | xx = area.m_widgetX; |
| 1798 | | width = area.m_widgetW - (area.m_widgetX-area.m_contentX); |
| 1801 | width = area.m_widgetW - (area.m_widgetX-area.m_scissorX); |
| 1799 | 1802 | } |
| 1800 | 1803 | |
| 1801 | 1804 | const bool adjustHeight = (_cross && _sameHeight); |
| r245106 | r245107 | |
| 2021 | 2024 | xx = -borderSize; |
| 2022 | 2025 | yy = -1; |
| 2023 | 2026 | width = 2*borderSize+1; |
| 2024 | | height = m_surfaceHeight+1; |
| 2027 | height = m_viewHeight+1; |
| 2025 | 2028 | triX = 0; |
| 2026 | | triY = (m_surfaceHeight-triSize)/2; |
| 2029 | triY = (m_viewHeight-triSize)/2; |
| 2027 | 2030 | orientation = _checked ? TriangleOrientation::Left : TriangleOrientation::Right; |
| 2028 | 2031 | } |
| 2029 | 2032 | else if (ImguiBorder::Right == _border) |
| 2030 | 2033 | { |
| 2031 | | xx = m_surfaceWidth - borderSize; |
| 2034 | xx = m_viewWidth - borderSize; |
| 2032 | 2035 | yy = -1; |
| 2033 | 2036 | width = 2*borderSize+1; |
| 2034 | | height = m_surfaceHeight+1; |
| 2035 | | triX = m_surfaceWidth - triSize - 2; |
| 2036 | | triY = (m_surfaceHeight-width)/2; |
| 2037 | height = m_viewHeight+1; |
| 2038 | triX = m_viewWidth - triSize - 2; |
| 2039 | triY = (m_viewHeight-width)/2; |
| 2037 | 2040 | orientation = _checked ? TriangleOrientation::Right : TriangleOrientation::Left; |
| 2038 | 2041 | } |
| 2039 | 2042 | else if (ImguiBorder::Top == _border) |
| 2040 | 2043 | { |
| 2041 | 2044 | xx = 0; |
| 2042 | 2045 | yy = -borderSize; |
| 2043 | | width = m_surfaceWidth; |
| 2046 | width = m_viewWidth; |
| 2044 | 2047 | height = 2*borderSize; |
| 2045 | | triX = (m_surfaceWidth-triSize)/2; |
| 2048 | triX = (m_viewWidth-triSize)/2; |
| 2046 | 2049 | triY = 0; |
| 2047 | 2050 | orientation = _checked ? TriangleOrientation::Up : TriangleOrientation::Down; |
| 2048 | 2051 | } |
| 2049 | 2052 | else //if (ImguiBorder::Bottom == _border). |
| 2050 | 2053 | { |
| 2051 | 2054 | xx = 0; |
| 2052 | | yy = m_surfaceHeight - borderSize; |
| 2053 | | width = m_surfaceWidth; |
| 2055 | yy = m_viewHeight - borderSize; |
| 2056 | width = m_viewWidth; |
| 2054 | 2057 | height = 2*borderSize; |
| 2055 | | triX = (m_surfaceWidth-triSize)/2; |
| 2056 | | triY = m_surfaceHeight-triSize; |
| 2058 | triX = (m_viewWidth-triSize)/2; |
| 2059 | triY = m_viewHeight-triSize; |
| 2057 | 2060 | orientation = _checked ? TriangleOrientation::Down : TriangleOrientation::Up; |
| 2058 | 2061 | } |
| 2059 | 2062 | |
| r245106 | r245107 | |
| 2144 | 2147 | //|| ImguiAlign::CenterIndented == _align). |
| 2145 | 2148 | { |
| 2146 | 2149 | xx = area.m_widgetX; |
| 2147 | | width = area.m_widgetW - (area.m_widgetX-area.m_contentX); |
| 2150 | width = area.m_widgetW - (area.m_widgetX-area.m_scissorX); |
| 2148 | 2151 | } |
| 2149 | 2152 | |
| 2150 | 2153 | drawRoundedRect( (float)xx, (float)yy, (float)width, (float)height, 4.0f, imguiRGBA(0, 0, 0, 128) ); |
| r245106 | r245107 | |
| 2262 | 2265 | area.m_widgetY += _height; |
| 2263 | 2266 | } |
| 2264 | 2267 | |
| 2265 | | void separatorLine(uint16_t _height, ImguiAlign::Enum _align) |
| 2268 | void separatorLine(uint16_t _height) |
| 2266 | 2269 | { |
| 2267 | 2270 | Area& area = getCurrentArea(); |
| 2268 | | //const int32_t width = area.m_widgetW; |
| 2269 | | const int32_t height = 1; |
| 2270 | | //const int32_t xx = area.m_widgetX; |
| 2271 | | const int32_t yy = area.m_widgetY + _height/2 - height; |
| 2272 | | |
| 2273 | | int32_t xx; |
| 2274 | | int32_t width; |
| 2275 | | if (ImguiAlign::Left == _align) |
| 2276 | | { |
| 2277 | | xx = area.m_contentX + SCROLL_AREA_PADDING; |
| 2278 | | width = area.m_widgetW; |
| 2279 | | } |
| 2280 | | else if (ImguiAlign::LeftIndented == _align |
| 2281 | | || ImguiAlign::Right == _align) |
| 2282 | | { |
| 2283 | | xx = area.m_widgetX; |
| 2284 | | width = area.m_widgetW; |
| 2285 | | } |
| 2286 | | else //if (ImguiAlign::Center == _align |
| 2287 | | //|| ImguiAlign::CenterIndented == _align). |
| 2288 | | { |
| 2289 | | xx = area.m_widgetX; |
| 2290 | | width = area.m_widgetW - (area.m_widgetX-area.m_contentX) + 1; |
| 2291 | | } |
| 2292 | | |
| 2271 | const int32_t rectWidth = area.m_widgetW; |
| 2272 | const int32_t rectHeight = 1; |
| 2273 | const int32_t xx = area.m_widgetX; |
| 2274 | const int32_t yy = area.m_widgetY + _height/2 - rectHeight; |
| 2293 | 2275 | area.m_widgetY += _height; |
| 2294 | 2276 | |
| 2295 | 2277 | drawRect( (float)xx |
| 2296 | 2278 | , (float)yy |
| 2297 | | , (float)width |
| 2298 | | , (float)height |
| 2279 | , (float)rectWidth |
| 2280 | , (float)rectHeight |
| 2299 | 2281 | , imguiRGBA(255, 255, 255, 32) |
| 2300 | 2282 | ); |
| 2301 | 2283 | } |
| r245106 | r245107 | |
| 3066 | 3048 | const Area& area = getCurrentArea(); |
| 3067 | 3049 | if (area.m_scissorEnabled) |
| 3068 | 3050 | { |
| 3069 | | const float xscale = float(m_viewWidth) /float(m_surfaceWidth); |
| 3070 | | const float yscale = float(m_viewHeight)/float(m_surfaceHeight); |
| 3071 | | const int16_t scissorX = int16_t(float(area.m_scissorX)*xscale); |
| 3072 | | const int16_t scissorY = int16_t(float(area.m_scissorY)*yscale); |
| 3073 | | const int16_t scissorWidth = int16_t(float(area.m_scissorWidth)*xscale); |
| 3074 | | const int16_t scissorHeight = int16_t(float(area.m_scissorHeight)*yscale); |
| 3075 | | bgfx::setScissor(uint16_t(IMGUI_MAX(0, scissorX) ) |
| 3076 | | , uint16_t(IMGUI_MAX(0, scissorY-1) ) |
| 3077 | | , scissorWidth |
| 3078 | | , scissorHeight+1 |
| 3051 | bgfx::setScissor(uint16_t(IMGUI_MAX(0, area.m_scissorX) ) |
| 3052 | , uint16_t(IMGUI_MAX(0, area.m_scissorY-1) ) |
| 3053 | , area.m_scissorWidth |
| 3054 | , area.m_scissorHeight+1 |
| 3079 | 3055 | ); |
| 3080 | 3056 | } |
| 3081 | 3057 | else |
| r245106 | r245107 | |
| 3084 | 3060 | } |
| 3085 | 3061 | } |
| 3086 | 3062 | |
| 3087 | | inline void nvgScissor(NVGcontext* _ctx, const Area& _area) |
| 3088 | | { |
| 3089 | | if (_area.m_scissorEnabled) |
| 3090 | | { |
| 3091 | | ::nvgScissor(_ctx |
| 3092 | | , float(IMGUI_MAX(0, _area.m_scissorX) ) |
| 3093 | | , float(IMGUI_MAX(0, _area.m_scissorY-1) ) |
| 3094 | | , float(_area.m_scissorWidth) |
| 3095 | | , float(_area.m_scissorHeight+1) |
| 3096 | | ); |
| 3097 | | } |
| 3098 | | else |
| 3099 | | { |
| 3100 | | nvgResetScissor(_ctx); |
| 3101 | | } |
| 3102 | | } |
| 3103 | | |
| 3104 | 3063 | template <typename Ty, uint16_t Max=64> |
| 3105 | 3064 | struct IdStack |
| 3106 | 3065 | { |
| r245106 | r245107 | |
| 3188 | 3147 | NVGcontext* m_nvg; |
| 3189 | 3148 | |
| 3190 | 3149 | uint8_t m_view; |
| 3191 | | uint16_t m_surfaceWidth; |
| 3192 | | uint16_t m_surfaceHeight; |
| 3193 | 3150 | uint16_t m_viewWidth; |
| 3194 | 3151 | uint16_t m_viewHeight; |
| 3195 | 3152 | |
| r245106 | r245107 | |
| 3246 | 3203 | return handle; |
| 3247 | 3204 | } |
| 3248 | 3205 | |
| 3249 | | void imguiBeginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, uint16_t _surfaceWidth, uint16_t _surfaceHeight, char _inputChar, uint8_t _view) |
| 3250 | | { |
| 3251 | | s_imgui.beginFrame(_mx, _my, _button, _scroll, _width, _height, _surfaceWidth, _surfaceHeight, _inputChar, _view); |
| 3252 | | } |
| 3253 | | |
| 3254 | 3206 | void imguiBeginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, char _inputChar, uint8_t _view) |
| 3255 | 3207 | { |
| 3256 | | s_imgui.beginFrame(_mx, _my, _button, _scroll, _width, _height, _width, _height, _inputChar, _view); |
| 3208 | s_imgui.beginFrame(_mx, _my, _button, _scroll, _width, _height, _inputChar, _view); |
| 3257 | 3209 | } |
| 3258 | 3210 | |
| 3259 | 3211 | void imguiEndFrame() |
| r245106 | r245107 | |
| 3336 | 3288 | s_imgui.separator(_height); |
| 3337 | 3289 | } |
| 3338 | 3290 | |
| 3339 | | void imguiSeparatorLine(uint16_t _height, ImguiAlign::Enum _align) |
| 3291 | void imguiSeparatorLine(uint16_t _height) |
| 3340 | 3292 | { |
| 3341 | | s_imgui.separatorLine(_height, _align); |
| 3293 | s_imgui.separatorLine(_height); |
| 3342 | 3294 | } |
| 3343 | 3295 | |
| 3344 | 3296 | int32_t imguiGetWidgetX() |