1

How would I go about making a cursor that always moves back and forth on the highlighted option? I already have a working menu with a cursor that is still but how would I make a cursor that moves?

2

Hm, are you using standard AMS menus? In this case, you can't change their cursor position by yourself while they are open.
But if you mean creating your own graphical menu with user input, basically it can be something like this:
int nCursorPos = 0, nKey;
DrawAllMenuOptions();
while (1)		{
	nKey = GKeyIn(NULL, 0);		//Wait a key
	if (nKey == KEY_UP)		//Upwards
		nCursorPos--;
	else if (nKey == KEY_DOWN)		//Downwards
		nCursorPos++;
	else if (nKey == KEY_ENTER)		//Terminate
		break;
	//Verify it's in a valid range
	nCursorPos = (nCursorPos & 0x7fff) % nTotalOptions;
	DrawHighlightedMenuOption(nCursorPos);
}
printf("You selected: %i", nCursorPos);
avatar
Highway Runners, mon jeu de racing à la Outrun qu'il est sorti le 14 décembre 2016 ! N'hésitez pas à me soutenir :)

https://itunes.apple.com/us/app/highway-runners/id964932741

3

Thanks for the reply.
No, I'm using my own graphical menus for user input. I have the menu part all set with the cursor that doesn't move and I am able to move it between positions in the menu ok, it's just that I'm trying to have my cursor move back and forth at the current option it is highlighting.

//Verify it's in a valid range
nCursorPos = (nCursorPos & 0x7fff) % nTotalOptions;
DrawHighlightedMenuOption(nCursorPos);

I just have two questions:
What does the first line do with the bit manipulation?
How does DrawHighlightedMenuOption(nCursorPos) work? (That's the main part I'm confused about)

Thanks for the help.

4

nCursorPos = (nCursorPos & 0x7fff) % nTotalOptions;orPos -= nTotalOptions;
Does the same job that:while (nCursorPos < 0)
  nCursorPos += nTotalOptions;
while (nCursorPos >= nTotalOptions)
  nCurs
Just to verify that if highlighted option is for example -1 (one unit upwards the first option), it will come to the last bottom option, to make a loop.
For DrawHighlightedMenuOption, nothing special, it just draws the highlighted menu option.
Anyways, I don't understand your question... (english is not my native language)
avatar
Highway Runners, mon jeu de racing à la Outrun qu'il est sorti le 14 décembre 2016 ! N'hésitez pas à me soutenir :)

https://itunes.apple.com/us/app/highway-runners/id964932741

5

Well, for DrawHighlightedMenuOption() I want to try and have a cursor that is pointing to a menu item (let's say for example the last option) and then it will move back and forth while on that option like this:

Option 1
Option 2
-> Option 3

Option 1
Option 2
-> Option 3

Option 1
Option 2
-> Option 3

All the cursor will do is while it is highlighting a menu option, it will move back and forth just as like a simple animation in a way.

6

Then you can just draw your cursor using XOR effect, so that it reverts the destination region. Drawing a second time your cursor at the same place will erase it (double reverse).
So, in a loop, you draw your cursor at a x,y place, you wait a bit, and you redraw it at the same place, and cycle the loop with different x (horizontal) values, adding to x values cycled in a table like this for example {-1, -1, 0, 1, 1, 1, 0, -1}. It will be drawn at a different place each loop cycle, thus giving the impression of being animated.
avatar
Highway Runners, mon jeu de racing à la Outrun qu'il est sorti le 14 décembre 2016 ! N'hésitez pas à me soutenir :)

https://itunes.apple.com/us/app/highway-runners/id964932741

7

That sounds like a great idea! Thanks for the help, I'll try that out as soon as I can.