Jump to content


Photo

Code Help


  • Please log in to reply
6 replies to this topic

#1 wyrp

wyrp

    X-S Enthusiast

  • Members
  • 13 posts

Posted 22 November 2004 - 07:45 AM

I'm trying to combine code from the game.lua / apps.lua with code from the mainmenu.lua in order to retain the appearance of the main menu in the other menus while retaining the ability for the dash to automatically find and list the contents. So far I've been able to get the appearance to carry over, but despite my efforts I've been unable to meld the auto listing with the mainmenu tabs.

Anybody know which lines would need to be used to pull this off?

#2 bucko

bucko

    Super Moderator

  • Head Moderators
  • PipPipPipPipPipPipPipPipPipPipPip
  • 7,997 posts
  • Gender:Male
  • Location:England
  • Xbox Version:v1.6
  • 360 version:v5.0 (360S - trinity)

Posted 23 November 2004 - 02:40 PM

I can't help you there sad.gif but come on our chan in IRC someone may be able to help you if anyone is up.

http://www.xboxopens...eavyApplet.html

Edited by bucko, 23 November 2004 - 02:41 PM.


#3 wyrp

wyrp

    X-S Enthusiast

  • Members
  • 13 posts

Posted 24 November 2004 - 07:52 PM

So far this is what I've got for my apps.lua. When implemented, the applications menu has the xlogo and rotating crosshair, it is possible to scroll through the possible apps to launch, it is even possible to launch apps, however the container and title of each application does not appear. I think the problem is in my rendering function, but I'm having trouble locating where.

Any help?

[Code Removed]

code revised @ 4:26am Eastern 11-25-04.
One selection box shows, still no text, cannot get rest of boxes.

Edited by wyrp, 27 November 2004 - 11:16 PM.


#4 wyrp

wyrp

    X-S Enthusiast

  • Members
  • 13 posts

Posted 27 November 2004 - 09:29 AM

Here is an update. I've got it so that the application titles show now, however the non-selected target items below the target continue to wrap in a circular fashion, and non-selected items above target do not show yet, but menu is functional.

I am not finished with this project yet, but here is where I am at in-case anyone would like to review, comment, or test my progress. It should also be noted that I take no liability in case of damage resulting in the use of this code, not that it should cause any problems, and that when I find the solution to the remaining problems I will post another update.

I really could use some help on this, if anyone knows lua.

[CODE REMOVED]

You'll notice that there are only minor differences between the game.lua and the app.lua, but since modifying for use as the game.lua the bugs become more evident.

Edited by wyrp, 27 November 2004 - 11:17 PM.


#5 wyrp

wyrp

    X-S Enthusiast

  • Members
  • 13 posts

Posted 27 November 2004 - 11:13 PM

I've got it working!
Both the Games and Apps menus will look like the main menu.

Apps Menu Code
QUOTE

--apps menu

findfiles(0)
Rotation = 0
MenuTop = 0
mRot = 0
TargetRotation = 0
BackRotation = 0
TargetItem = 0

menuitems=getmenu(0)


loadmesh("xsphere", "SKINS:\\xdash\\mainmenu\\xsphere.xbg")
loadmesh("outersphere", "SKINS:\\xdash\\outersphere.xbg")
loadmesh("crosshair", "SKINS:\\xdash\\mainmenu\\crosshair.xbg")
loadmesh("menuitem", "SKINS:\\xdash\\mainmenu\\menuitem.xbg")
loadmesh("selectedmenuitem", "SKINS:\\xdash\\mainmenu\\selectedmenuitem.xbg")


loadtexture("XRayMap", "SKINS:\\xdash\\xray.bmp")


framecnt=10
function framemove ()
framecnt=framecnt-1
if TargetRotation<Rotation then
   Rotation=Rotation-2.5
elseif TargetRotation>Rotation then
   Rotation=Rotation+2.5
elseif framecnt<5 then
if (contAy>0.5 or contApushup>0) and TargetItem>0 then
   TargetItem=TargetItem-1
   TargetRotation=25*TargetItem
   PlaySound("menuup")
   framecnt=20
  elseif (contAy<-0.5 or contApushdown>0) and TargetItem<menuitems-1 then
   TargetItem=TargetItem+1
   TargetRotation=25*TargetItem
   PlaySound("menudown")
   framecnt=20
  end
  if contApusha>0.75 then
   launchxbe(getitemfilename(0, TargetItem))
   framecnt=10
  end
 
  if contApushy>0.5 then
   newscene("SKINS:\\xdash\\apps.lua")
   framecnt=30
  end
 
  if contApushb>0.5 then
   newscene("SKINS:\\xdash\\mainmenu.lua")
   framecnt=10
  end
end

end

function render ()
BackRotation=BackRotation-0.0003

setfont("mainfont")

setrenderstate(102, 0)
setrenderstate(92, 0)
setrenderstate(59, 0)
setrenderstate(147, 0)
renderobject("outersphere", 3, 0, 0, 31, PI/2, BackRotation, 0, 1.3, 1.3, 1.3)


setrenderstateargb(75, 0, 0, 0, 0)

setupxray(1, 255, 0, 93, 199)
settexture("XRayMap", 0)
renderobject("crosshair", 0, -16, 0.95, 3, 0, 0, rad(Rotation), 0.5, 0.5, 0.5)
setupxray(0, 175, 0, 93, 199)

setrenderstate(102, 0)
setrenderstate(59, 0)
renderobject("xsphere", 1, -15, 0.95, 3, 0, -PI/18, 0, 0.5, 0.5, 0.5)


