• What Do You Need Help With? V6
    7,544 replies, posted
[QUOTE=Philly c;42513348]What are you actually trying to do? You can't just convert a character to a virtual key code, it doesn't make sense. If you're trying to get the keys pressed that resulted in a certain character then you'll need to ask windows, if it's even possible. If you want to convert a string like "A" or "1" or "Escape" to the key code then you'll just have to do it yourself. If you wanted to input text to a window then send WM_CHAR messages.[/QUOTE] I was wondering this as well, but decided not to say anything since I have no experience with c++ :v:
[QUOTE=ZeekyHBomb;42512595]It specifies a tint, meaning the color gets multiplied to each pixel of the sprite. Can you give an example string and the expected output?[/QUOTE] Hah, thanks for the tip. Changed it to, [code] int R = (pixel.R * Color.R) / 255; int G = (pixel.G * Color.G) / 255; int B = (pixel.B * Color.B) / 255; [/code] and it works perfectly.
[QUOTE=Philly c;42513348]What are you actually trying to do? [/QUOTE] This my first time playing around with c++ (I come from a glua background) and I'm trying to make a simple spambot to get me started. So simulating a series of key inputs and then hitting enter basically. I have it pretty much working but right now I'm just sending a hardcoded series of SendInput()s. [QUOTE=Philly c;42513348]If you wanted to input text to a window then send WM_CHAR messages.[/QUOTE] Then I would still need each scancode for each character in the string. After some thinking, I might just use SetClipboardData and WM_PASTE, so I don't have to do some crazy manual translation as it seems.
It seems [url=http://msdn.microsoft.com/en-us/library/windows/desktop/ms646329(v=vs.110).aspx]this[/url] could be what you're is looking for.
[QUOTE=ZeekyHBomb;42513819]It seems [url=http://msdn.microsoft.com/en-us/library/windows/desktop/ms646329(v=vs.110).aspx]this[/url] could be what you're is looking for.[/QUOTE] Thanks, seems like I was using it wrong yesterday! Have the source: [url]http://pastebin.com/muUS1cYJ[/url]
You'll want a [code]std::memset(&input, 0, sizeof(input));[/code] after constructing the INPUT struct, because the members will be uninitialized otherwise. Further more, VkKeyScan puts the key code in the lower-order byte of the short, and "shift state" in the higher-order byte of the short, while the KEYBDINPUT struct expects a value in range [1..254]. Currently your short is just truncated, so it shouldn't lead to any problems, but for example upper-case characters would be spammed as lower-case characters. You might also want to send a corresponding KEYEVENTF_KEYUP to emulate releasing the key. And you could also check the return value of SendInput. You can read how to deal with it in the [url=http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.110).aspx]documentation[/url]. Also, system("pause") is [url=http://stackoverflow.com/questions/900666/system-calls-in-c-and-their-roles-in-programming]discouraged[/url].
[QUOTE=ZeekyHBomb;42518489]You'll want a [code]std::memset(&input, 0, sizeof(input));[/code] after constructing the INPUT struct, because the members will be uninitialized otherwise. Further more, VkKeyScan puts the key code in the lower-order byte of the short, and "shift state" in the higher-order byte of the short, while the KEYBDINPUT struct expects a value in range [1..254]. Currently your short is just truncated, so it shouldn't lead to any problems, but for example upper-case characters would be spammed as lower-case characters. You might also want to send a corresponding KEYEVENTF_KEYUP to emulate releasing the key. And you could also check the return value of SendInput. You can read how to deal with it in the [url=http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.110).aspx]documentation[/url]. Also, system("pause") is [url=http://stackoverflow.com/questions/900666/system-calls-in-c-and-their-roles-in-programming]discouraged[/url].[/QUOTE] Adding the KEYUP thing, would double the inputs the spambot does and would therefore decrease the performance ( I think) Added the std::memset thing though, now I just need to read up what it does. Well the number of events SendInput did would always be 1, since I never give it more than one input structure each time. Also replaced System("pause") with cin.ignore().get(). Thanks!
I should have specified that I meant the wVk field of the KEYBDINPUT struct.
[QUOTE=ZeekyHBomb;42519563]I should have specified that I meant the wVk field of the KEYBDINPUT struct.[/QUOTE] Yeah, I figured that out.
I have been trying to build a camera class with the glm library, I thought this worked but after some testing it doesn't seem to rotate correctly. [code] glm::vec4 vec = glm::eulerAngleYXZ(Rotation.y, Rotation.x, Rotation.z) * glm::vec4(0.0f,1.0f,0.0f,0.0f); Direction = glm::vec3(vec.x, vec.y, vec.z); m_ViewMatrix = glm::lookAt( Position, Direction + Position, glm::vec3(0.0, 0.0, 1.0) ); [/code] The documentation for the glm::eulerAngleYXZ can be found here : [URL]http://glm.g-truc.net/0.9.4/api/a00168.html[/URL] Rotation is defined as pitch (x) yaw(y) roll(z).
[QUOTE=quincy18;42519665]I have been trying to build a camera class with the glm library, I thought this worked but after some testing it doesn't seem to rotate correctly. [code] glm::vec4 vec = glm::eulerAngleYXZ(Rotation.y, Rotation.x, Rotation.z) * glm::vec4(0.0f,1.0f,0.0f,0.0f); Direction = glm::vec3(vec.x, vec.y, vec.z); m_ViewMatrix = glm::lookAt( Position, Direction + Position, glm::vec3(0.0, 0.0, 1.0) ); [/code] The documentation for the glm::eulerAngleYXZ can be found here : [URL]http://glm.g-truc.net/0.9.4/api/a00168.html[/URL] Rotation is defined as pitch (x) yaw(y) roll(z).[/QUOTE] I have a working camera class which is defined very similarly: I found it in some old tutorial, and then after several complete overhauls and rewrites, I have a reusable and clean camera class. And there's how I have a relevant function defined: [code] glm::mat4 Camera::LookAtMat() { return glm::lookAt( position, glm::vec3( position.x+cos(yaw)*cos(pitch), position.y+sin(pitch), position.z+sin(yaw)*cos(pitch) ), glm::vec3(0, 1, 0) ); } [/code] Also I don't really get what does 'vec' vector stand for, perhaps you could use some self-descriptive names for your vars. Anyway, If you need more help, feel free to look at my implementation: [url]https://github.com/ruslashev/something/blob/master/src/camera.cpp[/url] (there are some sloppy bits atm)
I need some help with a tool program I'm making for an XNA game I'm developing. The tool should help me create animated textures (I've created a class for that in the XNA game), by letting the user select the offset and size of each individual frame by drawing a rectangle. The result should then be saved to some file (would .xml be the easiest? I've always used xml for this purpose) In short, I need to draw a rectangle that is snapping to a pixel. Like this. Note that the rectangles can move 1 pixel to the right - in the original picture's size (in the following example, it's 57x30 big) [t]https://dl.dropboxusercontent.com/u/33549121/drollenwaus.png[/t] It's not just about the rectangles, by the way, I just need to convert the positions on the picturebox to picture locations somehow I've done something like this before, a tile-based game to be exact, but it was so hacky and head-ache inducing that I'd hope to get a better solution here.
Can anyone see an issue with this? [cpp]#ifndef RENDERDEBUGINFO_HPP #define RENDERDEBUGINFO_HPP #include "Includes.hpp" #include "./GLHelp/BitmapText.hpp" class RenderDebugInfo { public: RenderDebugInfo(); ~RenderDebugInfo(); } #endif[/cpp] [cpp]#include "./RenderDebugInfo.hpp" RenderDebugInfo::RenderDebugInfo() { } RenderDebugInfo::~RenderDebugInfo() { }[/cpp] Because the error im getting is bullshit [quote]Error 1 error C2533: 'RenderDebugInfo::{ctor}' : constructors not allowed a return type framework\renderdebuginfo.cpp 4 1 Framework [/quote]
[QUOTE=Richy19;42523421]Can anyone see an issue with this? [cpp]#ifndef RENDERDEBUGINFO_HPP #define RENDERDEBUGINFO_HPP #include "Includes.hpp" #include "./GLHelp/BitmapText.hpp" class RenderDebugInfo { public: RenderDebugInfo(); ~RenderDebugInfo(); } #endif[/cpp] Because the error im getting is bullshit[/QUOTE] Put a semicolon at the end of the class declaration.
[QUOTE=mlbfan560;42523486]Put a semicolon at the end of the class declaration.[/QUOTE] Such a noob, a very tired noob... Thanks man :)
How would you go about checking if a string of characters comes alphabetically before or after another string of characters in C?
A friend and I want to start working on a 2D game, probably a platformer, just for fun at this point. I have a decent amount of experience with Java, mostly self taught, and he's basically new to programming. What would be the easiest/most efficient/generally best language to make a 2D game in? I feel like I remember seeing somewhere on here before that C# or C++ was really good for making quick 2D games/apps, but I could just be making that up. If anyone has an idea, please let me know, and I'd also appreciate it if you could recommend an IDE, assuming you're not recommending Java. Thanks in advance.
[QUOTE=laharlsblade;42526026]A friend and I want to start working on a 2D game, probably a platformer, just for fun at this point. I have a decent amount of experience with Java, mostly self taught, and he's basically new to programming. What would be the easiest/most efficient/generally best language to make a 2D game in? I feel like I remember seeing somewhere on here before that C# or C++ was really good for making quick 2D games/apps, but I could just be making that up. If anyone has an idea, please let me know, and I'd also appreciate it if you could recommend an IDE, assuming you're not recommending Java. Thanks in advance.[/QUOTE] Lua, with LÖVE
I'm using a DScrollPanel, but i've .Painted over everything else to make things sexy and how i want them to display. Everything else is working fine, but i cant find a nice way to paint over the scroll bar, or change its looks? What would be the best way to achieve this? EDIT: Worked it out. Searched through to find the individual subpanels. [lua] DScrollPanel.Paint = function() draw.RoundedBox( 6 , 0 , 0 , 260 , 400 , Color( 0, 0, 0, 150 ) ) end DScrollPanel.VBar.Paint = function() draw.RoundedBox( 4 , 0 , 0 , 12 , 400 , Color( 0, 0, 0, 150 ) ) end DScrollPanel.VBar.btnGrip.Paint = function() draw.RoundedBox( 4 , 0 , 0 , 12 , 400 , Color( 90, 90, 90, 150 ) ) end DScrollPanel.VBar.btnDown.Paint = function() draw.RoundedBox( 4 , 0 , 0 , 12 , 400 , Color( 50, 50, 50, 150 ) ) end DScrollPanel.VBar.btnUp.Paint = function() draw.RoundedBox( 4 , 0 , 0 , 12 , 400 , Color( 50, 50, 50, 150 ) ) end [/lua]
[QUOTE=W00tbeer1;42525830]How would you go about checking if a string of characters comes alphabetically before or after another string of characters in C?[/QUOTE] Strcmp
[QUOTE=ThePuska;42527985]Strcmp[/QUOTE] Ah, so it returns values based on the lexical order. Good to know, thanks.
Anyone think of a regex expression or search term I could use to scan my source code for calls to opengl? I want to write some unit tests for it by providing my own ogl function implementations,. Or anyone know of a unit test framework for opengl
[QUOTE=Richy19;42529230]Anyone think of a regex expression or search term I could use to scan my source code for calls to opengl? I want to write some unit tests for it by providing my own ogl function implementations,. Or anyone know of a unit test framework for opengl[/QUOTE] Which language? Also, it may be easier to create a .dll with compatible interface that intercepts all the OpenGL calls (or to hook the functions at runtime, if your executable allows that).
[QUOTE=vombatus;42520898]I have a working camera class which is defined very similarly: I found it in some old tutorial, and then after several complete overhauls and rewrites, I have a reusable and clean camera class. And there's how I have a relevant function defined: [code] glm::mat4 Camera::LookAtMat() { return glm::lookAt( position, glm::vec3( position.x+cos(yaw)*cos(pitch), position.y+sin(pitch), position.z+sin(yaw)*cos(pitch) ), glm::vec3(0, 1, 0) ); } [/code] Also I don't really get what does 'vec' vector stand for, perhaps you could use some self-descriptive names for your vars. Anyway, If you need more help, feel free to look at my implementation: [url]https://github.com/ruslashev/something/blob/master/src/camera.cpp[/url] (there are some sloppy bits atm)[/QUOTE] Thanks, the vec stand for vector, it was just a temporary value since it returns a vec4 and I needed a vec3. I could have called it tempVector. Anyway I tried your implementation and it looked a lot like one I did a couple of years ago but I couldn't get it to work. After digging back into some of my math books I came up with this : [code] if(Rotation.x > 180) Rotation.x = -180; if(Rotation.y > 180) Rotation.y = -180; //Create rotation matrix glm::mat4 rot; rot = glm::rotate(rot, Rotation.y, glm::vec3(0.0, 0.0, 1.0)); rot = glm::rotate(rot, Rotation.x, glm::vec3(1.0, 0.0, 0.0)); //Calculate the direction glm::vec4 result = rot * glm::vec4(0.0, 1.0, 0.0, 0.0); Direction = glm::vec3(result.x, result.y, result.z); //Create lookat matrix m_ViewMatrix = glm::lookAt( Position, Position + Direction, glm::vec3(0.0, 0.0, 1.0) ); [/code]
[QUOTE=Recurracy;42523011]The result should then be saved to some file (would .xml be the easiest? I've always used xml for this purpose)[/QUOTE] I, personally, would use JSON.Net. Both saving and loading a struct and/or list from/to JSON is as easy as one method call.
[QUOTE=eternalflamez;42474951]I don't even know C++ but after a very quick search I found that set.h references set.cpp and set.cpp references set.h, so if you include .h in your .ccp it's a loop that keeps creating a new .cpp which creates a new .h which creates a new .cpp etc.. More information could be found [URL="http://stackoverflow.com/questions/11094310/error-c2995-function-template-has-already-been-defined"]here[/URL][/QUOTE] yeah I found that much out too, what I ended up doing was just moving my set.cpp into my set.h and removing the the includes. I wish I could find a way to separate the two implementations, but for now I will work with what I got! thanks though
[QUOTE=Tamschi;42529404]Which language? Also, it may be easier to create a .dll with compatible interface that intercepts all the OpenGL calls (or to hook the functions at runtime, if your executable allows that).[/QUOTE] C++
Would "gl.+(.*)" (\( and \) depending on the dialect) be enough?
[QUOTE=ZeekyHBomb;42532893]Would "gl.+(.*)" (\( and \) depending on the dialect) be enough?[/QUOTE] Looks like it would do the trick, can grep take regex btw?
[QUOTE=ZeekyHBomb;42532893]Would "gl.+(.*)" (\( and \) depending on the dialect) be enough?[/QUOTE] That's probably not specific enough. (?<![A-Za-z0-9])gl[^ \(]+\([\)]*\) should work if there are no other functions starting with gl and there's sane formatting. . doesn't match line breaks, so .* wouldn't grab multi-line parameter lists. IIrc, * is greedy, so your regex would match until after the last ) in that line. [editline]15th October 2013[/editline] [QUOTE=Richy19;42533108]Looks like it would do the trick, can grep take regex btw?[/QUOTE] Guess what re stands for :v:
Sorry, you need to Log In to post a reply to this thread.