Why does this say version 4? http://www.facepunch.com/threads/1152030
I need help finding WAYWO :(
wow FUCK
Edited:
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
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)
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?
Likes this?
\[1\.1(.1)*\]
Edited:
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.
Repost from last thread.
Been messing around with GWEN as of lately but I can't seem to work this out.
TestApp.cpp
TestApp.hCode:#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"); }
You can see in onButtonA() I am trying to set the text of pButtonA from CreateButton(), although I am getting "identifier pButtonA is undefned"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(); };
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 // }
so
class TestApp : public Controls::Base { GWEN_CONTROL( TestApp, Controls::Base ); public: void onButtonA(); void CreateButton(); // // Add this here // private: Controls::Button* pButtonA; };
then
void TestApp::CreateButton() { // change // Controls::Button* pButtonA = new Controls::Button( this ); // to pButtonA = new Controls::Button(this); // ... }
Thanks!
Anyone know why Im getting this with linux when I try to run a SFML app?
I have all the libraries:Code:./SFMLTest: error while loading shared libraries: libsfml-graphics.so.2: cannot open shared object file: No such file or directory
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
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.
Odd bugs as I'm trying to get to grips with Love2d. Here's my main.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
And here's my camera class:
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
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
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 "]"
Is /usr/local/lib in your $PATH? That is my only guess as to whats wrong.
Doint a sudo ldconfig fixed it :P
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.
![]()
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.
Had to slightly modify it, but that worked much better. Thanks.
In Java/Android how can I use one class file with all my menu code over all of my views?
Untested.Code:public delegate void DoStuffDelegate(); public class Button { private DoStuffDelegate _function; public Button(DoStuffDelegate function) { _function = function; } public OnPress() { _function(); } }
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:string function = //Draw from input if(function == "this") return core_This(argNumber,input); else if(function == "that") ... else { cerr << "Unknown function."; Unwind(); }
First of all, here's a picture of my project:
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:
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?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
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.
![]()
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.
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.
So the last one should be faster.
http://www.facepunch.com/threads/116...1#post34974180
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++ )
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.
Thanks man! I guess that's what I get for blindly following obscure tutorials.
Ah yes, that's true. Forgot about that.
Directing my earlier post to yours.
How do I disable font smoothing in LÖVE?
I'm making my events.cpp file now, but I get linker errors when I use it.
events.cpp
// Events.cpp #ifndef _EVENTS #define _EVENTS class Hook{ public: void Func( ); Hook( ){ }; }; class Event{ private: Hook* HookedEvents[255]; int AMT; public: Event( ){ AMT = 0; } ~Event( ){ } void AddHook( Hook* MyHook ){ AMT = AMT + 1; HookedEvents[ AMT ] = MyHook; } void Call( ){ int a = 1; for ( a = 1; a <= AMT; a++){ Hook* CurrentHook = HookedEvents[ a ]; CurrentHook->Func(); } } }; #endif
Use:
// ... Event* OnDraw = new Event; // ... in a function OnDraw->Call(); // ... class MyDrawHook : public Hook { public: void Func(){ cout << "win"; } }; // In a function: MyDrawHook* MyDrawHook2 = new MyDrawHook; OnDraw->AddHook( reinterpret_cast<Hook*>(MyDrawHook2) );
any ideas?
Code:1>Main.obj : error LNK2001: unresolved external symbol "public: void __thiscall Hook::Func(void)" (?Func@Hook@@QAEXXZ)
You should be able to draw the text to a buffer and then nearest neighbour scale it up or down as required.
I don't think you can disable it otherwise unless you use a bitmap font.
I went ahead and checked it, turns out direct "if else" takes twice as long. Then I saw the update to your post. I thought switch statements were all optimized and fast and shit, but it makes a lot of sense to keep the function in the map, and just doing something like "return it->second". Thanks dudebros.
Thank Wyzard![]()
I wrote a simple C function to uppercase a string without altering the original. It works fine, except there's a weird bug that causes the 9th character to always change to the next letter in the alphabet (so r changes to s and a to b, etc.)
char* strtoupper(char* str) { char* strup = ""; int i; size_t i_max = sizeof(str) * sizeof(char*); for (i = 0; i < i_max; i++) { strup[i] = toupper(str[i]); } return strup; }
printf("%s", strtoupper("Character Stats")); // outputs 'CHARACTES STATS'
Any ideas on what's causing this?
I've recently been working on a sort of "Game Engine" in XNA and I've got entities down etc, but I'm not sure on how to store/load/display maps, I've been trying all day and all the examples like to use height maps which I have come to hate.
My question is basically what method should I look in to other than height maps for maps in an XNA project.
Maybe you could try using strlen to get the size of your string.
That works, but the output doesn't change![]()
You never allocate memory for strup. So you are probably getting some undefined behavior from writing to 'unallocated' memory.