Hikari (v0.3)

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
jianfei5
Gnoblar
Posts: 11
Joined: Wed Jun 18, 2008 6:12 am

Post by jianfei5 »

that's very cool!
jianfei5
Gnoblar
Posts: 11
Joined: Wed Jun 18, 2008 6:12 am

Post by jianfei5 »

I met some problems in the use of input box, unable to enter Chinese, and it shows that the actual input is different, I do not know how to solve this problem.
Another problem, when the swf file the voice is being played, close the window, there will be very wrong.
jianfei5
Gnoblar
Posts: 11
Joined: Wed Jun 18, 2008 6:12 am

Post by jianfei5 »

Very glad that I have basically solved the problem of the importation of ime, but the question now is to enter the cursor can not be displayed.
Below is my resolve ime input methods:
1,

Code: Select all

void KeyboardHook:: handleHook (UINT msg, HWND hwnd, WPARAM wParam, LPARAM lParam) 
( 
/ / Switch (msg) 
/ / ( 
/ / Case WM_KEYDOWN: 
/ / Case WM_KEYUP: 
/ / Case WM_CHAR: 
/ / Case WM_DEADCHAR: 
/ / Case WM_SYSKEYDOWN: 
/ / Case WM_SYSKEYUP: 
/ / Case WM_SYSDEADCHAR: 
/ / Case WM_SYSCHAR: 
/ / Case WM_IME_CHAR: 
/ / OutputDebugString ( "WM_IME_CHAR \ n"); 
/ / Case WM_IME_COMPOSITION: 
/ / OutputDebugString ( "WM_IME_COMPOSITION \ n"); 
/ / Case WM_IME_COMPOSITIONFULL: 
/ / OutputDebugString ( "WM_IME_COMPOSITIONFULL \ n"); 
/ / Case WM_IME_CONTROL: 
/ / OutputDebugString ( "WM_IME_CONTROL \ n"); 
/ / Case WM_IME_ENDCOMPOSITION: 
/ / OutputDebugString ( "WM_IME_ENDCOMPOSITION \ n"); 
/ / Case WM_IME_KEYDOWN: 
/ / OutputDebugString ( "WM_IME_KEYDOWN \ n"); 
/ / Case WM_IME_KEYUP: 
/ / OutputDebugString ( "WM_IME_KEYUP \ n"); 
/ / Case WM_IME_NOTIFY: 
/ / OutputDebugString ( "WM_IME_NOTIFY \ n"); 
/ / Case WM_IME_REQUEST: 
/ / OutputDebugString ( "WM_IME_REQUEST \ n"); 
/ / Case WM_IME_SELECT: 
/ / OutputDebugString ( "WM_IME_SELECT \ n"); 
/ / Case WM_IME_SETCONTEXT: 
/ / OutputDebugString ( "WM_IME_SETCONTEXT \ n"); 
/ / Case WM_IME_STARTCOMPOSITION: 
/ / OutputDebugString ( "WM_IME_STARTCOMPOSITION \ n"); 
/ / Case WM_HELP: 
/ / Case WM_CANCELMODE: 
/ / ( 
/ / HikariManager * manager = Hikari:: HikariManager:: GetPointer (); 
/ / If (manager) 
/ / Manager-> handleKeyEvent (msg, wParam, lParam); 
/ / Break; 
/ /) 
/ /) 
) 
2, create your own window, and then

Code: Select all

LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 
( 
Switch (message) 
( 
Case WM_KEYDOWN: 
Case WM_KEYUP: 
Case WM_CHAR: 
Case WM_DEADCHAR: 
Case WM_SYSKEYDOWN: 
Case WM_SYSKEYUP: 
Case WM_SYSDEADCHAR: 
Case WM_SYSCHAR: 
Case WM_IME_CHAR: 
Case WM_IME_COMPOSITION: 
Case WM_IME_COMPOSITIONFULL: 
Case WM_IME_CONTROL: 
Case WM_IME_ENDCOMPOSITION: 
Case WM_IME_KEYDOWN: 
Case WM_IME_KEYUP: 
Case WM_IME_NOTIFY: 
Case WM_IME_REQUEST: 
Case WM_IME_SELECT: 
Case WM_IME_SETCONTEXT: 
Case WM_IME_STARTCOMPOSITION: 
Case WM_HELP: 
Case WM_CANCELMODE: 
( 
If (hikariMgr) 
hikariMgr-> handleKeyEvent (message, wParam, lParam); 
Break; 
) 
) 
return DefWindowProc (hWnd, message, wParam, lParam); 
Return 0; 
) 
This is a major part of the code, so that ime input method can not be normal role, it may be because SetWindowsHookEx unable to receive comprehensive information on windows, hope that they can improve on ajs15822 great Hikari to help.
My English well, it is with Google's automatic translation, please understanding:)
jchmack
Goblin
Posts: 267
Joined: Tue Feb 28, 2006 12:30 pm

Post by jchmack »

Great Library =). Very easy to use. But i have one question. I have a plane that i want to display a movie on:

Code: Select all

mHikariMgr = new HikariManager("../Common/Media/Julius/Flash");
	Movie = mHikariMgr->createFlashMaterial("Movie",600,600);
	Movie->load("Test.swf");
	
	Plane MoviePlane;
	MoviePlane.normal = Vector3::UNIT_Z;
	MoviePlane.d = 0;

	Ogre::MeshManager::getSingleton().createPlane("MoviePlane",
            ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
            MoviePlane,
            1,1,1,1,true,1,1,1,Vector3::UNIT_Y);

	Entity* pPlaneEnt = mSceneMgr->createEntity( "MoviePlane1", "MoviePlane" );

	MovieNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
	MovieNode->attachObject(pPlaneEnt);
	MovieNode->setPosition(Vector3(0,2,-5));
	MovieNode->scale(2,2,2);

	pPlaneEnt->setMaterialName( Movie->getMaterialName() );
But i can't seem to stretch the Movie out to cover the entire plane. Chaning the size of the FlashMaterial doesn't seem to get the desired effect. There is a Gray border around the plane and i think that this is part of the material you create.

But still Awesome library. Im going to try to implement a way to inject inputs into hikari through mouse picking and the texture system.
User avatar
GantZ
Kobold
Posts: 33
Joined: Thu Jan 31, 2008 9:23 pm
Location: France

Post by GantZ »

Good work,

I have start to use the library along with MOGRE in csharp after writing a simple wrapper and i've got result really fast !

it seems to be a pretty decent GUI solution for .net

thanks for sharing !
User avatar
ajs15822
OGRE Expert User
OGRE Expert User
Posts: 570
Joined: Mon Jan 02, 2006 2:05 am
Location: Texas
x 2
Contact:

Post by ajs15822 »

jianfei5 wrote:Very glad that I have basically solved the problem of the importation of ime, but the question now is to enter the cursor can not be displayed.
Below is my resolve ime input methods:

