国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Godot 4 源碼分析 - 獲取腳本

這篇具有很好參考價(jià)值的文章主要介紹了Godot 4 源碼分析 - 獲取腳本。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

獲取屬性列表

今天摟草打兔,取得了腳本內(nèi)容

因?yàn)橐涯苋〉脤傩灾担蔷驮龠M(jìn)一步,取得屬性名列表

if (SameText(drGet.propertyName, "propertyNames", DRGRAPH_FLAG_CASESENSITIVE)) {
	List<PropertyInfo> *p_list = new List<PropertyInfo>;
	bool p_reversed = true;
	destObject->get_property_list(p_list, p_reversed);
	cofs << "OK";
	for (List<PropertyInfo>::Iterator it = p_list->begin(); it != p_list->end(); ++it) {
		Variant value = destObject->get(it->name);
		cofs << str_format(U"%s[%s] = %s", it->name.utf8().get_data(),
			VarType2String(it->type).c_str(), value.operator String().utf8().get_data());
	}
	delete p_list;
	cofs << GetObjectHint(destObject);	
}

相應(yīng)地,可以取得函數(shù)名列表、子對(duì)象列表

if (SameText(drGet.propertyName, "methodNames", DRGRAPH_FLAG_CASESENSITIVE)) {
	List<MethodInfo> *p_list = new List<MethodInfo>;
	destObject->get_method_list(p_list);
	cofs << "OK";
	for (List<MethodInfo>::Iterator it = p_list->begin(); it != p_list->end(); ++it) {
		String content = it->name + "(";
		for (List<PropertyInfo>::Iterator iter = it->arguments.begin(); iter != it->arguments.end(); ++iter) {
			if (iter != it->arguments.begin())
				content += ", ";
			content += str_format("%s %s", VarType2String(iter->type).c_str(), iter->name.utf8().get_data()).c_str();
		}
		content += ")";
		cofs << content;
	}
	delete p_list;
	cofs << GetObjectHint(destObject);	
}
if (SameText(drGet.propertyName, "childNames", DRGRAPH_FLAG_CASESENSITIVE)) {
	if (Node *node = dynamic_cast<Node *>(destObject)) {
		int count = node->get_child_count();
		for (int i = 0; i < count; ++i) {
			Node *subNode = node->get_child(i);
			cofs << str_format(U"%s[%s]", subNode->get_name().operator String().utf8().get_data(),
					subNode->get_class_name().operator String().utf8().get_data());
		}
		cofs << GetObjectHint(destObject);
	}
}

其中,獲取對(duì)象信息(GetObjectHint)是期望能顯示對(duì)象的一些相應(yīng)信息

#define CAST(T, ptr) dynamic_cast<T>(static_cast<T>(ptr))
std::string GetObjectHint(void* ptr) {
	String result = U"未處理對(duì)象";
	if (Object *object = CAST(Object *, ptr)) {
		result = str_format(U" ---==== [%s]類型對(duì)象 0X%08x ====---", object->get_class_name().operator String().utf8().get_data(), int(ptr));
		if (Node *node = CAST(Node *, ptr)) {
			String path = node->get_name();
			Node *parent = node->get_parent();
			while (parent) {
				path = parent->get_name().operator String() + U"." + path;
				parent = parent->get_parent();
			}
			result += U":\n\t\t\t\t\t\t路徑信息:";
			result += path + U"\n\t\t\t\t\t\t子對(duì)象信息:";
			int count = node->get_child_count();
			for (int i = 0; i < count; ++i) {
				Node *subNode = node->get_child(i);
				result += str_format(U" %s[%s]", String2std(subNode->get_name().operator String()).c_str(),
						String2std(subNode->get_class_name().operator String()).c_str());
			}
		}
	} else if (Engine *engine = CAST(Engine *, ptr)) {
		result = str_format(U"[Engine]類型對(duì)象 0X%08x", int(ptr));
	}
	return String2std(result);
}

測試一下,取得根節(jié)點(diǎn)(Book)的所有屬性名: Book.propertyNames

