Jump to content

Mordred

Members
  • Posts

    118
  • Joined

  • Last visited

Everything posted by Mordred

  1. Hey YouGroove, thanks for your hint, even though i might not get into that, i do appreciate you taking the time to explain it. The Problem using 3d menues is: I think it works as an initial menu, like "Game start", "Load", "Settings" and such, everything where you do not have to move. But in my case i want to open / close the menue whenever i want to, and i think it's more hardwarehungry (and harder to achieve) to have "hidden" 3d objects moving arround with the player as a simple 2d drawn menue. I'd say that just feels like shooting with a cannon on birds
  2. Because i do not see any reason why i should make a simple menue in 3d, it seems to be harder to achieve as a simple 2d menue and the functionality would be the same. It's just the "lag" problem, but i gonna try to move the stuff into App:UpdateWorld() today, look if it works better If not i can still give it a try to make it 3d. Even though i have no idea how to "show" / "hide" a menue made with 3d stuff O_o The menue itself shall not only show the character panel, but depending on the clicks the inventory and such later too, so a simple "left this, right this" might be too much, especially since i haven't all skills and such in that code, it's just an example for myself to see how it works.
  3. mhmm I'm still struggling with that. I did think about the suggestion you made Rick, and i came to the conclusion that it should work somehow different. The problem is, if i do it the way you showed me i would have another variable that i need to fill and i already use like 10 or 15 for those menu buttons. I think that's too much. I believe the problem is, that i run the code within the "PostRender" function and the more buttons i click (and thus menus i open) the lower the FPS goes and thus the longer the engine needs to check if there has been clicked on a specific place. But as soon as i try to switch the "MouseHit" Events into App:Loop function i only get a white screen followed by a crash (no errormessage). So my idea, to make a own function for "ButtonClick" doesn't work too. Now i added the function "ButtonClick" into the PostRender and removed the corresponding code from my "Menu" function and it works a bit better, but i still have the issue that several clicks are not accepted. As said, the more menues i open, the more often i do get that problem. Here's a newer version of the code at pastebin http://pastebin.com/KXcQRmNW Any other suggestions to prevent that problem is mostly welcome. So, again it basically works, but it does not feel "native"
  4. Hey Rick, thanks a lot for that reply, i was already quite sure that there's something like that (well, not really that, but that i did smth. in the wrong place) leading to my issues. Your example sound's really reasonable and i think that might help. I'll give it a try later (maybe tomorrow). And to answer your question: Yes, i do use "MouseHit", since i didn't want to test if someone is keeping the button pressed but just if it was "hit", that seemed at that time to be quite reasonable for what i tried to achieve. Again my thanks for pointing that out, i appreaciate your help as usual!
  5. Hello fellow Leadwerkers, it's been a few days since i asked my last question, but i have a new one now . I'm tring to setup a basic 2d HUD with menues and such ("Play", "Exit", "Character", "Stats" etc.). That stuff is basically up and running, you can hover over buttons, click buttons, the visible buttons do change as intended and such, but i have 2 problems i might need help / suggestions. 1. Sometimes i have to click several times before the engine actually accepts my input, that just does not feel really native as i expect to click one time on a button and see the result in "an instant" 2. If i show the mouse graphics when opening the menue, it takes roughly 3 seconds befor it's actually shown. The same if i disable the mouse cursor it's still shown for about 3 seconds before it's gone. I believe that the problems might come due to the fact that i use several if statements within the postrender to check the currenct mousepos and, if clicked, to switch different variables to save internally if a button is clicked and if yes, which one it was, to show the coressponding menues. Where should i do those checks instead of the PostRenderer? Or how am i able to increase the reaction time of the events? The code is quite basic, and it uses several if statements and for loops to draw buttons / check the position, so i think there's potential to make the development better too, so in case you have any suggestions / hints for me you're mostly welcome. I think the code is important to check to answer my question, so i did paste it at pastebin, and here's the link. http://pastebin.com/Xw0G4LPt Thanks for your replys in advance! [Edit] Here's a small video showing the problems. As you can see at the beginning the "Start" button top left is flickering several times, there i try to move the cursor on it, but i cannot see it. It "pops" up later. And you might see the cursor itself flickering several times when i try to click a button but the engine doesn't respont within the expected time.
  6. Hey Rick, i did import several .r32 files from Worldmachine without problem. So that def. works
  7. Afaik there will be more tutorials coming, the only question is "when" until then i try to get used to the API by myself with trying "this and that" stuff hehe. Atm.: I'm quite stuck with some inventory system. I'm not sure how to start it so that it works in the end. I was able to make a little textbased system that did work (even logging and stonecutting was already in) but now i'm trying to set it graphically up and yea, well, that's not so easy hehe. But i'm reading about it so only a matter of time i'd say.
  8. If it's about learning, count me in, i'm newbie myself and doing it in the past days anyways, sadly my vacation is over so the time is becoming a bit low, but an hour or 2 a day should mostly be possible . My Steam ID is masterqgj --> the steamname should be like [DooM]QuiGonJinn @ Others - feel free to add me too if you want
  9. I just did mess a bit arround with context:DrawImage, DrawText and MouseHit to get into the art of creating a HUD / GUI. Well, not much to see, but here's a little video (no sound)
  10. I'd really like to see the ability to use Ctrl. + Cursor (for e.g. "Arrow left") to jump one word in the corresponding direction. That already works in combination with "shift" (you're selecting the whole word when using shift + ctrl + cursor) but not without shift. Might be a bug due to the fact that it works using "Shift + Ctrl. + Cursor"?
  11. It seems as if you own the Indie Edition of Leadwerks? That's LUA only, the C++ Edition isn't released yet.
  12. Ah okay, i remembered you saying "never touch app.lua" so i didn't even think about it Thanks again, that does work.
  13. Okay, i did change that too, i gonna edit my previous posting and edit the file too Btw. how can i make it so that hitting the "Exit" button actually does close the window from within the function? I cannot use "return false end" (--> just does nothing) and there's no "Window:Close()" function. Or do i have to use "Window:Release()"?
  14. Hey Rick, thanks again for explaining it, i had feard in the first place that i somewhere did change "context" to get the error, but luckily it was easier than that . Okay, now in case someone is interested in knowing the result / maybe someone might use this as a hint on how to start, i made a simple script that opens a small menu when hitting "T" within the game, if you hover your mouse over the "start" button it switches to a green colored texture file, if you press the mouse the text shown switches between "Start" and "Hit!". It's far from being finished yet, but maybe it's usefull for some newbies like me I gonna attach it at this posting. Basic_Menu.zip
  15. And again it's Rick Thanks for your reply, as mentioned in my edit above the error itself is already found. But thanks for your further suggestions. The context wasn't passed in this special snipplet, since i already had my changes redone. So, if i understand you correctly the "button = Texture:Load...." in the "Script:Start" is global too and should therefore be "self.button"?
  16. Hello Leadwerkers, i have an issue that i really do not understand. I have made a function that draws basically an image, depending of the mouse position ("hover over Button"). I need to have access to the "current context" within this function, but as soon as i try to get access to the "Context:GetCurrent()" i do get a crash (no errormessage in Leadwerks, just "MyGame.exe has stopped running"). I tried it the following ways. 1st: define "context" within the function --> context = Context:GetCurrent() --> results in crash 2nd: define "context" as globa within the whole script --> "context = Context:GetCurrent()" in the first row --> crash 3rd: Passing "context" from the PostRender into the function like: "function menu (context, label, x, y)--> crash. 4th: creating another context named "xcontext = Context:GetCurrent()" to prevent from using the same variable twice --> crash. Now my problem is: Why does the game crash at launch as soon as i try to pass or access the context into or within the function? I do have to pass the context somehow into the function or the "context" within the function will be unknown. For a better understanding here's the script (the error occurs within the "menu" function): Script.player = nil --entity "Player" function Script:Start() window = Window:GetCurrent() local context = Context:GetCurrent() self.button = Texture:Load("Materials/HUD/Btn_not_pressed.tex") self.button_pressed = Texture:Load("Materials/HUD/Btn_pressed.tex") local font = Font:Load("Materials/Fonts/arial.ttf", 20) context:SetFont(font) font:Release() context:Release() end function Script:HUD() end local menuopen = 0 function Script:PostRender(context) local windowWidth = window:GetWidth() local windowHeight = window:GetHeight() if window:KeyHit(Key.T) then if menuopen == 0 then menuopen = 1 else menuopen = 0 end end if menuopen == 1 then context:Clear() context:SetColor(1,1,1) context:SetBlendMode(Blend.Alpha) end menu("Start", 9, 7) context:SetBlendMode(Blend.Solid) end function menu(label, x, y) local mousepos = window:GetMousePosition() local mx = mousepos.x local my = mousepos.y window:ShowMouse() if mx >= x and my >= y and mx <= x+200 and my <= y+35 then context:DrawImage(button_pressed, x, y) context:DrawText(label, x+5, y+3) else context:DrawImage(button, x, y) context:DrawText(label, x+5, y+3) end end [Edit] Found my error, i defined the button variables as "self.button" and tried to access them via "button" since "self.button" didnt work in the funtion. I renamed the variables to plain "button" (instead of self.) and it did work. Yay, the context wasn't the error at all!
  17. The 3.1 preorder contains the posibillity to code in C++ while the "Indie Edition" only supports LUA Scripting (it's still quite powerfull, but C++ offers a few more possibilitys i'd say). At least if you can programm in C++ or you want to learn it.
  18. I think he mean's within the viewport, the 3d view in the top left. But i neither think that this is possible, nor am i sure why one would want that in the editor.
  19. if you're doing this, maybe you could add the parameters for the PostEffects stuff, that's now in the betachannel too? That'll be cool and makes it easier to look for it
  20. Well, in this example case it's grassdirt_d.tex and grassdirt_h.tex followed by, but not only: grassdirt_s.tex, (new model --> generated .mat file will be tree2branch.mat) tree2branch_d.text, tree2branch_n.tex (that's actuall really a "normal" file), tree2branch_s.tex, [...] the list continues. But every single example i had issues with had an "underscore" in its name.
  21. @ Rick. I continued testing, it's possible like shown in this image. http://imageshack.com/a/img691/2664/m9je.png You can remove the childnode by drag n dropping it in the scene tab onto "Root", and then delete the model. That did happen to me by accident when i tried to drag n drop the "camera" onto my "fps controller". After that i deleted the model itself for some reason and got the crash the next time i loaded the map.
  22. Maybe my mistake/s was/were so big that he couldn't resists replying
  23. Yea, well, that there's no real benefit in doing so is clear now, thanks to your explanations. I actually saw that quote you postet before too but i didn't read it, because it was statet as "OsX and FreeBSD" and since i use windows i didn't bother reading it. Well, maybe i should change my behaviour a bit. Thank you again for pointing me to this
  24. Hey Marleys Ghost, thanks for explaining it in such detail. I did missunderstood what was written in that wiki. Now that i did put the "randomseed" into app.lua i do not have any issues at all. Besides, i had a builtin error made by myself too (as stated before). Yet i'm quite sure that my "randomseed" within the loop would work since i changed the seed myself everytime by adding "+i" ontop of the initial value. Or am i wrong with that too? Basically i do understand it as: - - First run --> randomseed is os.time() - second run --> randomseed is os.time() + 10 - third run --> randomseed is os.time() + 20 and thus the seeds differ?
×
×
  • Create New...