It's not a harmless joke to break someone's computer.
[QUOTE=StonedGamer;39474874]Ok?[/QUOTE]
Don't ask our help when your intent is to do something illegal and incredibly shitty...... Go to hackforums or something
[QUOTE=StonedGamer;39474826]The point is to annoy someone like on a friends computer for joke, not to take peoples details or something[/QUOTE]
What, are you 10 years old? Grow up.
[QUOTE=Chris220;39474985]What, are you 10 years old? Grow up.[/QUOTE]
He very well could be 10 due to this being the main gmod forum.
Edit: Also the fact that his account name is... "account"
Ok I didn't look far up enough to see who's name it was, he's probably not actually 10. But he is acting like a 10 year old. :=D
[QUOTE=Topgamer7;39475112]He very well could be 10 due to this being the main gmod forum.
Edit: Also the fact that his account name is... "account"[/QUOTE]
You present a fair point, almost everyone in the programming subforum are so sensible and mature that I sometimes forget this forum was originally for Garry's Mod.
[QUOTE=Topgamer7;39475112]He very well could be 10 due to this being the main gmod forum.
Edit: Also the fact that his account name is... "account"[/QUOTE]
Um his account name is 'stonedgamer'..
Using C#, how would one make something happen every time an RSS feed updates? I am currently using XmlTextReader to grab the RSS feed.
Something like, "If the feed is updated, write a part of the XML to the console."
If it matters, [URL="https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=BBCBreaking"]I am using an RSS feed from twitter[/URL]
[QUOTE=mobrockers2;39475170]Um his account name is 'stonedgamer'..[/QUOTE]
Duly noted.
[QUOTE=The freeman;39475235]Using C#, how would one make something happen every time an RSS feed updates? I am currently using XmlTextReader to grab the RSS feed.
Something like, "If the feed is updated, write a part of the XML to the console."
If it matters, [URL="https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=BBCBreaking"]I am using an RSS feed from twitter[/URL][/QUOTE]
You just have to check the feed again and again for a new item in it.
Can someone [b]please[/b] look the MainMenu.cpp file and tell me why, after I click a MenuItem and then go back to the menu, if I move the mouse at all it makes the gamestate Playing?
[url]https://github.com/Tetramputechture/Yttra[/url]
-snip-
Anyone have any experience with X11? I'm trying to maximise a window in code. It all seems to be working, it's maximising the window properly but when I try and get the new size it's just telling me the old details.
I'm guessing it's because I need to get X to process the message I've just sent, but I don't know the best way to do this. Any ideas?
Here's the maximising code, so far.
[cpp]
Atom _NET_WM_STATE = XInternAtom(platwnd->display, "_NET_WM_STATE", false);
Atom _NET_WM_STATE_MAXIMIZED_HORZ = XInternAtom(platwnd->display, "_NET_WM_STATE_MAXIMIZED_HORZ", false);
Atom _NET_WM_STATE_MAXIMIZED_VERT = XInternAtom(platwnd->display, "_NET_WM_STATE_MAXIMIZED_VERT", false);
XEvent evt;
memset(&evt, 0, sizeof(evt));
evt.type = ClientMessage;
evt.xclient.serial = 0;
evt.xclient.send_event = true;
evt.xclient.display = platwnd->display;
evt.xclient.window = platwnd->window;
evt.xclient.message_type = _NET_WM_STATE;
evt.xclient.format = 32;
if(bMax)
{
evt.xclient.data.l[0] = 1; // _NET_WM_STATE_ADD;
} else {
evt.xclient.data.l[0] = 0; // _NET_WM_STATE_REMOVE;
}
evt.xclient.data.l[1] = _NET_WM_STATE_MAXIMIZED_HORZ;
evt.xclient.data.l[2] = _NET_WM_STATE_MAXIMIZED_VERT;
evt.xclient.data.l[3] = 0;
XSendEvent(platwnd->display,
RootWindow(platwnd->display, platwnd->screen), 0,
SubstructureNotifyMask | SubstructureRedirectMask, &evt);
XFlush(platwnd->display);
[/cpp]
Neither XGetWindowAttributes nor XGetGeometry are returning the new values when I call them immediately afterwards.
[QUOTE=Meatpuppet;39476930]Can someone [b]please[/b] look the MainMenu.cpp file and tell me why, after I click a MenuItem and then go back to the menu, if I move the mouse at all it makes the gamestate Playing?
[url]https://github.com/Tetramputechture/Yttra[/url][/QUOTE]
For one:
[code]return (*it).action;[/code]
Should be:
[code]return it->action;[/code]
Also, shouldn't "return Nothing;" be "return MenuResult.Nothing;"
I imagine your problem would be that you aren't actually getting a "hit" when you click on a MenuItem, however I can't really tell if it does or not without running the programming and debugging. Which I recommend you do.
[QUOTE=Topgamer7;39477409]For one:
[code]return (*it).action;[/code]
Should be:
[code]return it->action;[/code]
[/QUOTE]
Why not? It's completely valid.
[QUOTE=Topgamer7;39477409]
Also, shouldn't "return Nothing;" be "return MenuResult.Nothing;"
[/QUOTE]
In C++, you don't scope an enumerator tag.
[QUOTE=ief014;39477533]Why not? It's completely valid.[/QUOTE]
What's the point of having the operator if you aren't going to use it.
it's just synonymous syntax, really, it doesn't matter
[QUOTE=Meatpuppet;39477877]it's just synonymous syntax, really, it doesn't matter[/QUOTE]
Preference is preference I suppose, did you try debugging your problem in a debugger?
Wizards of Source Engine, please help.
I'm porting my WebSockets plugin from SourceMod to being a regular C++ plugin, using the WebSocket++ library. I actually have the server set up and able to communicate with clients, but when the plugin is unloaded, wither by the user or when the server shuts down, it crashes the server after a long wait period. Because the websockets server's listen function blocks, I'm running it in a separate thread (Boost::thread because it seemed easiest to use), like so:
[code]bool WebSpecPlugin::Load( CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory )
...
// Start WebSocket server and listen in a thread
...
listeningThread = thread(serverListen, webSockServerPtr);
...
}
void serverListen(websocketpp::server::ptr srvPtr) {
srvPtr->listen(serverPort);
return;
}[/code]
My Unload code looks like so:
[code]void WebSpecPlugin::Unload( void ) {
...
webSockServerPtr->stop();
listeningThread.detach(); //Have also tried combinations of .join() and .interrupt()
...
}[/code]
I know the websocket server does stop by a breakpoint on the return underneath, so I don't think that is the problem.
I've run thought it with a debugger, all the code is run, yet the server will hang and eventually give me this:
[code]threadtools.cpp (3366) : Assertion Failed: Probably deadlock or failure waiting for thread to initialize.[/code]
I'm assuming it's something to do with my thread not closing cleanly, but honestly have no idea, so any advice would be appreciated.
E: Also very new to C++, so if I'm doing something really silly please be gentle
[QUOTE=mechanarchy;39477279]Anyone have any experience with X11? I'm trying to maximise a window in code. It all seems to be working, it's maximising the window properly but when I try and get the new size it's just telling me the old details.
I'm guessing it's because I need to get X to process the message I've just sent, but I don't know the best way to do this. Any ideas?
Here's the maximising code, so far.
[cpp]
Atom _NET_WM_STATE = XInternAtom(platwnd->display, "_NET_WM_STATE", false);
Atom _NET_WM_STATE_MAXIMIZED_HORZ = XInternAtom(platwnd->display, "_NET_WM_STATE_MAXIMIZED_HORZ", false);
Atom _NET_WM_STATE_MAXIMIZED_VERT = XInternAtom(platwnd->display, "_NET_WM_STATE_MAXIMIZED_VERT", false);
XEvent evt;
memset(&evt, 0, sizeof(evt));
evt.type = ClientMessage;
evt.xclient.serial = 0;
evt.xclient.send_event = true;
evt.xclient.display = platwnd->display;
evt.xclient.window = platwnd->window;
evt.xclient.message_type = _NET_WM_STATE;
evt.xclient.format = 32;
if(bMax)
{
evt.xclient.data.l[0] = 1; // _NET_WM_STATE_ADD;
} else {
evt.xclient.data.l[0] = 0; // _NET_WM_STATE_REMOVE;
}
evt.xclient.data.l[1] = _NET_WM_STATE_MAXIMIZED_HORZ;
evt.xclient.data.l[2] = _NET_WM_STATE_MAXIMIZED_VERT;
evt.xclient.data.l[3] = 0;
XSendEvent(platwnd->display,
RootWindow(platwnd->display, platwnd->screen), 0,
SubstructureNotifyMask | SubstructureRedirectMask, &evt);
XFlush(platwnd->display);
[/cpp]
Neither XGetWindowAttributes nor XGetGeometry are returning the new values when I call them immediately afterwards.[/QUOTE]
I was under the impression that setting the maximized flags doesn't actually change the window size. You could get the root window's dimensions to know how big a maximized window is.
I'm completely new to Python (a few weeks), and as part of my exercises, Learn Python the Hard Way, I got the assignment to make something using if statements. I decided to create a character creator where you put points into two stats (Body and Mind), using while loops and if statements. I got it working without bugs as far as I can tell, I was just wondering if this was the easiest way to do it, or if there was a much easier way. Thank you!
[url]http://pastebin.com/8kaeLu0z[/url]
[QUOTE=The freeman;39475235]Using C#, how would one make something happen every time an RSS feed updates? I am currently using XmlTextReader to grab the RSS feed.
Something like, "If the feed is updated, write a part of the XML to the console."
If it matters, [URL="https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=BBCBreaking"]I am using an RSS feed from twitter[/URL][/QUOTE]
Compare the pubDate of each item with the latest one you have locally? The Last-Modified HTTP header seems to change with every refresh.
-shameless snip-
How can I make component systems look less ugly? Right now I would get the component pointer from an entity, then cast it to the desired component. Is there a way to get the component, but not have to cast it as it is already cast to it's type? This is in C++.
[QUOTE=WTF Nuke;39483675]How can I make component systems look less ugly? Right now I would get the component pointer from an entity, then cast it to the desired component. Is there a way to get the component, but not have to cast it as it is already cast to it's type? This is in C++.[/QUOTE]
Use a template:
[cpp]
// Headers
#include <algorithm>
#include <typeinfo>
// Function
template<typename T> T* Entity::getComponent()
{
return (T*)*std::find_if(begin(components), end(components), [](Component* c) {
return typeid(*c) == typeid(T);
});
}
[/cpp]
Use it like this:
[cpp]
MyComponent* myComponent = entity.getComponent<MyComponent>();
[/cpp]
Of course this doesn't cover error checking (the case where the entity doesn't have the component you're requesting, but I don't think that will be hard to implement.
[QUOTE=ArgvCompany;39484159]Use a template:
[cpp]
// Headers
#include <algorithm>
#include <typeinfo>
// Function
template<typename T> T* Entity::getComponent()
{
return *std::find_if(begin(components), end(components), [](Component* c) {
return typeid(*c) == typeid(T);
});
}
[/cpp]
Use it like this:
[cpp]
MyComponent* myComponent = entity.getComponent<MyComponent>();
[/cpp]
Of course this doesn't cover error checking (the case where the entity doesn't have the component you're requesting, but I don't think that will be hard to implement.[/QUOTE]
How would I do this if I have a map and want to get the data by it's string key? I don't think I'll have multiple components of the same type, but would be nice to know nonetheless.
[QUOTE=WTF Nuke;39484237]How would I do this if I have a map and want to get the data by it's string key? I don't think I'll have multiple components of the same type, but would be nice to know nonetheless.[/QUOTE]
You could either use typeid(T).name() as key, or just change the key type to std::type_info and use typeid(T) as key.
Edit: Oh, now I understand. I'll write you a snippet when I get back to my computer.
This is a dumb question, but how do I cast the thing to the correct type?
Pretty sure you do this:
[cpp]MyComponent myComponent = (MyComponent) entity.getComponent();[/cpp]
At least that's how you do it in Java
[QUOTE=WTF Nuke;39484333]This is a dumb question, but how do I cast the thing to the correct type?[/QUOTE]
MyComponent* myComponent = (MyComponent*) component;
As for the snippet, let's say your getComponent function looks like this:
[cpp]
Component* Entity::getComponent(std::string name)
{
*Your lookup procedure*
return *the result*;
}
[/cpp]
Make it look like this instead:
[cpp]
template<typename T> T* Entity::getComponent(std::string name)
{
*Your lookup procedure*
return (T*)*the result*;
}
[/cpp]
Unfortunately this will force you to move the function body to a .h(pp) file instead of a .cpp file.
Sorry, you need to Log In to post a reply to this thread.