• What do you need help with? Version 5
    5,752 replies, posted
This is actually driving me insane. Getting error 1407. The weird thing is that this code was copied from another program that works PERFECTLY fine that I also wrote. [code]bool initWindow(HWND &hWnd, HINSTANCE hInstance, int width, int height) { //Setup Window then register WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = wndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)COLOR_WINDOW; wcex.lpszMenuName = NULL; wcex.lpszClassName = TEXT("Galaxy"); wcex.hIconSm = 0; RegisterClassEx(&wcex); //Setup a RECT to resize window unto RECT rect = { 0, 0, width, height }; AdjustWindowRect(&rect, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, FALSE); //Create Window finally hWnd = CreateWindow(L"Galaxy", L"Galaxy DX10", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, hInstance, NULL); //If !hWnd if(!hWnd) { DWORD err = GetLastError(); WCHAR msg[200] = {0}; wsprintfW(msg, L"Failed with last error: %d", err); MessageBoxW(NULL, msg, L"CreateWindow", MB_OK); return false; } //If successful ShowCursor(true); ShowWindow(hWnd, SW_SHOW); UpdateWindow(hWnd); return true; }[/code] What I do know is that the issue is somewhere around wcex.
Line number and specific error please.
[QUOTE=Lord Ned;35564297]Line number and specific error please.[/QUOTE] It compiles fine, error 1407 is specifically an error with wndclassex and the function registerclassex where the argument (it accepts wndclassex as an argument) does not have certain members filled out right or something.
You didn't fill in hIcon.
-late-
[QUOTE=animorten;35559792]You need to set GL_TEXTURE_(MIN/MAG)_FILTER to GL_NEAREST or GL_LINEAR if you don't have mipmaps[/QUOTE] Yes, I do not have mipmaps. I tried these: [cpp]glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);[/cpp] [cpp]glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);[/cpp] But it didn't work. I don't know what I'm doing wrong here. Could it be my shader setup? I'm just using stock shaders. [url]http://pastebin.com/W4J7EXPu[/url] Edit: Wait, I got it to render. Turns out I was coloring it with full white. It looks pretty janky, though. Upside-down. Edit2: Okay, now it seems to render correctly, except for the fact that it's upside down. Edit3: For some reason, this makes the texture rendering correctly, without being upside down: [cpp]// Handle the textured quad glBegin(GL_QUADS); glColor3f(1, 1, 1); glTexCoord2d(0.0,1.0); glVertex2d(-0.5,-0.5); glTexCoord2d(1.0,1.0); glVertex2d(0.5,-0.5); glTexCoord2d(1.0,0.0); glVertex2d(0.5,0.5); glTexCoord2d(0.0,0.0); glVertex2d(-0.5,0.5); glEnd();[/cpp] Does anyone know why it would? I've flipped the texture coordinates.
How do I make AutoHotkey scripts work in fullscreen games? I made this: [CODE] ^!w:: SetKeyDelay, 20 SendInput, {Q} Loop 10{ SendInput, {W} } Loop 2 { SendInput, {S} } SendInput, {E} SendInput, {Q} Return [/CODE] To try equipping something in Skyrim from Favs menu but it doesnt work. Any ideas? Thanks!
[QUOTE=Jinx786;35566421]How do I make AutoHotkey scripts work in fullscreen games? I made this: [CODE] ^!w:: SetKeyDelay, 20 SendInput, {Q} Loop 10{ SendInput, {W} } Loop 2 { SendInput, {S} } SendInput, {E} SendInput, {Q} Return [/CODE] To try equipping something in Skyrim from Favs menu but it doesnt work. Any ideas? Thanks![/QUOTE] You can set actual numbers to each favorited item by selecting it in the favourites menu and pressing a number, that may work better than a macro. So then you just press the number you set the item to to equip it, no need to even open the menu.
[QUOTE=Mordi;35565462]Does anyone know why it would?[/QUOTE] glTexImage2D expects the pixel data to start at the lower-left corner, DevIL gives you upper-left data. The pixel rows are reversed.
[QUOTE=Willox;35566606]You can set actual numbers to each favorited item by selecting it in the favourites menu and pressing a number, that may work better than a macro. So then you just press the number you set the item to to equip it, no need to even open the menu.[/QUOTE] Thanks, thats some very useful info, still, I would like to make a macro to get all my armor off in one keystroke. Edit: Found the problem, $ was missing before the key declaration and sleeps were missing between keystrokes. [CODE] $^!w:: SetKeyDelay, 20 SendInput, {Q} sleep, 50 Loop 10{ SendInput, {W} sleep, 50 } Loop 2 { SendInput, {S} sleep, 50 } SendInput, {E} sleep, 50 SendInput, {Q} Return [/CODE]
[CODE] class Program { static void Main(string[] args) { Console.WriteLine("Average Calculator v1.0"); Console.WriteLine("Define A!"); Console.ReadLine(); int A; if (int.TryParse(Console.ReadLine(), out A)) { Console.WriteLine("A="+A); } else Console.WriteLine("Incorrect response"); Console.ReadLine(); }[/CODE] Whenever I execute this in a command line window, it will give me a extra unnecessary line when you input a value for A: [IMG]http://dl.dropbox.com/u/25842103/Problem%20with%20C%23.png[/IMG]
[code] from Tkinter import * class App: def _init_(self,master): u=Text(master,width=40) v=Text(master,width=40) u.grid(row=0,column=0) v.grid(row=0,column=2) w=Button(master, text="Convert") w.grid(row=1,column=1) root=Tk() Window=App(root) root.mainloop() [/code] Why won't this display two text boxes? (Python) Also I clearly defined this class with one argument, yet I get an error when I do App(root) [URL="http://www.pythonware.com/library/tkinter/introduction/hello-again.htm"]Tried to modify this tutorial.[/URL] [editline]14th April 2012[/editline] Nevermind, apparantly init needs TWO underscores
I'm attempting to save a file using the dialog boxes provided by the Win32 API. This code works fine except for one thing; upon calling GetSaveFileName() it somehow jumps back to where my save function was called from, then calls it again... I can't really explain it but the end result is that after you close the first Save File dialog, another one opens. I really have no idea what's going on here, from what I've seen online my code is fine. [cpp]OPENFILENAME ofn; ZeroMemory(&ofn, sizeof(OPENFILENAME)); wchar_t filename[MAX_PATH] = L""; ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = NULL; ofn.lpstrFilter = L"OBJ Files (*.obj)\0\0"; ofn.lpstrFile = filename; ofn.nMaxFile = MAX_PATH; ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; ofn.lpstrDefExt = L"obj"; if(GetSaveFileName(&ofn)) { char file[MAX_PATH] = ""; WideCharToMultiByte(CP_UTF8, 0, filename, MAX_PATH, file, MAX_PATH, NULL, NULL); std::cout << "Saving to " << file << std::endl; }[/cpp] Any ideas?
Okay here's my python problem: [code] from Tkinter import * class Output: def __init__(self,master): self.u=Text(master,width=40) self.u.grid(row=0,column=0) self.v=Button(master,text="Add text",command="Write") self.v.grid(row=1,column=0) def Write(self): self.u.insert(1.0,"Meh") root=Tk() output=Output(root) root.mainloop() [/code] Now it opens an empty text window. How do I make the button work in "real time" ? Edit: Found it, Write instead of "Write" Also, how do I separate interface and inner workings? Do I create an Interface class and an Inner Workings class?
[QUOTE=martijnp3000;35567366][CODE] class Program { static void Main(string[] args) { Console.WriteLine("Average Calculator v1.0"); Console.WriteLine("Define A!"); Console.ReadLine(); int A; if (int.TryParse(Console.ReadLine(), out A)) { Console.WriteLine("A="+A); } else Console.WriteLine("Incorrect response"); Console.ReadLine(); }[/CODE] Whenever I execute this in a command line window, it will give me a extra unnecessary line when you input a value for A: [IMG]http://dl.dropbox.com/u/25842103/Problem%20with%20C%23.png[/IMG][/QUOTE] Get rid of the first useless ReadLine()
Ran into yet another annoying issue. Compile error involving t_Timer. Not pasting the entire code because thats around 500 lines total. t_Timer.h [code] #pragma once #include "g_DXInit.h" class t_Timer { public: t_Timer(); float getTime()const; //Seconds float getChange()const; //Seconds void resetTimer(); //Reset Timer void startTimer(); //Start Timer void stopTimer(); //Stop Timer void tickTimer(); //Tick Timer private: //Private Data Members, seconds per tick, change in time ETC double tsecondsTick; double tDeltaTime; //Holds time at certain conditions such as when timer stopped, previous, current ETC __int64 tBase; __int64 tPause; __int64 tStop; __int64 tPrev; __int64 tCurr; //Is Timer stopped? bool tStopped; }; [/code] g_DXInit.h [code] #ifndef g_DXINITH #define g_DXINITH #include <d3d10.h> #include <d3dx10.h> #include <windows.h> #include <tchar.h> #include <cassert> #include <vector> #include <string> #include <sstream> #include <fstream> #include <istream> #include "t_Timer.h" #include "aux_font.h" class g_DXInit { public: //Initialize direct 3D, Directx 10 swap and chain, ready render target to render to. Use separate render target for shadow mapping. int initD3D10(HWND* hWnd); bool initSwapChain(); bool readyRenderTarget(); bool setViewports(); //Necessary to render scene, draw pushes to GPU. Update prepares info needed before pushing to GPU void drawScene(); void updateScene(float time); //Public D3D10X Objects ID3D10Device* pD3DDevice; private: //Private D3D10X Objects IDXGISwapChain* swapChain; ID3D10Texture2D* backBuffer; ID3D10Texture2D* depthStencilTex; ID3D10RenderTargetView* pRTV; ID3D10DepthStencilView* depthSV; ID3DX10Font* font; //Private WINAPI Objects RECT RC; HWND* InitHW; //Private Variables int width; int height; t_Timer* timer; }; #endif [/code] Specific error is whenever I try to create a t_Timer object. Consistently gives me undeclared identifier every time I attempt to compile.
I'm using MPLab with the c30 compiler and I'm getting this error. Could not read language tool output from pipe. (5) A language-plugin exception occurred and was logged. This is my code. [CODE]void main() { PORTA = 0; TRISA = 0; while(1) { PORTA = 0x01; Delay_ms(100); PORTA = 0x00; Delay_ms(300); } } [/CODE]
Does anyone know of any articles/tutorials on how to set up a game engine? I am talking about the handling of gamestates, loading, objects and so forth. I'm using C++, but that shouldn't matter. I can't seem to find what I'm looking for through googling.
[QUOTE=Mordi;35579498]Does anyone know of any articles/tutorials on how to set up a game engine? I am talking about the handling of gamestates, loading, objects and so forth. I'm using C++, but that shouldn't matter. I can't seem to find what I'm looking for through googling.[/QUOTE] I'd say go with something like Irrlicht, and try the rest out for yourself. The tutorials for it are pretty good too, and when you dig into the API documentation, there's LOTS of goodies in it for you. And yes, it's C++ and fully namespace'd.
A simple Lua question here. I have code similar to this. [code] local globe = {} local listOfSpeeches = {} table.insert( globe, {hi = "hello", bye = "bye"}) table.insert( globe, {"1", "2", "3"}) listOfSpeeches["greetings"] = globe[1] [/code] How would one delete the table containing "hi and bye", across multiple arrays that might have this inside it? edit: this isn't for anything in gmod, btw.
[QUOTE=T3hGamerDK;35579633]I'd say go with something like Irrlicht, and try the rest out for yourself. The tutorials for it are pretty good too, and when you dig into the API documentation, there's LOTS of goodies in it for you. And yes, it's C++ and fully namespace'd.[/QUOTE] I want to set up my own little game engine. Not going to create a full, usable engine, but just make a system to see how it could be done. I've already got OpenGL running, and loading and rendering sprites done. Now I will flesh it out and handle it in an object-oriented way. I found one nice article that fits me well: [url]http://gamedevgeek.com/tutorials/managing-game-states-in-c/[/url]
I am developing a co-op game, and I just found out that if someone closes the connection on a UDP socket, the server receives 0 as the return from recvfrom(). How does it do this? Because I get about 30 packets where the server says recfrom() returns 0. Does it send a certain packet that is called at closesocket() or WSACleanup()? And if so, does I get the information of the person who sent it (the IP, etc?).
Anyone experienced with C++ here? I moved all the game-engine setup from my main.cpp to a different class, and I am having trouble with one thing: [cpp]glutDisplayFunc(Draw);[/cpp] Freeglut doesn't like me doing this. This is the error I get: [quote]Error: 'GameEngine::Draw': function call missing argument list; use '&GameEngine::Draw' to create a pointer to member Error: IntelliSense: argument of type "void (GameEngine::*)()" is incompatible with parameter of type "void (*)()" [/quote] I guess this happens because whereas before, the draw-function was static. Now however, it's a function in an instantiated class. Does anyone have any clue as to how I can make this work? Edit: It turns out this is impossible to do... [url]http://bytes.com/topic/c/answers/441511-registering-glut-callback-c[/url] Kind of a bummer.
How do I get SFML to run on another computer? I have packaged the .dlls (system, graphics, window) in the DLL folder, however my friends say that the program says it has stopped working right after the SFML components start up. What else should I do?
After spending a while trying to get SFML 2.0 working, i finally got somewhere using this for guidence: [url]http://en.sfml-dev.org/forums/index.php?topic=6122.0[/url] but when using the template i can only use code the example gives me, if i try to input anything not used in the template then it errors. [t]http://puu.sh/pNuV[/t] Any ideas what it could be? that's the example which builds and runs fine on it's own.
[QUOTE=WTF Nuke;35582452]I am developing a co-op game, and I just found out that if someone closes the connection on a UDP socket, the server receives 0 as the return from recvfrom(). How does it do this?[/QUOTE] There's no such thing as a UDP connection, and looking at the manpage, I don't see anything that would make recvfrom() return 0 when called on a UDP socket. (If it were a nonblocking socket and no data were available, it'd return -1 with errno set to EAGAIN or EWOULDBLOCK.)
That's the odd thing, it is blocking and it says recvfrom() returns >0 when someone disconnects (but only when they disconnect via forcing the program to shut down, not disconnecting that tells the server that you dc'd).
Are you sure you're using UDP and not TCP?
Yes.
[QUOTE=Mordi;35553426]Yep, I've got ilInit and imagename-generation and binding seems to work fine. I tried putting logo.png in the same folder as the project-file, and it seems to load fine now. I'm not getting an error. I guess the working-directory is set to the same folder as the projectfile while running in debug-mode in MSVC+ 2010. By the way, what's the story behind "ilConvertImage()"?[/QUOTE] I'm using DevIL with OpenGL, so for consistency I'm making sure everything is in RGBA format. Input images aren't necessarily, so I convert them. I'm calling convert on every image (even the ones that are already RGBA) because I couldn't find any way whatsoever of determining the current image format.
Sorry, you need to Log In to post a reply to this thread.