sprite

Billboard with math

前提是你 提交于 2020-01-05 17:03:26
问题 I'm trying to draw an element always facing camera. I've read some articles about billboard in shaders, the problem is that I need to compute rotation out of shaders and with different objects (circles, square, mesh, …). So, I'm trying to compute model's rotation only (not matrix, something similar to Transform.LookAt in Unity engine) but I don't know how to do, here is what I've got: // Camera data mat4 viewMatrix = camera->getMatrix(); vec3 up = {viewMatrix[0][1], viewMatrix[1][1],

Billboard with math

放肆的年华 提交于 2020-01-05 17:03:13
问题 I'm trying to draw an element always facing camera. I've read some articles about billboard in shaders, the problem is that I need to compute rotation out of shaders and with different objects (circles, square, mesh, …). So, I'm trying to compute model's rotation only (not matrix, something similar to Transform.LookAt in Unity engine) but I don't know how to do, here is what I've got: // Camera data mat4 viewMatrix = camera->getMatrix(); vec3 up = {viewMatrix[0][1], viewMatrix[1][1],

Hit testing child controls added to a canvas does not work

半城伤御伤魂 提交于 2020-01-05 03:11:26
问题 I am trying to do hit testing on a collection of user controls added to a canvas at runtime. My canvas: <Canvas x:Name="LayoutRoot" Background="White"> <Canvas x:Name="Carrier" Canvas.ZIndex="-1"> </Canvas> </Canvas> My canvas code: public MainPage() { InitializeComponent(); var uiElement = new MyUserControl(); this.Carrier.Children.Add(uiElement); MouseLeftButtonDown += MouseLeftButtonDownHandler; } private List<UIElement> HitSprite(Point p) { var hitElements = VisualTreeHelper

need to fix retina sprite css issue

假装没事ソ 提交于 2020-01-04 13:42:26
问题 I'm trying to optimize the mobile skin for www.talkjesus.com to be retina clear. I accomplished this with standalone images such as the facebook/twitter icons, the logo and the top right 3 icons in the header as well. Problem I'm having is doing this for the sprite image entirely. This is the css code (default) .ui-icon, .ui-icon-searchfield:after { background-image: url({vb:stylevar imgdir_mobile}/metro-icons-24.png); border-radius: 0; background-color: transparent; } .ui-icon-plus

Seamlessly layering transparent sprites in OpenGL ES

你离开我真会死。 提交于 2020-01-04 09:59:15
问题 I am working on an Android app, based on the LibGDX framework (Though I don't think that should affect this problem too much), and I am having trouble finding a way to get the results I want when drawing using transparent sprites. The problem is that the sprites visibly layer on top of each other where they overlap, similar to what is displayed in this image : This is pretty unsightly for some of what I want to do, and even completely breaks other parts. What I would like them to do is merge

Kinetic.js [How can I stop one sprite]

纵饮孤独 提交于 2020-01-04 07:02:32
问题 I´m starting with Kinetic.js and I have my first app working perfectly, but I don´t find the way to stop sprites... for example, I have one sprite and I want to "play" that sprite just once, see the frames and in the last one, one simple stop(). How can I do that? (Stop after the last "frame" of the sprite). Here´s my code (for that sprite): var myImage = new Image(); myImage.onload = function() { var mySprite = new Kinetic.Sprite({ x: 250, y: 40, width: 70, height: 109, image: myImage,

Kinetic.js [How can I stop one sprite]

风格不统一 提交于 2020-01-04 07:02:14
问题 I´m starting with Kinetic.js and I have my first app working perfectly, but I don´t find the way to stop sprites... for example, I have one sprite and I want to "play" that sprite just once, see the frames and in the last one, one simple stop(). How can I do that? (Stop after the last "frame" of the sprite). Here´s my code (for that sprite): var myImage = new Image(); myImage.onload = function() { var mySprite = new Kinetic.Sprite({ x: 250, y: 40, width: 70, height: 109, image: myImage,

How do I add background music to my spritekit file

末鹿安然 提交于 2020-01-04 06:33:45
问题 Could someone give me a quick easy step by step to adding background m4a music once my app has loaded. It is a sprite kit Xcode file, and the music is in m4a format. Thanks 回答1: Try with this: @import AVFoundation; ... AVAudioPlayer * backgroundMusicPlayer; NSError *error; NSURL * backgroundMusicURL = [[NSBundle mainBundle] URLForResource:@"song" withExtension:@"m4a"]; backgroundMusicPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:backgroundMusicURL error:&error]; backgroundMusicPlayer

Change sprite color into white

瘦欲@ 提交于 2020-01-04 02:22:45
问题 I'm trying to change the color of a sprite (wich is red and gray), in white color. sprite.setColor(1, 1, 1, 1); But nothing is happening. How can I change all the sprite colors in white ? please, thanks you 回答1: If you want to change the color of all the shapes in the sprite to white then the only way you can do this is to use a pixel shader and set all the fragments that they are not black(i assume black renders as transperant in your game) to white. Something like that: varying vec4 v_color

Retina-Sprite CSS not working

自闭症网瘾萝莉.ら 提交于 2020-01-03 05:18:13
问题 I'm having problem with my sprite. My problem is I have a menu sprite, aswell as a retina menu sprite. But for some reason the Css for the retina sprite doesnt work. Here's my code: @media only screen and (-webkit-min-device-pixel-ratio: 2.0), only screen and (min--moz-device-pixel-ratio: 2.0), only screen and (-o-min-device-pixel-ratio: 200/100), only screen and (min-device-pixel-ratio: 2.0) { .menu li a, background-image:url('images/sprite@2x.png'); -webkit-background-size: 110px 55px; -moz