for i=0, menuitems-1 do
  mRot=Rotation-(25*i)
  alpha=255-abs(mRot)*4
  --if i>=TargetItem then
  if alpha>0 then
   itemx=(cos(mRot)*20)-16
   itemy=(sin(mRot)*20)+0.95
   setrenderstate(59, 1)
   setrenderstate(62, 32771)
   setrenderstate(63, 774)
   setrenderstateargb(75, alpha, 0, 0, 0)
   renderobject("storageitem", 1, itemx, itemy, 3, 0, 0, 0, 0.25, 0.25, 0.25)
   if abs(mRot)<=32 then
    setrenderstateargb(75, alpha*alpha/256, 0, 0, 0)
    renderobject("selectedmenuitem", 1, itemx, itemy, 3, 0, 0, 0, 0.25, 0.25, 0.25)
   end
   settextargb(alpha,255,255,255)
   textx=(cos(mRot)*147)+255
   texty=237-(sin(mRot)*147)
   rendertext(getitemstring(0,i), textx, texty)
  
  end
 
end

end


Game Menu Code
QUOTE

--games menu

findfiles(1)
Rotation = 0
MenuTop = 0
mRot = 0
TargetRotation = 0
BackRotation = 0
TargetItem = 0

menuitems=getmenu(2)


loadmesh("xsphere", "SKINS:\\xdash\\mainmenu\\xsphere.xbg")
loadmesh("outersphere", "SKINS:\\xdash\\outersphere.xbg")
loadmesh("crosshair", "SKINS:\\xdash\\mainmenu\\crosshair.xbg")
loadmesh("menuitem", "SKINS:\\xdash\\mainmenu\\menuitem.xbg")
loadmesh("selectedmenuitem", "SKINS:\\xdash\\mainmenu\\selectedmenuitem.xbg")


loadtexture("XRayMap", "SKINS:\\xdash\\xray.bmp")


framecnt=15
function framemove ()
framecnt=framecnt-1
if TargetRotation<Rotation then
   Rotation=Rotation-2.5
elseif TargetRotation>Rotation then
   Rotation=Rotation+2.5
elseif framecnt<5 then
if (contAy>0.5 or contApushup>0) and TargetItem>0 then
   TargetItem=TargetItem-1
   TargetRotation=25*TargetItem
   PlaySound("menuup")
   framecnt=10
  elseif (contAy<-0.5 or contApushdown>0) and TargetItem<menuitems-1 then
   TargetItem=TargetItem+1
   TargetRotation=25*TargetItem
   PlaySound("menudown")
   framecnt=10
  end
  if contApusha>0.5 then
   launchxbe(getitemfilename(2, TargetItem))
   framecnt=10
  end
 
  if contApushy>0.5 then
   newscene("SKINS:\\xdash\\games.lua")
   framecnt=30
  end
 
  if contApushb>0.5 then
   newscene("SKINS:\\xdash\\mainmenu.lua")
   framecnt=10
  end
end

end

function render ()

BackRotation=BackRotation-0.0003

setfont("mainfont")

setrenderstate(102, 0)
setrenderstate(92, 0)
setrenderstate(59, 0)
setrenderstate(147, 0)
renderobject("outersphere", 3, 0, 0, 31, PI/2, BackRotation, 0, 1.3, 1.3, 1.3)


setrenderstateargb(75, 0, 0, 0, 0)

setupxray(1, 255, 0, 93, 199)
settexture("XRayMap", 0)
renderobject("crosshair", 0, -16, 0.95, 3, 0, 0, rad(Rotation), 0.5, 0.5, 0.5)
setupxray(0, 175, 0, 93, 199)

setrenderstate(102, 0)
setrenderstate(59, 0)
renderobject("xsphere", 1, -15, 0.95, 3, 0, -PI/18, 0, 0.5, 0.5, 0.5)


for i=0, menuitems-1 do
  mRot=Rotation-(25*i)
  alpha=255-abs(mRot)*4
  --if i>=TargetItem then
  if alpha>0 then
   itemx=(cos(mRot)*20)-16
   itemy=(sin(mRot)*20)+0.95
   setrenderstate(59, 1)
   setrenderstate(62, 32771)
   setrenderstate(63, 774)
   setrenderstateargb(75, alpha, 0, 0, 0)
   renderobject("storageitem", 1, itemx, itemy, 3, 0, 0, 0, 0.25, 0.25, 0.25)
   if abs(mRot)<=32 then
    setrenderstateargb(75, alpha*alpha/256, 0, 0, 0)
    renderobject("selectedmenuitem", 1, itemx, itemy, 3, 0, 0, 0, 0.25, 0.25, 0.25)
   end
   settextargb(alpha,255,255,255)
   textx=(cos(mRot)*147)+255
   texty=237-(sin(mRot)*147)
   rendertext(getitemstring(2,i), textx, texty)
  
  end
 
end

end

Edited by wyrp, 27 November 2004 - 11:14 PM.


#6 HoRnEyDvL

HoRnEyDvL

    Nexgen Developer

  • Head Moderators
  • PipPipPipPip
  • 906 posts
  • Gender:Male
  • Location:Australia
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 28 November 2004 - 02:46 AM

Nice Work WYRP smile.gif Wanna post some screens or something smile.gif

#7 wyrp

wyrp

    X-S Enthusiast

  • Members
  • 13 posts

Posted 28 November 2004 - 05:00 AM

I can't really take the credit for code, all I did was review and combine code from the main and apps/games lua's.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users