/* * Sets if Pacaur tool will use "--noconfirm" parameter */ void SettingsManager::setAurNoConfirmParam(bool newValue) { instance()->getSYSsettings()->setValue(ctn_KEY_AUR_NO_CONFIRM_PARAM, newValue); instance()->getSYSsettings()->sync(); }
void ImageIoRegistrar::registerSourceGeneric( SourceCreationFunc func, int32_t priority ) { instance()->registerSourceGeneric( func, priority ); }
void Probe::registerSelf() { boost::shared_ptr<Class> instance (new Probe); registerClass (typeid (ESM::Probe).name(), instance); }
ImageTargetRef ImageIoRegistrar::createTarget( DataTargetRef dataTarget, ImageSourceRef imageSource, ImageTarget::Options options, std::string extension ) { return instance()->createTarget( dataTarget, imageSource, options, extension ); }
void ImageIoRegistrar::registerSourceType( string extension, SourceCreationFunc func, int32_t priority ) { instance()->registerSourceType( extension, func, priority ); }
void AnimationBank::loadWalkers() { StringHelper::debug( 0xff, "Loading cart graphics" ); instance()._d->loadWalkers(); }
check_mk::check_mk_lua_wrapper::check_mk_lua_wrapper(lua_State *L, bool) { lua::lua_wrapper instance(L); info = instance.get_userdata<lua::script_information*>(lua::lua_traits::user_data_tag); }
void SettingsManager::setConsoleFontSize(int newValue) { instance()->getSYSsettings()->setValue(ctn_KEY_CONSOLE_SIZE, newValue); instance()->getSYSsettings()->sync(); }
void SettingsManager::setKeepNumUninstalledPackages(int newValue) { instance()->getSYSsettings()->setValue(ctn_KEY_KEEP_NUM_UNINSTALLED, newValue); instance()->getSYSsettings()->sync(); }
void SettingsManager::setSUTool(const QString &newValue) { instance()->getSYSsettings()->setValue(ctn_KEY_SU_TOOL, newValue); instance()->getSYSsettings()->sync(); }
void SettingsManager::setInstantSearchSelected(bool newValue) { instance()->getSYSsettings()->setValue(ctn_KEY_INSTANT_SEARCH, newValue); instance()->getSYSsettings()->sync(); }
void SettingsManager::setUseAlternateRowColor(bool newValue) { instance()->getSYSsettings()->setValue(ctn_KEY_USE_ALTERNATE_ROW_COLOR, newValue); instance()->getSYSsettings()->sync(); }
void SettingsManager::setSearchOutdatedAURPackages(bool newValue) { instance()->getSYSsettings()->setValue(ctn_KEY_SEARCH_OUTDATED_AUR_PACKAGES, newValue); instance()->getSYSsettings()->sync(); }
/* * Sets if Pacaur tool will use "--noedit" parameter */ void SettingsManager::setAurNoEditParam(bool newValue) { instance()->getSYSsettings()->setValue(ctn_KEY_AUR_NO_EDIT_PARAM, newValue); instance()->getSYSsettings()->sync(); }
void Static::registerSelf() { boost::shared_ptr<Class> instance (new Static); registerClass (typeid (ESM::Static).name(), instance); }
Foam::fileName Foam::IOobject::filePath() const { if (instance().isAbsolute()) { fileName objectPath = instance()/name(); if (isFile(objectPath)) { return objectPath; } else { return fileName::null; } } else { fileName path = this->path(); fileName objectPath = path/name(); if (isFile(objectPath)) { return objectPath; } else { if ( time().processorCase() && ( instance() == time().system() || instance() == time().constant() ) ) { fileName parentObjectPath = rootPath()/time().globalCaseName() /instance()/db_.dbDir()/local()/name(); if (isFile(parentObjectPath)) { return parentObjectPath; } } if (!isDir(path)) { word newInstancePath = time().findInstancePath ( instant(instance()) ); if (newInstancePath.size()) { fileName fName ( rootPath()/caseName() /newInstancePath/db_.dbDir()/local()/name() ); if (isFile(fName)) { return fName; } } } } return fileName::null; } }
const AnimationBank::WalkerAnimationMap& AnimationBank::getWalker(const WalkerGraphicType walkerGraphic) { return instance()._d->animations[walkerGraphic]; }
int w_hasTextInput(lua_State *L) { luax_pushboolean(L, instance()->hasTextInput()); return 1; }
const Picture& AnimationBank::getCart(CartTypes cart, const DirectionType &direction) { return instance()._d->carts.at( cart ).at( direction ); }
int w_hasScreenKeyboard(lua_State *L) { luax_pushboolean(L, instance()->hasScreenKeyboard()); return 1; }
int check_mk::check_mk_packet_wrapper::size_section(lua_State *L) { lua::lua_wrapper instance(L); instance.push_int(static_cast<int>(packet.section_list.size())); return 1; }
int w_setKeyRepeat(lua_State *L) { instance()->setKeyRepeat(luax_toboolean(L, 1)); return 0; }
ImageSourceRef ImageIoRegistrar::createSource( DataSourceRef dataSource, ImageSource::Options options, string extension ) { return instance()->createSource( dataSource, options, extension ); }
int w_hasKeyRepeat(lua_State *L) { luax_pushboolean(L, instance()->hasKeyRepeat()); return 1; }
void ImageIoRegistrar::registerTargetType( string extension, TargetCreationFunc func, int32_t priority, const string &extensionData ) { instance()->registerTargetType( extension, func, priority, extensionData ); }
int main() { constexpr auto width = 1200u; constexpr auto height = 800u; // init ny app auto& backend = ny::Backend::choose(); if(!backend.vulkan()) { dlg_error("ny backend has no vulkan support!"); return 0; } auto ac = backend.createAppContext(); // basic vpp init auto iniExtensions = ac->vulkanExtensions(); iniExtensions.push_back(VK_EXT_DEBUG_REPORT_EXTENSION_NAME); vk::ApplicationInfo appInfo ("vpp-intro", 1, "vpp", 1, VK_API_VERSION_1_0); vk::InstanceCreateInfo instanceInfo; instanceInfo.pApplicationInfo = &appInfo; instanceInfo.enabledExtensionCount = iniExtensions.size(); instanceInfo.ppEnabledExtensionNames = iniExtensions.data(); #ifdef WithLayers constexpr auto layer = "VK_LAYER_LUNARG_standard_validation"; instanceInfo.enabledLayerCount = 1; instanceInfo.ppEnabledLayerNames = &layer; #endif vpp::Instance instance(instanceInfo); #ifdef WithLayers vpp::DebugCallback debugCallback(instance); #endif // ny init auto run = true; auto listener = MyWindowListener {}; listener.run = &run; auto vkSurface = vk::SurfaceKHR {}; auto ws = ny::WindowSettings {}; ws.surface = ny::SurfaceType::vulkan; ws.listener = &listener; ws.size = {width, height}; ws.vulkan.instance = (VkInstance) instance.vkHandle(); ws.vulkan.storeSurface = &(std::uintptr_t&) (vkSurface); auto wc = ac->createWindowContext(ws); // further vpp init const vpp::Queue* presentQueue; vpp::Device device(instance, vkSurface, presentQueue); vpp::Swapchain swapchain(device, vkSurface, {width, height}, {}); // vvg setup auto nvgContext = vvg::createContext(swapchain); auto font = nvgCreateFont(nvgContext, "sans", "Roboto-Regular.ttf"); using Clock = std::chrono::high_resolution_clock; auto lastFrameTimer = Clock::now(); unsigned int framesCount = 0; std::string fpsString = "420 fps"; // main loop while(run) { if(!ac->dispatchEvents()) break; nvgBeginFrame(nvgContext, width, height, width / (float) height); nvgBeginPath(nvgContext); nvgMoveTo(nvgContext, 10, 10); nvgLineTo(nvgContext, 10, 400); nvgLineTo(nvgContext, 100, 400); nvgQuadTo(nvgContext, 100, 50, 400, 120); nvgLineTo(nvgContext, 450, 10); nvgClosePath(nvgContext); nvgFillColor(nvgContext, nvgRGBAf(0.5, 0.8, 0.7, 1.0)); nvgFill(nvgContext); nvgBeginPath(nvgContext); nvgFontFaceId(nvgContext, font); nvgFontSize(nvgContext, 100.f); nvgFontBlur(nvgContext, .8f); nvgFillColor(nvgContext, nvgRGBAf(1.0, 1.0, 1.0, 1.0)); nvgTextBox(nvgContext, 200, 200, width - 200, "Hello Vulkan Vector Graphics World", nullptr); nvgFontSize(nvgContext, 30.f); nvgFontBlur(nvgContext, .2f); nvgText(nvgContext, 10, height - 20, fpsString.c_str(), nullptr); nvgBeginPath(nvgContext); nvgRect(nvgContext, 700, 400, 300, 300); nvgPathWinding(nvgContext, NVG_HOLE); nvgRect(nvgContext, 750, 450, 50, 50); // auto paint = nvgRadialGradient(nvgContext, 750, 425,20, 50, nvgRGB(0, 0, 200), nvgRGB(200, 200, 0)); // auto paint = nvgRadialGradient(nvgContext, 0.0, 0.0, 0.2, 100.0, nvgRGB(0, 0, 200), nvgRGB(200, 200, 0)); auto paint = nvgLinearGradient(nvgContext, 700, 400, 800, 450, nvgRGB(0, 0, 200), nvgRGB(200, 200, 0)); nvgFillPaint(nvgContext, paint); // nvgFillColor(nvgContext, nvgRGBA(200, 200, 0, 200)); nvgClosePath(nvgContext); nvgFill(nvgContext); nvgEndFrame(nvgContext); // only refresh frame timer every second framesCount++; if(Clock::now() - lastFrameTimer >= std::chrono::seconds(1)) { fpsString = std::to_string(framesCount) + " fps"; lastFrameTimer = Clock::now(); framesCount = 0; } } vvg::destroyContext(*nvgContext); }
void Armor::registerSelf() { boost::shared_ptr<Class> instance (new Armor); registerClass (typeid (ESM::Armor).name(), instance); }
void InterpretTest::callDynamicTest() { ConstantPool * pool = new ConstantPool(); Class * cls = initClass("Counter", pool); cls->addField("counter"); const char code1[] = { LOAD_LOCAL, 0x00, // PUSH this LOAD, 0x06, 0x00, //PUSH this[0] LOAD_LOCAL, 0x01, // PUSH value ADD, // this[0] + value LOAD_LOCAL, 0x00, // PUSH this STORE, 0x06, 0x00, // this[0] = this[0] + value RET_VOID }; const char code2[] = { LOAD_LOCAL, 0x00, // PUSH this LOAD, 0x06, 0x00, //PUSH this[0] RET }; const char code3[] = { PUSH, 0x04, 0x00, // PUSH 0 LOAD_LOCAL, 0x00, // PUSH this STORE, 0x06, 0x00, // this[0] = 0 RET_VOID }; const char code[] = { NEW, 0x00, 0x00, //new Counter DUP, STORE_LOCAL, 0x00, //a = new Counter CALL_DYNAMIC, 0x03, 0x00, //a.init LOAD_LOCAL, 0x00, PUSH, 0x05, 0x00, //PUSH 3 CALL_DYNAMIC, 0x01, 0x00, //a.increase(3) LOAD_LOCAL, 0x00, CALL_DYNAMIC, 0x02, 0x00, //a.getValue RET }; Method * m = initMethod("callTest", code, sizeof(code), 0, 1, 0); Method * m1 = initMethod("increase", code1, sizeof(code1), 2, 0, 1); Method * m2 = initMethod("getValue", code2, sizeof(code2), 1, 1, 1); Method * m3 = initMethod("init", code3, sizeof(code3), 1, 1, 1); ClassLoader cl(""); Interpret instance(&cl); ClassRef cr; memset(cr.name, 0x00, IDENTIFIER_LENGTH); sprintf(cr.name, "%s", cls->getName().c_str()); pool->addItem(&cr, CLASS_REF); //0 MethodRef mr; mr.params = m1->getParamCount(); sprintf(mr.name, "%s", m1->getName().c_str()); pool->addItem(&mr, METHOD_REF); //1 mr.params = m2->getParamCount(); sprintf(mr.name, "%s", m2->getName().c_str()); pool->addItem(&mr, METHOD_REF); //2 mr.params = m3->getParamCount(); sprintf(mr.name, "%s", m3->getName().c_str()); pool->addItem(&mr, METHOD_REF); //3 IntConst i; i.value = 0; pool->addItem(&i, INT_CONST); //4 i.value = 3; pool->addItem(&i, INT_CONST); //5 FieldRef fr; memset(fr.name, 0x00, IDENTIFIER_LENGTH); sprintf(fr.name, "counter"); pool->addItem(&fr, FIELD_REF); //6 cls->addMethod(m); cls->addMethod(m1); cls->addMethod(m2); cls->addMethod(m3); cl.addClass(cls); assert(3 == instance.run(cls->getName().c_str(), m->getName().c_str())); }
std::string System::findDataFile (const std::string& full, bool errorIfNotFound) { // Places where specific files were most recently found. This is // used to cache seeking of common files. static Table<std::string, std::string> lastFound; // First check if the file exists as requested. This will go // through the FileSystemCache, so most calls do not touch disk. if (FileSystem::exists(full)) { return full; } // Now check where we previously found this file. std::string* last = lastFound.getPointer(full); if (last != NULL) { if (FileSystem::exists(*last)) { // Even if cwd has changed the file is still present. // We won't notice if it has been deleted, however. return *last; } else { // Remove this from the cache it is invalid lastFound.remove(full); } } // Places to look static Array<std::string> directoryArray; std::string initialAppDataDir(instance().m_appDataDir); const char* g3dPath = getenv("G3DDATA"); if (directoryArray.size() == 0) { // Initialize the directory array RealTime t0 = System::time(); Array<std::string> baseDirArray; baseDirArray.append(""); if (! initialAppDataDir.empty()) { baseDirArray.append(initialAppDataDir); } # ifdef G3D_WIN32 if (g3dPath == NULL) { // If running the demos under visual studio from the G3D.sln file, // this will locate the data directory. const char* paths[] = {"../data-files/", "../../data-files/", "../../../data-files/", NULL}; for (int i = 0; paths[i]; ++i) { if (FileSystem::exists(pathConcat(paths[i], "G3D-DATA-README.TXT"))) { g3dPath = paths[i]; break; } } } # endif if (g3dPath && (initialAppDataDir != g3dPath)) { baseDirArray.append(g3dPath); } static const std::string subdirs[] = {"font", "gui", "SuperShader", "cubemap", "icon", "material", "image", "md2", "md3", "ifs", "3ds", "sky", ""}; for (int j = 0; j < baseDirArray.size(); ++j) { std::string d = baseDirArray[j]; if ((d == "") || FileSystem::exists(d)) { directoryArray.append(d); for (int i = 0; ! subdirs[i].empty(); ++i) { const std::string& p = pathConcat(d, subdirs[i]); if (FileSystem::exists(p)) { directoryArray.append(p); } } } } logLazyPrintf("Initializing System::findDataFile took %fs\n", System::time() - t0); } for (int i = 0; i < directoryArray.size(); ++i) { const std::string& p = pathConcat(directoryArray[i], full); if (FileSystem::exists(p)) { lastFound.set(full, p); return p; } } if (errorIfNotFound) { // Generate an error message std::string locations; for (int i = 0; i < directoryArray.size(); ++i) { locations += "\'" + pathConcat(directoryArray[i], full) + "'\n"; } std::string msg = "Could not find '" + full + "'.\n\n"; msg += "cwd = \'" + FileSystem::currentDirectory() + "\'\n"; if (g3dPath) { msg += "G3DDATA = "; if (! FileSystem::exists(g3dPath)) { msg += "(illegal path!) "; } msg += std::string(g3dPath) + "\'\n"; } else { msg += "(G3DDATA environment variable is undefined)\n"; } msg += "GApp::Settings.dataDir = "; if (! FileSystem::exists(initialAppDataDir)) { msg += "(illegal path!) "; } msg += std::string(initialAppDataDir) + "\'\n"; msg += "\nLocations searched:\n" + locations; alwaysAssertM(false, msg); } // Not found return ""; }
void SettingsManager::setCacheCleanerWindowSize(QByteArray newValue) { instance()->getSYSsettings()->setValue( ctn_KEY_CACHE_CLEANER_WINDOW_SIZE, newValue); instance()->getSYSsettings()->sync(); }