261. 15:58:53:368 > 【主線程】 > [Pipe.發(fā)送] > 發(fā)送數(shù)據(jù)中內(nèi)容[DrGraph.78: Request - wait 1000 ms]: 
	[int]類型 > 值 = 2
	[UnicodeString]類型 > 值 = Book
	[UnicodeString]類型 > 值 = propertyNames
262. 15:58:53:614 > 【主線程】 > [Pipe.Read] > 發(fā)送數(shù)據(jù)[DrGraph.78: Request - wait 1000 ms]成功返回 2396 字節(jié)... > PIPE響應(yīng)中內(nèi)容[godot -> DrGraph.78: Response - no return]: 
	[int]類型 > 值 = 3
	[UnicodeString]類型 > 值 = OK
	[UnicodeString]類型 > 值 = book.gd[NIL] = <null>
	[UnicodeString]類型 > 值 = singlePage[BOOL] = false
	[UnicodeString]類型 > 值 = middleBarWidth[INT] = 0
	[UnicodeString]類型 > 值 = shader_rect[OBJECT] = ShaderRect:<ColorRect#26944209309>
	[UnicodeString]類型 > 值 = currentPageMode[BOOL] = false
	[UnicodeString]類型 > 值 = currentAreaType[INT] = 5
	[UnicodeString]類型 > 值 = triggleAreaMoment[INT] = 745493
	[UnicodeString]類型 > 值 = currentPageIndex[INT] = 30
	[UnicodeString]類型 > 值 = pageCount[INT] = 100
	[UnicodeString]類型 > 值 = pageImgPath[STRING] = res://Pages/
	[UnicodeString]類型 > 值 = leftMouseDownMoment[INT] = 0
	[UnicodeString]類型 > 值 = underAutoTurnPage[BOOL] = false
	[UnicodeString]類型 > 值 = leftMouseDownPos[VECTOR2] = (0, 0)
	[UnicodeString]類型 > 值 = dllStream[OBJECT] = <DllStream#67024979098>
	[UnicodeString]類型 > 值 = AutoTurnObject[OBJECT] = <RefCounted#-9223372009692462686>
	[UnicodeString]類型 > 值 = Node2D[NIL] = <null>
	[UnicodeString]類型 > 值 = Transform[NIL] = <null>
	[UnicodeString]類型 > 值 = position[VECTOR2] = (0, 0)
	[UnicodeString]類型 > 值 = rotation[FLOAT] = 0
	[UnicodeString]類型 > 值 = rotation_degrees[FLOAT] = 0
	[UnicodeString]類型 > 值 = scale[VECTOR2] = (1, 1)
	[UnicodeString]類型 > 值 = skew[FLOAT] = 0
	[UnicodeString]類型 > 值 = transform[TRANSFORM2D] = [X: (1, 0), Y: (0, 1), O: (0, 0)]
	[UnicodeString]類型 > 值 = global_position[VECTOR2] = (0, 0)
	[UnicodeString]類型 > 值 = global_rotation[FLOAT] = 0
	[UnicodeString]類型 > 值 = global_rotation_degrees[FLOAT] = 0
	[UnicodeString]類型 > 值 = global_scale[VECTOR2] = (1, 1)
	[UnicodeString]類型 > 值 = global_skew[FLOAT] = 0
	[UnicodeString]類型 > 值 = global_transform[TRANSFORM2D] = [X: (1, 0), Y: (0, 1), O: (0, 0)]
	[UnicodeString]類型 > 值 = CanvasItem[NIL] = <null>
	[UnicodeString]類型 > 值 = Visibility[NIL] = <null>
	[UnicodeString]類型 > 值 = visible[BOOL] = true
	[UnicodeString]類型 > 值 = modulate[COLOR] = (1, 1, 1, 1)
	[UnicodeString]類型 > 值 = self_modulate[COLOR] = (1, 1, 1, 1)
	[UnicodeString]類型 > 值 = show_behind_parent[BOOL] = false
	[UnicodeString]類型 > 值 = top_level[BOOL] = false
	[UnicodeString]類型 > 值 = clip_children[INT] = 0
	[UnicodeString]類型 > 值 = light_mask[INT] = 1
	[UnicodeString]類型 > 值 = visibility_layer[INT] = 1
	[UnicodeString]類型 > 值 = Ordering[NIL] = <null>
	[UnicodeString]類型 > 值 = z_index[INT] = 0
	[UnicodeString]類型 > 值 = z_as_relative[BOOL] = true
	[UnicodeString]類型 > 值 = y_sort_enabled[BOOL] = false
	[UnicodeString]類型 > 值 = Texture[NIL] = <null>
	[UnicodeString]類型 > 值 = texture_filter[INT] = 0
	[UnicodeString]類型 > 值 = texture_repeat[INT] = 0
	[UnicodeString]類型 > 值 = Material[NIL] = <null>
	[UnicodeString]類型 > 值 = material[OBJECT] = <Object#null>
	[UnicodeString]類型 > 值 = use_parent_material[BOOL] = false
	[UnicodeString]類型 > 值 = Node[NIL] = <null>
	[UnicodeString]類型 > 值 = _import_path[NODE_PATH] = 
	[UnicodeString]類型 > 值 = name[STRING_NAME] = Book
	[UnicodeString]類型 > 值 = unique_name_in_owner[BOOL] = false
	[UnicodeString]類型 > 值 = scene_file_path[STRING] = res://book.tscn
	[UnicodeString]類型 > 值 = owner[OBJECT] = <Object#null>
	[UnicodeString]類型 > 值 = multiplayer[OBJECT] = <SceneMultiplayer#-9223372011168857674>
	[UnicodeString]類型 > 值 = Process[NIL] = <null>
	[UnicodeString]類型 > 值 = process_mode[INT] = 0
	[UnicodeString]類型 > 值 = process_priority[INT] = 0
	[UnicodeString]類型 > 值 = Editor Description[NIL] = <null>
	[UnicodeString]類型 > 值 = editor_description[STRING] = 
	[UnicodeString]類型 > 值 = script[OBJECT] = <GDScript#-9223372010984308353>
	[UnicodeString]類型 > 值 =  ---==== [Node2D]類型對(duì)象 0X4d7c5600 ====---:
						路徑信息:root.Book
						子對(duì)象信息: LeftPage[Sprite2D] RightPage[Sprite2D] ShaderRect[ColorRect] LeftButton[Button] RightButton[Button] AutoTurnTimer[Timer] DrGraph[Node]

