Cursor loading issue - xna

I have a few questions about a custom cursor in XNA, because I'm new.
I'm using:
cursorTex = Content.Load<Texture2D>("ico.png");
where cursorTex is a 2D Texture to load the cursor. However, it says file not found - even though it is in my Content directory. What's wrong and how do I fix this?
How can I set onMouseOver on certain buttons to react to change the cursor's image? And also, how do I change the image when the user is holding click?

Load the texture as
cursorTex = Content.Load<Texture2D>("ico");
instead of
cursorTex = Content.Load<Texture2D>("ico.png");
Edit: seeing you placed your file in a folder, just load it as ...<Texture2D>("other/ico");

Related

Object disappear from Scene

I use SceneKit to construct a 3D Scene, which contains a few object. I convert all the COLLADA file and OBJ file to SCN file. Then I use a blank SCN file to put all the object together.
It looks fine in SceneEditor. And it runs on iPad. Everything looks exactly like it was in the SceneEditor.
Then I come up with some idea with the scale of one object. I change it in the property bar. It looks nice at the SceneEditor. And I tried to run it again.
Then boooom.
There was only one object left in the scene. Everything was gone. I can see all the object on SceneEditor. They just not show up on my iPad.
This happens all the time -- after I change any property of any object on the scene, the scene went wrong.
So far I was trying to build a new SCN file again with all those objects. But as the project gets bigger this might be a nightmare.
What is going on? Do you guys have any solution?
UPDATE:
I've notice that the Full Path of the normal SCN files I add in the scene look like: "/xxx.scn". But after some editing, it automatically changed to "xxx.scn" without slash. I think this may be the reason why objects disappear. The wrong path leads to nil and BANG.
Everytime when I use "Quick View" it will automatically change the Full Path. Even if I don't do anything.
I tried to relocate the file but the Full Path stay with no slash. PLS someone help me with it.

Refresh Bitmap Firemonkey

I use Delphi 10.2 Tokyo, and I have a TForm with a TImage.
I load a PNG file to MultiResBitmap property and set WrapMode to Fit.
When I run my application and click on a button, I need to change this picture and load a JPG file.
I use Image.Bitmap.LoadFromFile if the file is on the harddrive or Image.Bitmap.LoadFromStream if the JPG file is from a WebService (Get from IdHTTP). Both are on a Try...Finally with Image.BeginUpdate and Image.EndUpdate;
That's ok I see my new picture but the bottom isn't really good, I see a part of the previous picture. I need to move the TForm outside of my screen to see it full.
I try Image.Repaint at the end or to Clear the Bitmap before load the new file with Image.Bitmap.Clear(TAlphaColors.White) but that's change nothing.
Somebody know why ?
Edit: I forgot to say that TransparentColor is set on White.
First:
Second:
After moving out of screen :
Just do it as:
Image1.MultiResBitmap[0].Bitmap.LoadFromFile('Location\Image.jpg');
Try without BeginUpdate and EndUpdate.

Using PDFs for icon images in Xcode 7.2

I'm attempting to use PDF files as icons in an app I'm working on. The issue I'm encountering is I'm getting inconsistent tint colors.
If I set a button image from interface builder, the icon image shows up black at runtime. Every time. Regardless of what I attempt to set from interface builder.
I tried setting my button icon image via code and instead of showing up black, it's white:
let myGraphicFile = UIImage(named: "myPDFImage")
let myButtonImage = myGraphicFile?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate)
myButton.setImage(myButtonImage, forState: .Normal)
From code, regardless of what I attempt to set the tint to, it's always white from code.
I discovered this post relating to Xcode 6.x, but I think it might be dated, as I'm able to partially do it, but I can't set the tint.
Use PDF in XCode for an AppIcon (.appiconset collection)
I create the icons in Inkscape, save as PDF 1.5. I add the file to Images.xcassets. In Images.xcassets' attributes inspector, I'm setting:
Devices to Universal
Scale factor to Single Vector.
Summary: I can get it to show up and scale properly, but it's either black from interface builder or white from code. I suspect I'm missing something re: how to save the file from Inkscape.
Thank you for reading. If you have any suggestions, I welcome them.
I have figured out how to create vector icons with Inkscape. When you use PDFs to display icons in iOS, you need to alter the Attributes Inspector for your icon in xcAssets as follows:
1) Drag the PDF into xcAssets
2) Set devices (I did Universal and it worked fine)
3) If your PDF icon is under 1x, 2x, or 3x size class, drag it to Universal and delete the rest of them.
4) Set Scale Factors to Single Vector.
5) Render as Template Image.
Once it's configured there, then you just treat it was you would any other image in interface builder. It's essentially the same thing I was doing in code, but I don't think it gets done in code...it's gotta be done on xcAssets where the image lives. It's my understanding iOS renders vector images for the size class at run time. I think by attempting to tweak it in code wasn't working because the image had already been rendered.
If anyone has any questions on this, I found this link helpful in resolving my issue.
Additionally, this post covers the topic, too. https://stackoverflow.com/a/25804358/4475605

How to make an image clickable in jira comment, so it pops up as if you click on attached image in attachment area?

I'm talking desktop browser experience, e.g. chrome.
In jira, if I attach the image I can use it in my comment - and it's great!
I usually use width=800px so the whole image can be seen in the comment.
So I can write something like this:
Here's the screenshot
!my-screenshot-image.jpg|width=600px!
The problem is that sometimes screenshot is too big and when shrunk to smaller size, e.g. 600px, is not readable.
When you click on the image in attached files area then it pops up and this is what I want in the comment section.
I was wondering if there's any parameter that would make it happen?
Is there a list of parameters that can be used when "embedding" image somewhere? I only seem to find width parameter.
P.S. When you open jira ticket on mobile - it looks fine and image is actually clickable - when you click on it it opens up a page with just image in it.
You want this to allow a small image in the comment to be expanded into a larger light box view:
!my-screenshot-image.jpg|thumbnail!
Per the source for JIRA 6.3, the following are also valid attributes for images:
align
border
bordercolor
alt
title
longdesc
height
width
src
lang
dir
hspace
vspace
ismap
usemap
id
class
This one works for me.
!my-screenshot-image.jpg|thumbnail,
width=800px!

TabSheet does not display images

Is there any reason why images are not being displayed if I place it into tabsheet? Just shows white background instead.
If you are creating them at run-time, be sure to set their Parent property. The parent is responsible for providing the painting context.
No parent = nothing displayed.
I have had a possibly similar problem with images not showing (some time ago) and I fixed it by adding a panel and then image. (I don't really get the difference, but it worked then)
What type of images (bmp or jpeg)? Include jpeg unit in your code if you use jpg's.

Resources