Rotate static text 45 degrees - text

I am trying to set a single line of static text so it lies across the secreen at 45 degrees.
This is my code but it has no effect.
mLoser = new Text(20, 430, mFont36,"Game Over! No more moves.", getVertexBufferObjectManager());
mLoser.setPosition(400 - mLoser.getWidth()/2, 480 - mLoser.getHeight()-2);
mLoser.setRotationCenter(mLoser.getX(), mLoser.getY());
mLoser.setRotation((float) -0.125);
mLoser.setVisible(false);
mMainScene.attachChild(mLoser);
I have my game working and just trying a few ideas I haven't used before.
Could you explain how this is done.

Solved.
I just had to set the rotation to -45 instead of -0.125. Doh!
A bit more fiddling with the positioning and got what I wanted.

Related

Unit Of Measure Used In jszpl

I use jszpl to generate .zpl within my Nodejs application. Many elements have properties referencing a size, but I can't find anywhere what the unit of measure is. I thought the unit of measure was millimeters, but I was finding that is not the case based on my testing.
For example:
const text1 = new Text();<br/>
label.content.push(text1);<br/>
text1.fontFamily = new FontFamily(FontFamilyName.F);<br/>
text1.horizontalAlignment = new Alignment(AlignmentValue.Center);<br/>
**text1.top = 44;**<br/>
text1.text = 'Roll ID';
I thought in this example I was setting the text to generate 44mm from the top of the parent, but that is not the case.
Does anyone know what unit of measure is being used?
The standard unit of measurement in ZPL is dot. It is also mentioned in JSZPL github that the measurement unit used in the library is dot. Now, what is dot?
Dot is a variable size unit, its size depends on dpi (dots per inch) setting of the printer. It can have values 152, 203, 300, 600, although not all printers support all of them. Usually supported values are 203 and 300 dpi. You can set this directly on the printer via buttons, via web GUI (if you are using network connection), Zebra setup utilities or by using the ^MU ZPL command.
So, the size of a dot is determined by dpi setting. Lets say that your printer is set up to 203 dpi and you are using value 44 in your code. As the name suggests, 203 dpi means 203 dots per inch, so the real world length is 44/203 inch. To convert it to milimeters it would be (44/203)*25,4 mm. In case of 300 dpi just swap the 203 value with 300.
More about ZPL basics in ZPL manual or in Labelary introduction to ZPL.
You can also try Labelary Online ZPL viewer where you can change dpi settings and experiment on what does it do to your code.

Vuforia video playback with fixed dimension

I am using vuforia video playback demo with cloud recognition.
I have combined both projects and it is working properly. But currently video dimension is according to detected object. But i need fixed width and height when video plays.
Can anyone help me ?
Thanks in advance.
Well apparently Vuforia fixes the width and height at the start of the game no matter what the size of the object is. I could not find when exactly this operation is conducted but it is done at beginning of your game. When you change the size of the ImageTarget in runtime it is not fixed anymore. Add these lines to your OnTrackingFound function of DefaultTrackableEventHandler.cs
if (this.name == "WhateverTheNameOfYourRelatedImageTarget"&& !isScaled)
{
//Increase the size however you want i just added 1 to each dimension
this.transform.localScale += Vector3.one;
// make isScaled true not to scale every time it is found initially it shoud be false
isScaled = true;
}
Good luck!
What i usually do is , instead of Videoplayback , i play the video on canvas object and hook this object to Defaulttrackableeventhandler script. So when target is found, gameobject.setactive(true) and gameobject.setactive(false) when target is lost. By this method the size of the gameobject is fixed and it stays in a fixed location .
I just made an example you can get here (have to import it to any project and open the scene Assets/VideoExample/Examples). You can see there a bit clearer what the ScreenSpace - Overlay does ... it might be better to just switch to ScreenSpace - Camera in general

SVG path in javafx 3d viewer

I am trying to load SVGPath (simple line) in JavaFx 3D viewer. I tried adding the SVGPath class object to Group and added it on scene, but it shows only in 2D. Is there a way I can change this to 3D representation. I also tried using JavaFx 3D Shapes like Box and Cylinder but not sure whether it is a correct way to do that. Following is my code.
Group relationGrp = new Group();
SVGPath path = new SVGPath();
path.setStroke(Color.WHITE);
path.setStrokeWidth(10);
path.setContent("M -15 -60 L -15 15 L 60 15z");
svg3dModelGrp.getChildren().add(path);
I think the SVGPath only allows 2D drawing, why ? Because you just have to introduce (positionX, positionY, and some curve details...) in each action and Logically a line has no depth:
//MoveTo (from positionX and positionY) / LineTo (to positionX and positionY)
Mx y , Lx y ...
You can play with the path to create depth effects by creating many shapes one behind the other with a decremented size but I do not believe that the SVGPath is made for this purpose !
Wikipedia :
Scalable Vector Graphics (SVG) is an XML-based vector image format for two-dimensional graphics

How to use blendMode divide width PIXI.js?

I would like to use the divide blendMode in PIXI.js. How to do it?
I've tried all the other blendModes availables but none were good enough for the effect I'm trying to make. http://i.stack.imgur.com/YlqVm.jpg
Using the phaser based on pixi.js:
base = game.add.sprite(350, 350, 'base');
base.anchor.set(0.5);
base.tint = '0x7f4f2c';
blur = game.add.sprite(350, 350, 'blur');
blur.anchor.set(0.5);
blur.blendMode = PIXI.blendModes.DIVIDE; // Of course it doesn't work because pixi doesn't have it
I somehow tried to inverse the image and use the COLOR_DODGE blend mode which is available in pixi and it worked. This is a just very lucky. The effect is not 100% equal, but very close and good enough in this case.

GPUImage: GPUImageGaussianSelectiveBlur apply to large size image will black in the area being excluded blur

I am trying to apply GPUImageGaussianSelectiveBlurFilter to GPUImagePicture. But there seems to have a problem.
Initial GPUImagePicture with "[[GPUImagePicture alloc] initWithImage:image smoothlyScaleOutput:NO]". And,when the image size is larger (maybe width > 1024px ),the area being excluded from the blur on the image may become black whiteout anything (define by excludeCircleRadius property in GPUImageGaussianSelectiveBlurFilter)!
This problem will without exist if I smaller the image size (example: 640 * 960 px).
Could somebody tell me what may cause this problem please? Thank you very much!Thank you!
I seems to solve the problem. The key is that GPUImagePicture will get conserveMemoryForNextFrame use "if (MAX(pixelSizeOfImage.width, pixelSizeOfImage.height) > 1000.0)" This mean that the image can not be over 1000px size.

Resources