看到script屬性:[UnicodeString]類型 > 值 = script[OBJECT] = <GDScript#-9223372010984308353>

那就再取得Book.script.propertyNames來看下,結(jié)果發(fā)現(xiàn)返回了腳本內(nèi)容

Godot 4 源碼分析 - 獲取腳本,godot,windows,linux

仔細(xì)一看,是屬性 script/source?的值。那就單獨(dú)看一下該屬性: Book.script.script/source,果然得到相應(yīng)腳本內(nèi)容

Godot 4 源碼分析 - 獲取腳本,godot,windows,linux

倒是有點(diǎn)意思,屬性名稱為 script/source

源碼分析

在源碼中查找?script/source,在gdscript.cpp中有兩處,應(yīng)該是這個(gè)

void GDScript::_get_property_list(List<PropertyInfo> *p_properties) const {
	p_properties->push_back(PropertyInfo(Variant::STRING, "script/source", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL));
}

原來GDScript對(duì)象返回屬性名稱列表時(shí),就添加了這么一個(gè)玩意

這樣取屬性名稱列表時(shí),就有一個(gè)名為?script/source?的屬性

下來看看get該屬性時(shí)具體有哪些動(dòng)作,調(diào)試跟進(jìn)

Variant Object::get(const StringName &p_name, bool *r_valid) const {
	Variant ret;

	if (script_instance) {
		if (script_instance->get(p_name, ret)) {
			if (r_valid) {
				*r_valid = true;
			}
			return ret;
		}
	}
	if (_extension && _extension->get) {
// C style pointer casts should never trigger a compiler warning because the risk is assumed by the user, so GCC should keep quiet about it.
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
#endif

		if (_extension->get(_extension_instance, (const GDExtensionStringNamePtr)&p_name, (GDExtensionVariantPtr)&ret)) {
			if (r_valid) {
				*r_valid = true;
			}
			return ret;
		}
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
	}

	// Try built-in getter.
	{
		if (ClassDB::get_property(const_cast<Object *>(this), p_name, ret)) {
			if (r_valid) {
				*r_valid = true;
			}
			return ret;
		}
	}

	if (p_name == CoreStringNames::get_singleton()->_script) {
		ret = get_script();
		if (r_valid) {
			*r_valid = true;
		}
		return ret;
	}

	const Variant *const *V = metadata_properties.getptr(p_name);

	if (V) {
		ret = **V;
		if (r_valid) {
			*r_valid = true;
		}
		return ret;

	} else {
#ifdef TOOLS_ENABLED
		if (script_instance) {
			bool valid;
			ret = script_instance->property_get_fallback(p_name, &valid);
			if (valid) {
				if (r_valid) {
					*r_valid = true;
				}
				return ret;
			}
		}
#endif
		// Something inside the object... :|
		bool success = _getv(p_name, ret);
		if (success) {
			if (r_valid) {
				*r_valid = true;
			}
			return ret;
		}

		if (r_valid) {
			*r_valid = false;
		}
		return Variant();
	}
}