...
Thanks for lending some help. I tried your solution (embedding ogre within an external window and passing keyboard IME messages directly instead of using a hook) but still am having problems (I'm testing it with Japanese).

Normally, when using IME in Flash, I type directly into the textbox and conversion is done automatically based on the current mode I'm in. Also, if I hit the spacebar at the end of a sentence, I get a little drop-down window that lets me select a kanji-equivalent.

In Hikari, however, Flash is embedded in a windowless site (it has no screen position or window handle) so when I start typing using IME, a little popup window appears in the top-left corner of the screen where I can see my hiragana/katakana/direct-input appearing as I type. When I hit enter, the text I entered appears in the Flash textbox however I get "????" for any hiragana/katakana/kanji characters (even if I'm in a font like MS Mincho).

This behavior is the same whether or not I pass IME messages via a message hook or directly from a real WindowProc.

I couldn't reproduce your success, could you please share your actual application code?
jchmack wrote:But i can't seem to stretch the Movie out to cover the entire plane. Chaning the size of the FlashMaterial doesn't seem to get the desired effect. There is a Gray border around the plane and i think that this is part of the material you create.
Ah, your videocard probably has limited support for textures with sizes that are non-powers-of-two. What you're seeing is Hikari automatically compensating for this by bumping up the texture size to the next-highest power-of-two size (the gray stuff is padding).

When a FlashControl is created as an overlay and this behavior occurs, the overlay's UV coordinates are automatically scaled to match any internal texture-size compensation.

Since you're creating it as a pure material, you will need to adjust the UV coordinates of your mesh yourself-- however, to do that would require knowing how much to scale the coords, and I haven't exposed that bit of API just yet. Look for it in the next SVN revision.
jianfei5
Gnoblar
Posts: 11
Joined: Wed Jun 18, 2008 6:12 am

Post by jianfei5 »

I spent some time compiled my code, and it HikariDemo a combination, can be successfully passed the compiler and to normal operation, the following are the relevant picture.

Image
Can be downloaded through a link below to complete the code.

http://www.file-upload.net/member/downl ... t.rar.html

In addition, I also found that if the window was not exaggerating when activated, can see the flash Exitbox enter cursor.

To the relevant picture, this should be some intuitive.

Image
Last edited by jianfei5 on Fri Jun 20, 2008 2:14 pm, edited 1 time in total.
jianfei5
Gnoblar
Posts: 11
Joined: Wed Jun 18, 2008 6:12 am

Post by jianfei5 »

Some of the recommendations
1, class FlashControl increase setEnable function
2, class FlashControl increase setAlwaysOnTop function
jchmack
Goblin
Posts: 267
Joined: Tue Feb 28, 2006 12:30 pm

Post by jchmack »

ajs15822 wrote: Ah, your videocard probably has limited support for textures with sizes that are non-powers-of-two. What you're seeing is Hikari automatically compensating for this by bumping up the texture size to the next-highest power-of-two size (the gray stuff is padding).

When a FlashControl is created as an overlay and this behavior occurs, the overlay's UV coordinates are automatically scaled to match any internal texture-size compensation.

Since you're creating it as a pure material, you will need to adjust the UV coordinates of your mesh yourself-- however, to do that would require knowing how much to scale the coords, and I haven't exposed that bit of API just yet. Look for it in the next SVN revision.
ah i believe you are correct:
14:54:30: * Non-power-of-two textures: yes (limited)

And if i change the dimensions of the overlay:
Movie = mHikariMgr->createFlashOverlay("Movie", mViewport, 512, 512, Position(TopLeft), 0);

it runs like i want (and faster i believe).
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

Post by Brocan »

ajs15822, can you provide the .as of the control and fps counter shown into the demo?

Thanks :D
Vectrex
Ogre Magi
Posts: 1266
Joined: Tue Aug 12, 2003 1:53 am
Location: Melbourne, Australia
x 1
Contact:

Post by Vectrex »

Brocan wrote:ajs15822, can you provide the .as of the control and fps counter shown into the demo?

Thanks :D
he does in the SVN
Vectrex
Ogre Magi
Posts: 1266
Joined: Tue Aug 12, 2003 1:53 am
Location: Melbourne, Australia
x 1
Contact:

Post by Vectrex »

GantZ wrote:Good work,

I have start to use the library along with MOGRE in csharp after writing a simple wrapper and i've got result really fast !

it seems to be a pretty decent GUI solution for .net

thanks for sharing !
that's cool, it's be great if you could upload that to the MOgre wiki. My students would benefit alot since they use some flash aswell as MOgre :)
Vectrex
Ogre Magi
Posts: 1266
Joined: Tue Aug 12, 2003 1:53 am
Location: Melbourne, Australia
x 1
Contact:

Post by Vectrex »

GantZ wrote:Good work,

I have start to use the library along with MOGRE in csharp after writing a simple wrapper and i've got result really fast !

it seems to be a pretty decent GUI solution for .net

thanks for sharing !
that's cool, it's be great if you could upload that to the MOgre wiki. My students would benefit alot since they use some flash aswell as MOgre and I've been too scared to get them to use CEGui :)
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

Post by Brocan »

Vectrex wrote:
Brocan wrote:ajs15822, can you provide the .as of the control and fps counter shown into the demo?

Thanks :D
he does in the SVN
True :lol:

But these are the .fla, not the .as :cry:
Vectrex
Ogre Magi
Posts: 1266
Joined: Tue Aug 12, 2003 1:53 am
Location: Melbourne, Australia
x 1
Contact:

Post by Vectrex »

Brocan wrote:
Vectrex wrote:
Brocan wrote:ajs15822, can you provide the .as of the control and fps counter shown into the demo?

Thanks :D
he does in the SVN
True :lol:

But these are the .fla, not the .as :cry:
the as code is in the first frame
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

Post by Brocan »

Vectrex wrote:
Brocan wrote:
Vectrex wrote: he does in the SVN
True :lol:

But these are the .fla, not the .as :cry:
the as code is in the first frame
Okei, then, how i can view the code?, i don't have flash cs3 to open de .fla, and if I open the file with notepad I get extrange characters...

I'm a bit confused :?
User avatar
GantZ
Kobold
Posts: 33
Joined: Thu Jan 31, 2008 9:23 pm
Location: France

Post by GantZ »

Vectrex wrote: that's cool, it's be great if you could upload that to the MOgre wiki. My students would benefit alot since they use some flash aswell as MOgre and I've been too scared to get them to use CEGui :)
well, i just wrapped the basic stuff for the moment since i start use the library two day ago and i'm afraid the code is quite dirty :)
I will try to port the demo and upload it next week
User avatar
ajs15822
OGRE Expert User
OGRE Expert User
Posts: 570
Joined: Mon Jan 02, 2006 2:05 am
Location: Texas
x 2
Contact:

Post by ajs15822 »

jianfei5 wrote:I spent some time compiled my code, and it HikariDemo a combination, can be successfully passed the compiler and to normal operation, the following are the relevant picture.

Image
Can be downloaded through a link below to complete the code.

http://www.file-upload.net/member/downl ... t.rar.html

In addition, I also found that if the window was not exaggerating when activated, can see the flash Exitbox enter cursor.

To the relevant picture, this should be some intuitive.

Image
Thanks alot!

I still couldn't get it working correctly with my Japanese IME, but I'm much less experienced with IME and am probably doing something else wrong-- I'm just happy that you've got it working on your end.

Until we find a better solution, I'll modify HikariManager to allow users to disable the keyboard hook and directly inject keyboard/IME events from their window proc.

As for the text caret, that's really weird that it is only rendering when the main window is not activated/focused. :shock: I don't understand how that can even happen because the Flash ActiveX control is embedded entirely within a windowless OLE control, it has no real connection to the state of the containing window (which is why we must inject all mouse/keyboard events).
Some of the recommendations
1, class FlashControl increase setEnable function
2, class FlashControl increase setAlwaysOnTop function
What would "setEnable" do? Give it keyboard focus? If so, you can already do that using FlashControl::focus().

"setAlwaysOnTop" is a good suggestion, I will think about it. :D
ajs15822, can you provide the .as of the control and fps counter shown into the demo?
Sure, here is the ActionScript3 code from controls.fla:

Code: Select all

import fl.controls.Button;
import fl.controls.Slider;
import fl.events.SliderEvent;
import fl.controls.ColorPicker;
import fl.events.ColorPickerEvent

opacitySlider.addEventListener(SliderEvent.CHANGE, function(event:SliderEvent){
	opacity_txt.text = event.value + "%";
	ExternalInterface.call("opacityChange", event.value);
});

colorPicker.addEventListener(ColorPickerEvent.CHANGE, function(event:ColorPickerEvent){
	ExternalInterface.call("colorChange", event.color);
});

exit_btn.addEventListener(MouseEvent.CLICK, function(){
	ExternalInterface.call("exitClick");
});
and here is the code from fps.fla:

Code: Select all

function setFPS(fps:Number)
{
	fps_txt.text = fps.toString();
}

ExternalInterface.addCallback("setFPS", setFPS);
jianfei5
Gnoblar
Posts: 11
Joined: Wed Jun 18, 2008 6:12 am

Post by jianfei5 »

What would "setEnable" do? Give it keyboard focus? If so, you can already do that using FlashControl::focus().
setEnable the usefulness lies in the fact that we may use the background image, if we use a FlashControl as a background image, when the mouse click on it, we do not have to put it on top of the screen, so obscured by other windows.
Until we find a better solution, I'll modify HikariManager to allow users to disable the keyboard hook and directly inject keyboard/IME events from their window proc.
It was a good way

Hikari believe will be a very good Ogre GUI system, with its perfect, there will be more and more users.[/quote]
User avatar
ajs15822
OGRE Expert User
OGRE Expert User
Posts: 570
Joined: Mon Jan 02, 2006 2:05 am
Location: Texas
x 2
Contact:

Post by ajs15822 »

jianfei5 wrote:
What would "setEnable" do? Give it keyboard focus? If so, you can already do that using FlashControl::focus().
setEnable the usefulness lies in the fact that we may use the background image, if we use a FlashControl as a background image, when the mouse click on it, we do not have to put it on top of the screen, so obscured by other windows.
Ahh, okay, I will think about adding this too. :)


