If I have a UI with a .atlas and a BitmapFont with a .atlas is there a simple way to combine these into one or do I have to merge them myself in a image file and manually offset all the elements in the combined .atlas to the correct position? It is doable manually but kinda tedious, and if there is a slight calculation error one might have to redo every position and/or size.
Yes you can! Just let TexturePacker do the packing work for you:
Put the BitmapFont's .png file in the same folder where TexturePacker reads your images to pack. The same folder where all the other images are
Put the BitmapFont's .fnt file in the same folder where your skin's .atlas file is (usually in the assets folder inside android project)
Refresh the assets folder in eclipse (just in case..)
Now you can use the Bitmap font in the styles.json, like for example:
com.badlogic.gdx.graphics.g2d.BitmapFont: {
default-font: { file: somefont.fnt }
}
Related
I'm new and don't really know how to phrase my question.
so in VSCode I'm trying to learn how to organize my files better.
I created new folders called Views, Styles and Img. Then I moved my loginform.html files into views, loginform.css into styles and the pictures into Img folder.
Now that means since I moved the html, css and images into views, styles and img folders I need to rewrite or reassign the code path in the html for any images or css links.
For ex the html file with img tag now reads (I added the Img folder path)
But the ouput still is giving me a 404 message and the html is not loading
What are all the steps I need within the html and css files to take when I move files into new folders. Sorry for the long explanation, I couldn't think of a way to shorten it lol
From what i understand your arborescence looks like this :
root
|Views/
|----loginform.html
|Styles/
|----loginform.css
|Img/
|----image1.jpg
|----image2.jpg
If you want to refer to loginform.css from loginform.html, you'll need to write :
href="../Styles/loginform.css"
Notice the "../" at the beginning, which means "get out of the 'Views' folder and then go to styles/loginform.css". You can even combine multiple ../ , for example "../../../" goes 3 parent folders back.
Your mistake, with href="Styles/loginform.css", is that there are no folder named "Styles" in your Views folder (where your HTML is sitting). You first need to get out of the Views folder.
I'm trying to use a jpeg that I have saved into a file as a background to a html file using its file path as the url. I have the following but it doesn't work. Any thoughts?
<style>
body {
background-image:url('C:\Users\...\background.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
}
ok, So giving relative path is very easy, only you need to understand the basic folder structure of your project, although I am not sure how you are keeping your files and folder structure so I will tell the ideal folder structure for front-end project (according to me), and will explain to you how you can use a relative path for assets,
let's keep the main HTML file in a folder named by your project, For example Peadar08 is the project name. so put an index.html file in your folder, and on the same level keep a folder for your assets, like this...
then in ASSETS folder create more folders for your respective assets(images, js, css etc), like this...
Now just see an example for images, and you can follow the same for other assets,
So you can use images in 2 ways,
As an IMAGE by img tag in your HTML, so keeping in mind the above stuture you can use images in your HTML like this.
<img src="assets/images/example.png" alt="altText"/>
So your image will render perfectly as assets and your HTML file is on the same level so just mention the path starting with the folder name.
now see another example if you need to use your image as a background image by CSS
so all you need to do is use of ../ to go one folder back, just because you are in css file and ../ this will take you one folder up, I.e in assets folder and then you can foloow the path. so in your CSS use this..
.ExampleClass {
background-image: url('../assets/images/example.png');
}
to move 2 folder up just use ../../ and so on.
Hope this will help you.
You don't need to specify location directly from the C:, but from the root directory in relation to where your index.html is.
You could just copy the link directly from where you found the image by right clicking the image in the browser and selecting 'Copy Image Address' and paste that in the image URL.
I am using cocos2d-x and cocosbuilder 3.0 alpha2. It is very convenient to use auto scaled sprites in cocosbuilder. You can add png files under resources-auto directory and content will be automatically scalled during publishing. You don't have to scale images programmatically.
I would like to use CCLabelBMFont for old and new iPhone. I was trying to use the same method for fnt files. I saved fnt files under resources-auto directory. Then I opened these resources by cocosbuilder and it crashed ;/
Where should I save these fnt files ? Should I create two version of fnt files (regular and retina) ? How to use CCLabelBMFonts for many display resolutions ?
First, I would strongly recommend updating to the latest version of CocosBuilder as it fixes some issues with the automatic resizing of assets.
CocosBuilder can only automatically resize image resources. To add support for different sized fonts you will need to place them (save different sizes from your font creation tool) in folders called resources-iphone, resources-iphonehd, resources-ipad or resources-ipadhd.
I just started learning Flex this week, and I cannot get an image path to work. My folders are as follows:
ProjectFolder
-src
--assets
--skins
-bin
My image is in assets, we can call it image_name.jpg and my skin is in the skins folder. How would I put it as the source of a bitmap in a custom skin?
Broken Attempt:
source="#Embed(source='/assets/image_name.jpg')"
as a property of a s:BitmapImage MXML tag.
Thanks!
Ok, you save the image in src/assets and use:
source="#Embed('assets/image_name.jpg')"
Source: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/primitives/BitmapImage.html#includeExamplesSummary
i'm trying to include a number of images in my SWF file not by loading them but by embedding them in the SWF itself. I found the following instruction to do that:
[Embed(source="../graphics/images/ss0.png")]
private var SS0:Class;
Basically, i want to embed a different number of images each time. Is there a way to do that automatically (let's say inside a for loop) or do i have to type manually this instruction for each image i want to include?
You could store all your PNG files in a single ZIP file, then use the FZip class to extract them. See the example of this on their site.