具體是在?bool success = _getv(p_name, ret);?中處理,直接在GDScript::_get中實(shí)質(zhì)處理

bool GDScript::_get(const StringName &p_name, Variant &r_ret) const {
	{
		const GDScript *top = this;
		while (top) {
			{
				HashMap<StringName, Variant>::ConstIterator E = top->constants.find(p_name);
				if (E) {
					r_ret = E->value;
					return true;
				}
			}

			{
				HashMap<StringName, Ref<GDScript>>::ConstIterator E = subclasses.find(p_name);
				if (E) {
					r_ret = E->value;
					return true;
				}
			}
			top = top->_base;
		}

		if (p_name == GDScriptLanguage::get_singleton()->strings._script_source) {
			r_ret = get_source_code();
			return true;
		}
	}

	return false;
}

調(diào)試可知,在constants中,保存了各常量信息[key / value]

Godot 4 源碼分析 - 獲取腳本,godot,windows,linux

?而subclasses中保存了自定義的結(jié)構(gòu)(類)

Godot 4 源碼分析 - 獲取腳本,godot,windows,linux

?最終在get_source_code函數(shù)中,直接返回source

String GDScript::get_source_code() const {
	return source;
}

也就是腳本文本內(nèi)容。

就這。

獲取腳本中變量值

從上面可看到屬性獲取邏輯,在script/source屬性獲取過程中,檢查了constants和subclasses,那試試能否獲取其中的變量值

發(fā)送Book.script.AREA_OUT,結(jié)果成功

Godot 4 源碼分析 - 獲取腳本,godot,windows,linux

自定義結(jié)構(gòu)

繼續(xù)測試自定義結(jié)構(gòu)

發(fā)送Book.script.TAutoTurn,結(jié)果返回為對(duì)象:?<GDScript#-9223372010833313372>

279. 16:18:07:517 > 【主線程】 > [Pipe.發(fā)送] > 發(fā)送數(shù)據(jù)中內(nèi)容[DrGraph.87: Request - wait 1000 ms]: 
	[int]類型 > 值 = 2
	[UnicodeString]類型 > 值 = Book.script
	[UnicodeString]類型 > 值 = TAutoTurn
280. 16:18:07:617 > 【主線程】 > [Pipe.Read] > 發(fā)送數(shù)據(jù)[DrGraph.87: Request - wait 1000 ms]成功返回 168 字節(jié)... > PIPE響應(yīng)中內(nèi)容[godot -> DrGraph.87: Response - no return]: 
	[int]類型 > 值 = 3
	[UnicodeString]類型 > 值 = OK
	[UnicodeString]類型 > 值 = <GDScript#-9223372010833313372>

檢查該對(duì)象屬性名列表

281. 16:18:21:175 > 【主線程】 > [Pipe.發(fā)送] > 發(fā)送數(shù)據(jù)中內(nèi)容[DrGraph.88: Request - wait 1000 ms]: 
	[int]類型 > 值 = 2
	[UnicodeString]類型 > 值 = Book.script.TAutoTurn
	[UnicodeString]類型 > 值 = propertyNames
