AutoHotkey: Mapping arrows key to PS3 pad buttons? - button

PS3 D-PAD in Windows generates arrow key output (just like if you pressed UP DOWN LEFT RIGHT on the keyboard) insted of decent POV - which is hopeless.
So I want to map keyboard arrow keys output to PAD buttons (i.e. 7,8,11,12) using AutoHotkey script (the best thing would be to map them as POV but I am too "short" to figure that out).
I checked the pad device number and UP/DOWN/LEFT/RIGHT key codes and came out with this:
SC14B::Send {3Joy11}
SC14D::Send {3Joy12}
SC148::Send {3Joy7}
SC150::Send {3Joy8}
Unfortunatelly the only thing this script does is block use of arrows in notepad...
I also tried to assign the mapped arrows to D-pad using x360ce controller emulator but it still detects arrows as arrows, not as pad buttons.
What am I doing wrong?

I love answering my own questions :)
So as it turns out from AutoHotkey documantation, it can only listen to Joy input but cannot generate it. For this purpouse there is another peace of software: PPJoy.

Related

Coloring the reverse side of mesh tiles in Scilab

In plot3d2 and similar graphic functions of Scilab, is there a way to set the colour of the back (reverse, flip, inner) side of facets?
I'm trying to draw a part of a (rather crude) torus, and the result is OK except for one row of facets. I suppose that, because of the way I generate the mesh, those facets are oriented differently - whatever algorithm renders them on the screen follows their perimeter in the opposite direction compared to others.
Instead of poring over my code to try to mend the topology of my mesh, I'd rather make sure the facet orientation doesn't matter - just set both sides to my colour. It will also improve the looks of the ends of my torus, where the inside shows and, again, is in a colour I didn't ask for.
But, hard as I search the documentation, I cannot find any mention of the flip side of mesh facets.
Any clues?
The backface color is named "hiddencolor" in the properties of a surface entity (see https://help.scilab.org/docs/6.1.1/en_US/surface_properties.html). It can be changed a posteriori, for example:
[X,Y]=meshgrid(-1:0.5:1);
plot3d2(X,Y,X.^2-2*Y.^2)
gce().hiddencolor=color("red")
You can assign -1 (instead of above) to use the same color as the front facing patches.
However, if all your patches are facing wrongly, you can also transpose all your matrices in the plot3d2 call:
[X,Y]=meshgrid(-1:0.5:1);
plot3d2(X',Y',(X.^2-2*Y.^2)')
gce().hiddencolor=color("red")

Why does software often use an inverse coordinate system compared to regular math coord system?

As you likely know, in c#, the origin (0,0) of a plane is the upperleft corner. Going to the right and/or under is regarded as +, while going to the left and/or up is -. Opposed to this is the regular math coordsystem:
(0,0)=mid of plane, going up/right = +, down/left = -.
It's kinda counter-intuitive and can be annoying sometimes, since we're used (for years) to using the regular math coords, and you have to recalculate coords as well.
Is this a fundamental design flaw? And do you get used to it after a while? And which other languages use a different coord system like c#?
It is not C# but the display that uses a inverse coordinate system, this comes from the days back when the display was drawn in using a CRT and the image was drawn in top to bottom, left to right. That is why the coordinate system OS's use match that.
Languages like C# are just wrapping the underlying OS's API and that is why C# uses it too.
The mathematical graph plane is a virtual thing, which expands in all directions without limits.
The screen is a real thing, which can not really expand at all.
Instead we use the concept of scrolling and we are used to doing it from a starting point down.
So conceptually the graphics systems all use the same system as a (left-to-right & top-to-bottom) textblock or page in a book . It is about how we scroll to expand/advance the display area.
But it could be defined in any other way; after all e.g. negative coordinates do make sense as opposed to a negative line number..
If you don't like the coordinate system on the screen, you can create wrapper methods to re-map the coordinates any way you like.

Cocos3d:Animation is not working in the output

I am developing cocos3d app for iOS.
I added the walk animation for a "Man" blend file. Looks, the man is doing walk animation fine in Blender. I have used the following settings to convert to collada and then pod. I am getting wrong output mentioned like below.
Export .dae options such as "Export Data Options (Apply modifiers, Selection only, Include Armatures are enabled),
Texture options (Include UV Textures, Include Material textures and copy are enabled),
Armature Options (Deform Bones only is enabled),
Collada Options (Use Object Instance enabled)
options enabled in Blender when converting to .dae file.
And then, In PVRGeoPOD 2.13 version,
Export Geometry (Primitive Type: Indexed Triangle list)
Use custom optimisations settings (PVRTGeomterySort sorting method), Vertex data optiomisations (Interleave Vertex data, align vertex data 32 bits)
Vector (Position - float, Normal - float, Color - RGBA)
Export Skinning data ( Bone indices - unsigned byte; Bone weights - unsigned bytes)
Matrix palette size - 11
Export Mapping Channels (uvw0 - float only enabled)
Flip V co-ordinate enabled
Material - 'Export Materials' only enabled
Transformations - Export animations, Index animation data are enabled. Co-ordinate system - OpenGL model space
OUTPUT:
A Man walking animation is happening kind of, but the man is completed black shaded and bones are unlikely expanded. Output is ugly one.
Please note: If i add the same Man without adding "Armature (and bone, walk animation)" in blender and the exported pod is showing the man very well in the device output without any animation.
Output 1: When i added walk animation using armature bones, output is black shaded with improper walk animation. Pls. refer this link to see output
https://www.yousendit.com/download/UVJpWUh0bThiV3dsYzhUQw
Output 2: Output without any animation in that Man pod model. Pls refer this link.
https://www.yousendit.com/download/UVJpWUh0bThoMlhyZHNUQw
I have uploaded the .blend, .pod files attached in this link -> https://www.yousendit.com/download/UVJpWUhndWNsUjk3czlVag
How do i solve the animation issue and provide the smooth walk animation with clear view? As i need to fix this issue urgently, could you please help on suggesting to solve this issue?
thank you.
I have solved it. Here is the solution-> http://www.cocos2d-iphone.org/forum/topic/345818

Add Triangle shape from Popup Panel to a point

I am trying to add a trianlge shape from the Popup "Address Details" to the pin point I have on the map. To try and give it the effect that the Address Details is coming from the pin point. I tried messing around with some code from Abode to get a triangle to show up but all it did was make my Address Details disappear. This is the site from Abode I tried using. http://livedocs.adobe.com/flex/3/html/help.html?content=Drawing_Vector_Graphics_4.html
If anyone could help me figure out how to do the triangle or maybe another suggestion for what I am trying to accomplish it would be greatly appreciated.
EDIT: Showing code I have tried
// green triangle, starting at point 200, 0
triangle.graphics.beginFill(0x00FF00);
triangle.graphics.moveTo(200 + triangleHeight/2, 0);
triangle.graphics.lineTo(200 + triangleHeight, triangleHeight);
triangle.graphics.lineTo(200, triangleHeight);
triangle.graphics.lineTo(200 + triangleHeight/2, 0);
this.addChild(triangle);
var line:Graphics;
line.moveTo(100,100);
line.lineTo(200,200);
Above are the two different things I tried. I didn't try to match the points exactly yet just trying to get it to display first. But If I added any of this I never saw a shape, didn't get any errors, and my Address Detail Panel would simple show the blue header and nothing more.
This is what I would like to attempt to do.

How to get the position of the first and the last tick mark in a Qslider?

I want to draw a tick mark for a qslider in paintEvent, so I should get the exact position of each tick mark. As you know, the handle of slider takes some space, so the first tick mark does not sit at the left/top position of the slider, there is offset of several pixels. Same thing happens to the last tick mark which indicates the maximum value. I want to know how many pixels of the space? (On win and mac, the handle are not in the same width)
If you have not yet done so, download the Qt source code and copy how they do it. You will want to look in the various Q...Style classes, i.e QMacStyle, QWindowsXPStyle, etc. Some of the key calculations come from:
QStyle::sliderPositionFromValue() method
QStyle::pixelMetric(QStyle::PM_SliderTickmarkOffset, ...)
Look in the various drawComplexControl methods for case CC_Slider:, where slider controls are drawn. In the Qt 4.7 code, this starts on line 2699 in qwindowsxpstyle.cpp, for example.

Resources