• What do you need help with? Version 5
    5,752 replies, posted
  • Avatar of Staneh
  • Post all the non-thread-worthy questions in this thread. [url=http://www.facepunch.com/threads/1092921]V1[/url] [url=http://www.facepunch.com/threads/1053117]V2[/url] [url=http://www.facepunch.com/threads/1092921]V3[/url] [url=http://www.facepunch.com/threads/1152030]V4[/url] Let's ask some questions!
  • Why does this say version 4? [url]http://www.facepunch.com/threads/1152030[/url]
  • Avatar of Staneh
  • [QUOTE=miceiken;34944828]Why does this say version 4? [url]http://www.facepunch.com/threads/1152030[/url][/QUOTE] wow FUCK [editline]1st March 2012[/editline] [QUOTE=Nigey Nige;34944848]I need help finding WAYWO :([/QUOTE] Waywo should be made really soon by Overv.
  • Does anyone have any good resources/an opinion on CUDA vs DirectCompute vs OpenCL? I'm entirely lost as to where to begin/which one to pick Edit: Decided to go with OpenCL, due to working on several hardware brands not just nvidia, and also because it isn't reliant on directx, which i am trying to avoid
  • Avatar of vexx21322
  • I ran into something that I can't quite understand, using regular expressions in javascript. I know this sounds like it should go in web development, but this isn't going towards the development of a webpage. (userscript) [Img]http://puu.sh/j7eN[/Img] I want it to match both 1.1 and 1.1.+ but also have the brackets be a lazy match. Does anyone know the correct regular expression for this?
  • Avatar of swebonny
  • Likes this? \[1\.1(.1)*\] [editline]2nd March 2012[/editline] Basically checks if the value that comes after "[1.1" is (.1) and then check if it appears zero or more times then add bracket.
  • Avatar of Superbird
  • Repost from last thread. Been messing around with GWEN as of lately but I can't seem to work this out. TestApp.cpp [CODE]#include "TestApp.h" GWEN_CONTROL_CONSTRUCTOR( TestApp ) { Dock( Pos::Fill ); CreateButton(); } void TestApp::CreateButton() { Controls::Button* pButtonA = new Controls::Button( this ); pButtonA->SetText( L"Start" ); pButtonA->onPress.Add( this, &TestApp::onButtonA ); pButtonA->SetPos(75, 175); } void TestApp::onButtonA() { pButtonA->SetText("lol"); }[/CODE]TestApp.h [CODE]#pragma once #include "Gwen/Gwen.h" #include "Gwen/Controls.h" #include "Gwen/Controls/Layout/Position.h" #include "Gwen/Controls/WindowControl.h" using namespace Gwen; /* The base panel */ class TestApp : public Controls::Base { GWEN_CONTROL( TestApp, Controls::Base ); public: void onButtonA(); void CreateButton(); };[/CODE]You can see in onButtonA() I am trying to set the text of pButtonA from CreateButton(), although I am getting "identifier pButtonA is undefned"
  • Avatar of mechanarchy
  • [QUOTE=Superbird;34957687]Repost from last thread. Been messing around with GWEN as of lately but I can't seem to work this out. [/QUOTE] [cpp] void TestApp::CreateButton() { Controls::Button* pButtonA = new Controls::Button( this ); pButtonA->SetText( L"Start" ); pButtonA->onPress.Add( this, &TestApp::onButtonA ); pButtonA->SetPos(75, 175); // // pButtonA goes out of scope here and is no longer defined // } [/cpp] so [cpp] class TestApp : public Controls::Base { GWEN_CONTROL( TestApp, Controls::Base ); public: void onButtonA(); void CreateButton(); // // Add this here // private: Controls::Button* pButtonA; }; [/cpp] then [cpp] void TestApp::CreateButton() { // change // Controls::Button* pButtonA = new Controls::Button( this ); // to pButtonA = new Controls::Button(this); // ... } [/cpp]
  • Avatar of Richy19
  • Anyone know why Im getting this with linux when I try to run a SFML app? [code]./SFMLTest: error while loading shared libraries: libsfml-graphics.so.2: cannot open shared object file: No such file or directory [/code] I have all the libraries: [code]richy@richy-Len:/usr/local/lib$ dir Box2D libcsfml-system.so libsfml-graphics.so.2 libBox2D.a libcsfml-system.so.2 libsfml-graphics.so.2.0 libBox2D.so libcsfml-system.so.2.0 libsfml-network-d.so libBox2D.so.2.1.0 libcsfml-window-d.so libsfml-network-d.so.2 libcsfml-audio-d.so libcsfml-window-d.so.2 libsfml-network-d.so.2.0 libcsfml-audio-d.so.2 libcsfml-window-d.so.2.0 libsfml-network-s.a libcsfml-audio-d.so.2.0 libcsfml-window.so libsfml-network.so libcsfml-audio.so libcsfml-window.so.2 libsfml-network.so.2 libcsfml-audio.so.2 libcsfml-window.so.2.0 libsfml-network.so.2.0 libcsfml-audio.so.2.0 libsfgui-d.so libsfml-system-d.so libcsfml-graphics-d.so libsfgui-s.a libsfml-system-d.so.2 libcsfml-graphics-d.so.2 libsfgui-s-d.a libsfml-system-d.so.2.0 libcsfml-graphics-d.so.2.0 libsfgui.so libsfml-system-s.a libcsfml-graphics.so libsfml-audio-d.so libsfml-system.so libcsfml-graphics.so.2 libsfml-audio-d.so.2 libsfml-system.so.2 libcsfml-graphics.so.2.0 libsfml-audio-d.so.2.0 libsfml-system.so.2.0 libcsfml-network-d.so libsfml-audio-s.a libsfml-window-d.so libcsfml-network-d.so.2 libsfml-audio.so libsfml-window-d.so.2 libcsfml-network-d.so.2.0 libsfml-audio.so.2 libsfml-window-d.so.2.0 libcsfml-network.so libsfml-audio.so.2.0 libsfml-window-s.a libcsfml-network.so.2 libsfml-graphics-d.so libsfml-window.so libcsfml-network.so.2.0 libsfml-graphics-d.so.2 libsfml-window.so.2 libcsfml-system-d.so libsfml-graphics-d.so.2.0 libsfml-window.so.2.0 libcsfml-system-d.so.2 libsfml-graphics-s.a pkgconfig libcsfml-system-d.so.2.0 libsfml-graphics.so python2.7 [/code]
  • Avatar of vexx21322
  • [QUOTE=Swebonny;34957620]Likes this? \[1\.1(.1)*\] [editline]2nd March 2012[/editline] Basically checks if the value that comes after "[1.1" is (.1) and then check if it appears zero or more times then add bracket.[/QUOTE] Should have been a little more clear. I don't care what comes after the 1.1, but this actually works fine for what I need right now. Thanks.
  • Avatar of Nigey Nige
  • Odd bugs as I'm trying to get to grips with Love2d. Here's my main.lua: [lua]require "camera.lua" function love.load() love.graphics.setBackgroundColor(0, 0, 150) love.graphics.setMode(800, 600, false, true, 0) end function love.update(dt) if (love.keyboard.isDown("a")) then camera.move(-1, 0) end if (love.keyboard.isDown("d")) then camera.move(1, 0) end if (love.keyboard.isDown("s")) then camera.move(0, 1) end if (love.keyboard.isDown("w")) then camera.move(0, -1) end if (love.keyboard.isDown("e")) then camera.rotate(1) end if (love.keyboard.isDown("q")) then camera.rotate(-1) end end function love.draw() camera:set() --draw stuff love.graphics.print("NIGEY NIGE", 300, 300) camera:unset() end [/lua] And here's my camera class: [lua]camera = {} camera.x = 0 camera.y = 0 camera.scaleX = 1 camera.scaleY = 1 camera.rotation = 0 function camera:set() love.graphics.push() love.graphics.rotate(-camera.rotation) love.graphics.scale(1 / camera.scaleX, 1 / camera.scaleY) love.graphics.translate(-camera.x, -camera.y) end function camera:unset() love.graphics.pop() end function camera:move(dx, dy) camera.x = camera.x + (dx or 0) camera.y = camera.y + (dy or 0) end function camera:rotate(dr) camera.rotation = camera.rotation + dr end function camera:scale(sx, sy) sx = sx or 1 camera.scaleX = camera.scaleX * sx camera.scaleY = camera.scaleY * (sy or sx) end function camera:setPosition(x, y) camera.x = x or camera.x camera.y = y or camera.y end function camera:setScale(sx, sy) camera.scaleX = sx or camera.scaleX camera.scaleY = sy or camera.scaleY end[/lua] The camera only moves when I press W or S, and then it moves sideways rather than up and down. I don't even know what the fuck
  • Avatar of swebonny
  • [QUOTE=vexx21322;34958409]Should have been a little more clear. I don't care what comes after the 1.1, but this actually works fine for what I need right now. Thanks.[/QUOTE] Ah okay, then you can simply use \w (represents [a-zA-Z_0-9]). \[1\.1(.\w*)*\], it should now match with anything that starts with "[1.1" and ends with "]"
  • [QUOTE=Richy19;34958382]Anyone know why Im getting this with linux when I try to run a SFML app? [code]./SFMLTest: error while loading shared libraries: libsfml-graphics.so.2: cannot open shared object file: No such file or directory [/code] I have all the libraries: [code]richy@richy-Len:/usr/local/lib$ dir Box2D libcsfml-system.so libsfml-graphics.so.2 libBox2D.a libcsfml-system.so.2 libsfml-graphics.so.2.0 libBox2D.so libcsfml-system.so.2.0 libsfml-network-d.so libBox2D.so.2.1.0 libcsfml-window-d.so libsfml-network-d.so.2 libcsfml-audio-d.so libcsfml-window-d.so.2 libsfml-network-d.so.2.0 libcsfml-audio-d.so.2 libcsfml-window-d.so.2.0 libsfml-network-s.a libcsfml-audio-d.so.2.0 libcsfml-window.so libsfml-network.so libcsfml-audio.so libcsfml-window.so.2 libsfml-network.so.2 libcsfml-audio.so.2 libcsfml-window.so.2.0 libsfml-network.so.2.0 libcsfml-audio.so.2.0 libsfgui-d.so libsfml-system-d.so libcsfml-graphics-d.so libsfgui-s.a libsfml-system-d.so.2 libcsfml-graphics-d.so.2 libsfgui-s-d.a libsfml-system-d.so.2.0 libcsfml-graphics-d.so.2.0 libsfgui.so libsfml-system-s.a libcsfml-graphics.so libsfml-audio-d.so libsfml-system.so libcsfml-graphics.so.2 libsfml-audio-d.so.2 libsfml-system.so.2 libcsfml-graphics.so.2.0 libsfml-audio-d.so.2.0 libsfml-system.so.2.0 libcsfml-network-d.so libsfml-audio-s.a libsfml-window-d.so libcsfml-network-d.so.2 libsfml-audio.so libsfml-window-d.so.2 libcsfml-network-d.so.2.0 libsfml-audio.so.2 libsfml-window-d.so.2.0 libcsfml-network.so libsfml-audio.so.2.0 libsfml-window-s.a libcsfml-network.so.2 libsfml-graphics-d.so libsfml-window.so libcsfml-network.so.2.0 libsfml-graphics-d.so.2 libsfml-window.so.2 libcsfml-system-d.so libsfml-graphics-d.so.2.0 libsfml-window.so.2.0 libcsfml-system-d.so.2 libsfml-graphics-s.a pkgconfig libcsfml-system-d.so.2.0 libsfml-graphics.so python2.7 [/code][/QUOTE] Is /usr/local/lib in your $PATH? That is my only guess as to whats wrong.
  • Avatar of Richy19
  • [QUOTE=high;34959440]Is /usr/local/lib in your $PATH? That is my only guess as to whats wrong.[/QUOTE] Doint a sudo ldconfig fixed it :P
  • Avatar of Funley
  • In XNA, i have a tilemap. Every tile in it is stored in a list. I need to store the sandpath in a separate list but still have it in the normal tile list. The path pieces have to be ordered in the list so that the first piece in the list is the one next to the green blob (start), the rest ordered on how the path goes and the last is next to the gray square (end). I have no idea how to do this. I added some numbers to the image to simply show how i want the ordered. [t]http://i.imgur.com/xqyV1.png[/t]
  • Avatar of Richy19
  • With C# is it possible to pass a function as a parameter? I wanst to make a button class, but I want to pass it a function to call if its clicked on.
  • Avatar of vexx21322
  • [QUOTE=Swebonny;34959002]Ah okay, then you can simply use \w (represents [a-zA-Z_0-9]). \[1\.1(.\w*)*\], it should now match with anything that starts with "[1.1" and ends with "]"[/QUOTE] Had to slightly modify it, but that worked much better. Thanks.
  • Avatar of affail
  • In Java/Android how can I use one class file with all my menu code over all of my views?
  • [QUOTE=Richy19;34959710]With C# is it possible to pass a function as a parameter? I wanst to make a button class, but I want to pass it a function to call if its clicked on.[/QUOTE] [code] public delegate void DoStuffDelegate(); public class Button { private DoStuffDelegate _function; public Button(DoStuffDelegate function) { _function = function; } public OnPress() { _function(); } } [/code] Untested.
  • Avatar of Eudoxia
  • Suppose you have an interpreter that needs to look up the name of the function you're calling to decide what to do, which would be faster? [CODE] enum function_codes {core_this, core_that,...} map<string,function_codes> language_core; string function = //Draw from input if(language_core.find(function) != language_core.end()) { function_codes code = it->second; switch(code) { case core_this: return core_This(argNumber,input); break; ... } } [/CODE] [CODE] string function = //Draw from input if(function == "this") return core_This(argNumber,input); else if(function == "that") ... else { cerr << "Unknown function."; Unwind(); } [/CODE]
  • Avatar of PortalGod
  • First of all, here's a picture of my project: [img]http://puu.sh/jdSv[/img] the panel with the border on the right is named "Tiles". That PictureBox you see is named "tile1", and is the only thing inside the Tiles panel. In my code, I have this: [code]For chkTile = 1 To Count Dim oldTile As PictureBox = Tiles.Controls.Item("tile" & chkTile) pbOrig.Image = oldTile.Image pbNew.Image = Tile isOld = CompareTiles(oldTile.Image, Tile) Next[/code] where Count is the number of elements in the "Tiles" panel (1), pbOrig is the small picturebox you see on the right at the bottom, and pbNew is the one on the left. pbOrig's image should be the same as the one is the "Tiles" panel, but it's the same as the "Tile" variable. Can anyone help?
  • Avatar of ZenX2
  • [QUOTE=Nigey Nige;34958976]Odd bugs as I'm trying to get to grips with Love2d. Here's my main.lua: -snop- And here's my camera class: -snop- The camera only moves when I press W or S, and then it moves sideways rather than up and down. I don't even know what the fuck[/QUOTE] You're using : when defining it. This is for methods, and it's a bit a syntactic sugar. Basically, now, when you define camera:move(dx, dy), lua interprets this as camera.move(self, dx, dy). "self" is the table calling the function if you use table:method() Because of this, when you are calling camera.move(1, 0) or a variation of that, you're passing 1 as self, and 0 as dx. Also, I just realized that I made v2 over a year ago. I hadn't realized that I've been chilling with you guys for that long. [img]http://www.facepunch.com/fp/ratings/heart.png[/img]
  • Just a quick one, I'm getting started with Java programming (uni related, but I'm not complaining), using sublime for writing it and a command prompt (or terminal, depending on which computer I'm using) to compile and run it. Now I made a quick first project which takes say "30C" and interprets it as 30 degrees to be converted from Celsius to Fahrenheit - this works perfectly, and I even found out I could make it use Swing prompts and messages instead of relying on standard outputs and inputs with the terminal. .. But I can't run the .class outside of a terminal. It only functions if I run it via "java DegreesConversion" in a terminal, at which point the prompts appear and it functions as intended (without any communication to or from the terminal). When I launch the .class outside of the terminal (i.e. running it with the JRE in Ubuntu or in Windows), the loading cursor appears for half a second and disappears. I'm not sure if this is because I'm just using a single .class? Has it got something to do with dependencies? I come from a .NET background so uh, I'm a bit stuck here.
  • Avatar of swebonny
  • [QUOTE=Eudoxia;34963587]Suppose you have an interpreter that needs to look up the name of the function you're calling to decide what to do, which would be faster? [CODE] enum function_codes {core_this, core_that,...} map<string,function_codes> language_core; string function = //Draw from input if(language_core.find(function) != language_core.end()) { function_codes code = it->second; switch(code) { case core_this: return core_This(argNumber,input); break; ... } } [/CODE] [CODE] string function = //Draw from input if(function == "this") return core_This(argNumber,input); else if(function == "that") ... else { cerr << "Unknown function."; Unwind(); } [/CODE][/QUOTE] I checked the map reference, and it stated that the ".find" executes in logarithmic time, [del]while your second code seems to do things in constant time. So the last one should be faster.[/del] [url]http://www.facepunch.com/threads/1167392?p=34974180&viewfull=1#post34974180[/url]
  • Avatar of James
  • I'm having a couple problems with a program I am making. I tried to get Lua in my project , except I get a link error each time and I have no clue why. I'm also trying to make an event system ( like the hook library in Garry's mod ) except I don't know how to store a function in an array ( and call it ). I would be extremely grateful if someone could help me out here. ( Ps : It's in c++ )
  • Avatar of Wyzard
  • [QUOTE=Swebonny;34972962]I checked the map reference, and it stated that the ".find" executes in logarithmic time, while your second code seems to do things in constant time. [/QUOTE] An if/else stack runs in linear time; the number of conditions that have to be tested varies linearly with the total number of conditions. (On average, it'll be about half of them.) The map lookup is faster, but the switch(code) that follows it runs in linear time, which negates the benefit. It'd be better to have the object in the map contain a pointer to the function, or be a callable object itself, so that you don't have to do that second lookup after finding the map entry.
  • Avatar of Nigey Nige
  • [QUOTE=ZenX2;34969421]You're using : when defining it. This is for methods, and it's a bit a syntactic sugar. Basically, now, when you define camera:move(dx, dy), lua interprets this as camera.move(self, dx, dy). "self" is the table calling the function if you use table:method() Because of this, when you are calling camera.move(1, 0) or a variation of that, you're passing 1 as self, and 0 as dx. Also, I just realized that I made v2 over a year ago. I hadn't realized that I've been chilling with you guys for that long. [img]http://www.facepunch.com/fp/ratings/heart.png[/img][/QUOTE] Thanks man! I guess that's what I get for blindly following obscure tutorials.
  • Avatar of swebonny
  • [QUOTE=Wyzard;34974180]An if/else stack runs in linear time; the number of conditions that have to be tested varies linearly with the total number of conditions. (On average, it'll be about half of them.) The map lookup is faster, but the switch(code) that follows it runs in linear time, which negates the benefit. It'd be better to have the object in the map contain a pointer to the function, or be a callable object itself, so that you don't have to do that second lookup after finding the map entry.[/QUOTE] Ah yes, that's true. Forgot about that. Directing my earlier post to yours.