282. 16:18:21:272 > 【主線程】 > [Pipe.Read] > 發(fā)送數(shù)據(jù)[DrGraph.88: Request - wait 1000 ms]成功返回 423 字節(jié)... > PIPE響應(yīng)中內(nèi)容[godot -> DrGraph.88: Response - no return]: 
	[int]類型 > 值 = 3
	[UnicodeString]類型 > 值 = OK
	[UnicodeString]類型 > 值 = GDScript[NIL] = <null>
	[UnicodeString]類型 > 值 = script/source[STRING] = 
	[UnicodeString]類型 > 值 = Script[NIL] = <null>
	[UnicodeString]類型 > 值 = source_code[STRING] = 
	[UnicodeString]類型 > 值 = Resource[NIL] = <null>
	[UnicodeString]類型 > 值 = Resource[NIL] = <null>
	[UnicodeString]類型 > 值 = resource_local_to_scene[BOOL] = false
	[UnicodeString]類型 > 值 = resource_path[STRING] = 
	[UnicodeString]類型 > 值 = resource_name[STRING] = 
	[UnicodeString]類型 > 值 = RefCounted[NIL] = <null>
	[UnicodeString]類型 > 值 =  ---==== [GDScript]類型對(duì)象 0X4d771310 ====---:
						路徑信息:
						子對(duì)象信息:

也有script/source、source_code屬性,不過好象沒內(nèi)容,測試也還是真沒內(nèi)容返回

Godot 4 源碼分析 - 獲取腳本,godot,windows,linux

?但能取得這些信息,感覺已經(jīng)足夠用的了文章來源地址http://www.zghlxwxcb.cn/news/detail-606137.html