Also, Revision 10 has just been committed to the SVN trunk:
ChangeLog wrote:API Changes since v0.2:
- In FlashControl:
-- FlashControl::getUVScale has been added
- In HikariManager:
-- HikariManager::injectKeyEvent has been added
-- HikariManager::setKeyboardHookEnabled has been added

Core Changes since v0.2:
- As a workaround for better IME support, you may now disable the internal keyboard-hook and inject keyboard/IME messages directly from the main window's WindowProc. (thanks to jianfei5)
jikowhitewolf
Gnoblar
Posts: 10
Joined: Thu Dec 28, 2006 7:52 am

Viewport to match the monitor size

Post by jikowhitewolf »

Hi,
I am using Hikari in my game, manage to learn much actionscript 3.0 for last 2 weeks. My monitor screen is 1024 x 768 size, but the moment I display on a wide screen, it does not fix to the screen.

Can you tell me how will I be able to change the screen size in code to fix all monitor screens?
Thanks in advance for your help.
eeenmachine
Gnoblar
Posts: 2
Joined: Sun Jun 22, 2008 11:32 pm

Post by eeenmachine »

First of all I love you for enabling me to help out on my brother's game Zero Gear! We're having a problem playing dynamically loaded sounds using Sound.load() and Sound.play(). Any ideas?
User avatar
ajs15822
OGRE Expert User
OGRE Expert User
Posts: 570
Joined: Mon Jan 02, 2006 2:05 am
Location: Texas
x 2
Contact:

