本文整理汇总了C++中TextureFrame类的典型用法代码示例。如果您正苦于以下问题:C++ TextureFrame类的具体用法?C++ TextureFrame怎么用?C++ TextureFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextureFrame类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: loadTextureFrameWithFlatBuffers
Frame* ActionTimelineCache::loadTextureFrameWithFlatBuffers(const flatbuffers::TimeLineTextureFrame *flatbuffers)
{
std::string path = "";
int resourceType = 0;
std::string plist = "";
TextureFrame* frame = TextureFrame::create();
auto fileNameData = flatbuffers->fileNameData();
resourceType = fileNameData->resourceType();
switch (resourceType)
{
case 0:
{
path = fileNameData->path()->c_str();
if (FileUtils::getInstance()->isFileExist(path))
{
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(path);
path = fullPath;
}
else
{
path = "";
}
break;
}
case 1:
{
plist = fileNameData->plistFile()->c_str();
if (FileUtils::getInstance()->isFileExist(plist))
{
path = fileNameData->path()->c_str();
}
else
{
path = "";
}
break;
}
default:
break;
}
frame->setTextureName(path);
int frameIndex = flatbuffers->frameIndex();
frame->setFrameIndex(frameIndex);
bool tween = flatbuffers->tween();
frame->setTween(tween);
return frame;
}
开发者ID:Ratel13,项目名称:cocos-reader,代码行数:57,代码来源:CCActionTimelineCache.cpp
示例2: clone
Frame* TextureFrame::clone()
{
TextureFrame* frame = TextureFrame::create();
frame->setTextureName(_textureName);
frame->cloneProperty(this);
return frame;
}
开发者ID:stonejiang208,项目名称:cocos2d-x,代码行数:9,代码来源:CCFrame.cpp
示例3: Variant
Variant SceneTreeEditor::get_drag_data_fw(const Point2& p_point,Control* p_from) {
if (!can_rename)
return Variant(); //not editable tree
Vector<Node*> selected;
Vector<Ref<Texture> > icons;
TreeItem *next=tree->get_next_selected(NULL);
while (next) {
NodePath np = next->get_metadata(0);
Node *n=get_node(np);
if (n) {
selected.push_back(n);
icons.push_back(next->get_icon(0));
}
next=tree->get_next_selected(next);
}
if (selected.empty())
return Variant();
VBoxContainer *vb = memnew( VBoxContainer );
Array objs;
int list_max = 10;
float opacity_step = 1.0f / list_max;
float opacity_item = 1.0f;
for(int i=0;i<selected.size();i++) {
if (i<list_max){
HBoxContainer *hb = memnew( HBoxContainer );
TextureFrame *tf = memnew(TextureFrame);
tf->set_texture(icons[i]);
hb->add_child(tf);
Label *label = memnew( Label( selected[i]->get_name() ) );
hb->add_child(label);
vb->add_child(hb);
hb->set_opacity(opacity_item);
opacity_item -= opacity_step;
}
NodePath p = selected[i]->get_path();
objs.push_back(p);
}
set_drag_preview(vb);
Dictionary drag_data;
drag_data["type"]="nodes";
drag_data["nodes"]=objs;
tree->set_drop_mode_flags(Tree::DROP_MODE_INBETWEEN|Tree::DROP_MODE_ON_ITEM);
emit_signal("nodes_dragged");
return drag_data;
}
开发者ID:WalasPrime,项目名称:godot,代码行数:55,代码来源:scene_tree_editor.cpp
示例4: new
// TextureFrame
TextureFrame* TextureFrame::create()
{
TextureFrame* frame = new (std::nothrow) TextureFrame();
if (frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return nullptr;
}
开发者ID:stonejiang208,项目名称:cocos2d-x,代码行数:12,代码来源:CCFrame.cpp
示例5: loadTextureFrame
Frame* ActionTimelineCache::loadTextureFrame(const rapidjson::Value& json)
{
TextureFrame* frame = TextureFrame::create();
const char* texture = DICTOOL->getStringValue_json(json, Value);
if(texture != NULL)
frame->setTextureName(texture);
return frame;
}
开发者ID:boruis,项目名称:cocos2dx-classical,代码行数:11,代码来源:CCActionTimelineCache.cpp
示例6: memnew
void EditorAssetLibrary::_notification(int p_what) {
if (p_what==NOTIFICATION_READY) {
TextureFrame *tf = memnew(TextureFrame);
tf->set_texture(get_icon("Error","EditorIcons"));
reverse->set_icon(get_icon("Updown","EditorIcons"));
error_hb->add_child(tf);
error_label->raise();
}
if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
if(!is_hidden()) {
_repository_changed(0); // Update when shown for the first time
}
}
if (p_what==NOTIFICATION_PROCESS) {
HTTPClient::Status s = request->get_http_client_status();
bool visible = s!=HTTPClient::STATUS_DISCONNECTED;
if (visible != !load_status->is_hidden()) {
load_status->set_hidden(!visible);
}
if (visible) {
switch(s) {
case HTTPClient::STATUS_RESOLVING: {
load_status->set_val(0.1);
} break;
case HTTPClient::STATUS_CONNECTING: {
load_status->set_val(0.2);
} break;
case HTTPClient::STATUS_REQUESTING: {
load_status->set_val(0.3);
} break;
case HTTPClient::STATUS_BODY: {
load_status->set_val(0.4);
} break;
default: {}
}
}
bool no_downloads = downloads_hb->get_child_count()==0;
if (no_downloads != downloads_scroll->is_hidden()) {
downloads_scroll->set_hidden(no_downloads);
}
}
}
开发者ID:Blake-Hudson,项目名称:godot,代码行数:53,代码来源:asset_library_editor_plugin.cpp
示例7: GetTextureFrameForCharacter
TextureFrame* BitmapFont::GetTextureFrameForCharacter(char aCharacter)
{
TextureFrame* textureFrame = nullptr;
CharacterData* characterData = m_CharacterData[aCharacter];
//Safety check the character data
if(characterData != nullptr)
{
textureFrame = m_TextureFrames[characterData->m_PageId];
textureFrame->SetSourceFrame(characterData->m_SourceFrame);
}
//Return the texture frame
return textureFrame;
}
开发者ID:Epidilius,项目名称:PhysicsHackAndSlash,代码行数:15,代码来源:BitmapFont.cpp
示例8: loadTextureFrame
Frame* ActionTimelineCache::loadTextureFrame(const rapidjson::Value& json)
{
TextureFrame* frame = TextureFrame::create();
const char* texture = DICTOOL->getStringValue_json(json, Value);
if(texture != nullptr)
{
std::string path = texture;
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(path);
if(spriteFrame == nullptr)
{
std::string jsonPath = CSLoader::getInstance()->getJsonPath();
path = jsonPath + texture;
}
frame->setTextureName(path);
}
return frame;
}
开发者ID:980538137,项目名称:MyGame-QuickCocos2dx,代码行数:21,代码来源:CCActionTimelineCache.cpp
示例9: while
void ProjectManager::_load_recent_projects() {
while(scroll_childs->get_child_count()>0) {
memdelete( scroll_childs->get_child(0));
}
List<PropertyInfo> properties;
EditorSettings::get_singleton()->get_property_list(&properties);
Color font_color = get_color("font_color","Tree");
for(List<PropertyInfo>::Element *E=properties.front();E;E=E->next()) {
String _name = E->get().name;
if (!_name.begins_with("projects/"))
continue;
String project = _name.get_slice("/",1);
String path = EditorSettings::get_singleton()->get(_name);
String conf=path.plus_file("engine.cfg");
Ref<ConfigFile> cf = memnew( ConfigFile );
Error err = cf->load(conf);
ERR_CONTINUE(err!=OK);
Ref<Texture> icon;
String project_name="Unnamed Project";
if (cf->has_section_key("application","icon")) {
String appicon = cf->get_value("application","icon");
if (appicon!="") {
Image img;
Error err = img.load(appicon.replace_first("res://",path+"/"));
if (err==OK) {
img.resize(64,64);
Ref<ImageTexture> it = memnew( ImageTexture );
it->create_from_image(img);
icon=it;
}
}
}
if (cf->has_section_key("application","name")) {
project_name = cf->get_value("application","name");
}
if (icon.is_null()) {
icon=get_icon("DefaultProjectIcon","EditorIcons");
}
String main_scene;
if (cf->has_section_key("application","main_scene")) {
main_scene = cf->get_value("application","main_scene");
}
HBoxContainer *hb = memnew( HBoxContainer );
hb->set_meta("name",project);
hb->set_meta("main_scene",main_scene);
hb->connect("draw",this,"_panel_draw",varray(hb));
hb->connect("input_event",this,"_panel_input",varray(hb));
TextureFrame *tf = memnew( TextureFrame );
tf->set_texture(icon);
hb->add_child(tf);
VBoxContainer *vb = memnew(VBoxContainer);
hb->add_child(vb);
EmptyControl *ec = memnew( EmptyControl );
ec->set_minsize(Size2(0,1));
vb->add_child(ec);
Label *title = memnew( Label(project_name) );
title->add_font_override("font",get_font("large","Fonts"));
title->add_color_override("font_color",font_color);
vb->add_child(title);
Label *fpath = memnew( Label(path) );
vb->add_child(fpath);
fpath->set_opacity(0.5);
fpath->add_color_override("font_color",font_color);
scroll_childs->add_child(hb);
}
erase_btn->set_disabled(selected=="");
open_btn->set_disabled(selected=="");
if (selected=="")
run_btn->set_disabled(true);
}
开发者ID:0871087123,项目名称:godot,代码行数:88,代码来源:project_manager.cpp
示例10: while
//.........这里部分代码省略.........
projects.sort();
favorite_projects.sort();
for(List<ProjectItem>::Element *E=projects.front();E;) {
List<ProjectItem>::Element *next = E->next();
if (favorite_projects.find(E->get()) != NULL)
projects.erase(E->get());
E=next;
}
for(List<ProjectItem>::Element *E=favorite_projects.back();E;E=E->prev()) {
projects.push_front(E->get());
}
Ref<Texture> favorite_icon = get_icon("Favorites","EditorIcons");
for(List<ProjectItem>::Element *E=projects.front();E;E=E->next()) {
ProjectItem &item = E->get();
String project = item.project;
String path = item.path;
String conf = item.conf;
bool is_favorite = item.favorite;
Ref<ConfigFile> cf = memnew( ConfigFile );
Error err = cf->load(conf);
ERR_CONTINUE(err!=OK);
Ref<Texture> icon;
String project_name="Unnamed Project";
if (cf->has_section_key("application","icon")) {
String appicon = cf->get_value("application","icon");
if (appicon!="") {
Image img;
Error err = img.load(appicon.replace_first("res://",path+"/"));
if (err==OK) {
img.resize(64,64);
Ref<ImageTexture> it = memnew( ImageTexture );
it->create_from_image(img);
icon=it;
}
}
}
if (cf->has_section_key("application","name")) {
project_name = cf->get_value("application","name");
}
if (icon.is_null()) {
icon=get_icon("DefaultProjectIcon","EditorIcons");
}
String main_scene;
if (cf->has_section_key("application","main_scene")) {
main_scene = cf->get_value("application","main_scene");
}
HBoxContainer *hb = memnew( HBoxContainer );
hb->set_meta("name",project);
hb->set_meta("main_scene",main_scene);
hb->set_meta("favorite",is_favorite);
hb->connect("draw",this,"_panel_draw",varray(hb));
hb->connect("input_event",this,"_panel_input",varray(hb));
VBoxContainer *favorite_box = memnew( VBoxContainer );
TextureButton *favorite = memnew( TextureButton );
favorite->set_normal_texture(favorite_icon);
if (!is_favorite)
favorite->set_opacity(0.2);
favorite->set_v_size_flags(SIZE_EXPAND);
favorite->connect("pressed",this,"_favorite_pressed",varray(hb));
favorite_box->add_child(favorite);
hb->add_child(favorite_box);
TextureFrame *tf = memnew( TextureFrame );
tf->set_texture(icon);
hb->add_child(tf);
VBoxContainer *vb = memnew(VBoxContainer);
hb->add_child(vb);
EmptyControl *ec = memnew( EmptyControl );
ec->set_minsize(Size2(0,1));
vb->add_child(ec);
Label *title = memnew( Label(project_name) );
title->add_font_override("font",get_font("large","Fonts"));
title->add_color_override("font_color",font_color);
vb->add_child(title);
Label *fpath = memnew( Label(path) );
vb->add_child(fpath);
fpath->set_opacity(0.5);
fpath->add_color_override("font_color",font_color);
scroll_childs->add_child(hb);
}
erase_btn->set_disabled(selected_list.size()<1);
open_btn->set_disabled(selected_list.size()<1);
run_btn->set_disabled(selected_list.size()<1 || (selected_list.size()==1 && single_selected_main==""));
}
开发者ID:9cat,项目名称:godot,代码行数:101,代码来源:project_manager.cpp
示例11: while
//.........这里部分代码省略.........
ProjectItem &item = E->get();
String project = item.project;
String path = item.path;
String conf = item.conf;
bool is_favorite = item.favorite;
Ref<ConfigFile> cf = memnew( ConfigFile );
Error err = cf->load(conf);
ERR_CONTINUE(err!=OK);
String project_name=TTR("Unnamed Project");
if (cf->has_section_key("application","name")) {
project_name = static_cast<String>(cf->get_value("application","name")).xml_unescape();
}
if (filter_option==ProjectListFilter::FILTER_NAME && search_term!="" && project_name.findn(search_term)==-1)
continue;
Ref<Texture> icon;
if (cf->has_section_key("application","icon")) {
String appicon = cf->get_value("application","icon");
if (appicon!="") {
Image img;
Error err = img.load(appicon.replace_first("res://",path+"/"));
if (err==OK) {
img.resize(64,64);
Ref<ImageTexture> it = memnew( ImageTexture );
it->create_from_image(img);
icon=it;
}
}
}
if (icon.is_null()) {
icon=get_icon("DefaultProjectIcon","EditorIcons");
}
String main_scene;
if (cf->has_section_key("application","main_scene")) {
main_scene = cf->get_value("application","main_scene");
}
selected_list_copy.erase(project);
HBoxContainer *hb = memnew( HBoxContainer );
hb->set_meta("name",project);
hb->set_meta("main_scene",main_scene);
hb->set_meta("favorite",is_favorite);
hb->connect("draw",this,"_panel_draw",varray(hb));
hb->connect("input_event",this,"_panel_input",varray(hb));
hb->add_constant_override("separation",10*EDSCALE);
VBoxContainer *favorite_box = memnew( VBoxContainer );
TextureButton *favorite = memnew( TextureButton );
favorite->set_normal_texture(favorite_icon);
if (!is_favorite)
favorite->set_opacity(0.2);
favorite->set_v_size_flags(SIZE_EXPAND);
favorite->connect("pressed",this,"_favorite_pressed",varray(hb));
favorite_box->add_child(favorite);
hb->add_child(favorite_box);
TextureFrame *tf = memnew( TextureFrame );
tf->set_texture(icon);
hb->add_child(tf);
VBoxContainer *vb = memnew(VBoxContainer);
hb->add_child(vb);
Control *ec = memnew( Control );
ec->set_custom_minimum_size(Size2(0,1));
vb->add_child(ec);
Label *title = memnew( Label(project_name) );
title->add_font_override("font", gui_base->get_font("large","Fonts"));
title->add_color_override("font_color",font_color);
vb->add_child(title);
Label *fpath = memnew( Label(path) );
vb->add_child(fpath);
fpath->set_opacity(0.5);
fpath->add_color_override("font_color",font_color);
scroll_childs->add_child(hb);
}
for (Map<String,String>::Element *E = selected_list_copy.front();E;E = E->next()) {
String key = E->key();
selected_list.erase(key);
}
scroll->set_v_scroll(0);
_update_project_buttons();
EditorSettings::get_singleton()->save();
tabs->set_current_tab(0);
}
开发者ID:SPTelur,项目名称:godot,代码行数:101,代码来源:project_manager.cpp
注:本文中的TextureFrame类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论