到了這里,關(guān)于Godot 4 源碼分析 - 獲取腳本的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Godot 4 源碼分析 - Path2D與PathFollow2D

    Godot 4 源碼分析 - Path2D與PathFollow2D

    學(xué)習(xí)演示項(xiàng)目dodge_the_creeps,發(fā)現(xiàn)里面多了一個(gè)Path2D與PathFollow2D ?研究GDScript代碼發(fā)現(xiàn),它主要用于隨機(jī)生成Mob 這個(gè)有這么大的作用,不明覺厲 但不知道如何下手 查看源碼,有編輯器及類源碼 先從應(yīng)用角度,到B站上找找有沒有視頻,結(jié)果發(fā)現(xiàn)這個(gè) Godot塔防游戲 - 01 -核心路徑

    2024年02月14日
    瀏覽(24)
  • 如何在godot中使用python作為腳本

    Godot支持使用Python作為腳本語言。可以通過以下步驟在Godot中使用Python: 在Godot引擎下載頁面下載并安裝最新版本的Godot,確保安裝了Python支持。 在Godot編輯器中,打開“設(shè)置”菜單,選擇“語言”,然后將“腳本語言”更改為“Python”。 創(chuàng)建一個(gè)新的節(jié)點(diǎn),右鍵單擊它,選擇

    2024年02月08日
    瀏覽(27)
  • Godot的幾個(gè)附加腳本和進(jìn)行繼承時(shí)比較特別的特性

    Godot的幾個(gè)附加腳本和進(jìn)行繼承時(shí)比較特別的特性

    注: 這是在Godot4.0中總結(jié)出的內(nèi)容,并且語言是C#。 特別的,下面有的特性和C#關(guān)系比較大。 在Godot中,為某個(gè)節(jié)點(diǎn)編寫特別的代碼時(shí),需要為節(jié)點(diǎn)新建腳本,或引用已有腳本。 引用腳本時(shí),填入腳本路徑即可,相當(dāng)于是復(fù)用代碼了。 新建腳本時(shí),一般做法是新建一個(gè)自定義類型,并且這

    2024年02月07日
    瀏覽(16)
  • godot引擎c++源碼深度解析系列二

    記錄每次研究源碼的突破,今天已經(jīng)將打字練習(xí)的功能完成了一個(gè)基本模型,先來看下運(yùn)行效果。 godot源碼增加打字練習(xí)的demo 這個(gè)里面需要研究以下c++的控件頁面的開發(fā)和熟悉,畢竟好久沒有使用c++了,先來看以下代碼吧。 就這樣就實(shí)現(xiàn)了文本框,輸入框和按鈕的實(shí)現(xiàn),以

    2024年02月15日
    瀏覽(24)
  • 【windows測試通過】關(guān)于Godot導(dǎo)入外部音頻文件的問題

    【windows測試通過】關(guān)于Godot導(dǎo)入外部音頻文件的問題

    代碼給出,還沒有測試過。(godot3.2測試未通過) 在運(yùn)行時(shí)輕松加載外部音頻 (WAV) 文件 ·問題 #732 ·Godotengine/Godot-proposals(戈多引擎) (github.com) 我給出的辦法(windos測試通過) 1. 先把外部音頻文件在游戲開發(fā)的時(shí)候?qū)朐趃odot的res://目錄下,然后復(fù)制導(dǎo)入后的.imoprt/文件夾

    2024年02月16日
    瀏覽(24)
  • Godot引擎 4.0 文檔 - 入門介紹 - Godot簡介

    Godot引擎 4.0 文檔 - 入門介紹 - Godot簡介

    本文旨在幫助您確定 Godot 是否適合您。我們將介紹該引擎的一些廣泛功能,讓您了解使用它可以實(shí)現(xiàn)什么,并回答諸如“我需要了解什么才能開始使用?”等問題。 這絕不是詳盡的概述。我們將在本入門系列中介紹更多功能。 Godot 是一個(gè)通用的 2D 和 3D 游戲引擎,您還可以

    2024年02月05日
    瀏覽(98)
  • 【Godot4自學(xué)手冊(cè)】第一節(jié)配置Godot運(yùn)行環(huán)境

    【Godot4自學(xué)手冊(cè)】第一節(jié)配置Godot運(yùn)行環(huán)境

    各位同學(xué)大家好!我是相信神話,從今天開始,我開始自學(xué)2D游戲開發(fā),用到的是Godot4。我準(zhǔn)備用視頻記錄整個(gè)開發(fā)過程,為自學(xué)2D開發(fā)的同學(xué)趟趟路。讓我們開始吧。 首先介紹一下Godot是什么東西,在2D游戲開發(fā)中是干啥的? Godot是一款自由開源、由社區(qū)驅(qū)動(dòng)的 2D 和 3D 游戲

    2024年01月23日
    瀏覽(35)
  • 【Godot測試】【在Godot中添加VRM模型和VMD動(dòng)畫并播放】

    【Godot測試】【在Godot中添加VRM模型和VMD動(dòng)畫并播放】

    觀看本文最好是有點(diǎn)GD腳本編程基礎(chǔ) 如果沒有,請(qǐng)看:https://www.bilibili.com/video/BV1PJ411i7hK 需要的Godot版本不推薦超過3.3.3,因?yàn)閷?shí)測當(dāng)前最新的3.5標(biāo)準(zhǔn)版崩掉了 要問什么,那當(dāng)然是作者插件發(fā)布日期推算出的版本號(hào)就是3.3.3或以下 已經(jīng)測試Godot_v3.3.2-stable_win64和Godot_v3.3.3-stable

    2024年02月08日
    瀏覽(51)
  • Godot 單元測試

    Godot 單元測試

    單元測試是我們常用的功能,Godot作為一個(gè)游戲,單元測試和熱重載是我們常用的功能。這里我們講解最簡單的單元測試的情況。 我們添加一個(gè)最簡單的節(jié)點(diǎn),掛載一個(gè)最簡單的腳本。 運(yùn)行成功!

    2024年02月08日
    瀏覽(20)
  • Godot中的錨點(diǎn)

    Godot中的錨點(diǎn)

    關(guān)于錨點(diǎn)的用處,Godot的官方文檔是如此敘述的。 如果一個(gè)游戲總是用同一分辨率在同樣的設(shè)備上運(yùn)行, 擺放控件將是一個(gè)簡單的事, 只要逐個(gè)設(shè)置它們的位置屬性和大小屬性即可. 不幸的是, 能像這樣處理的情況很少. 在游戲開發(fā)中,處理不同分辨率和縱橫比的屏幕可以是一項(xiàng)

    2024年02月10日
    瀏覽(27)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包