Post by ajs15822 »

eeenmachine wrote:First of all I love you for enabling me to help out on my brother's game Zero Gear! We're having a problem playing dynamically loaded sounds using Sound.load() and Sound.play(). Any ideas?
You're welcome. :D

What seems to be the problem-- is it just not playing?

I just tested the following code out ("nyan nyan.mp3" resides within the same directory as the SWF) and it works just fine:

Code: Select all

var sndRequest:URLRequest = new URLRequest("nyan nyan.mp3");
var sound:Sound = new Sound();

sound.load(sndRequest);

play_btn.addEventListener(MouseEvent.CLICK, function()
{
	sound.play();
});
eeenmachine
Gnoblar
Posts: 2
Joined: Sun Jun 22, 2008 11:32 pm

Post by eeenmachine »

Ok, good to know. It must be something wrong on our end since I can't get it to play embedded sounds either. I think we pull the sounds out of flash anyways to have consistent volume levels. Thanks for the help!
Murphy
Greenskin
Posts: 102
Joined: Tue May 10, 2005 11:42 pm
Location: SF, California
Contact:

Post by Murphy »

btw, the problem eeenmachine was talking about was actually my fault :(

Because of an issue with integrating Hikari into our app with Navi gui, Hikari wasn't getting an mouse clicks, opps!

All fixed now :D
Post Reply