Jump to content
  • Advertisement

onetwothreegone

Member
  • Content Count

    11
  • Joined

  • Last visited

Community Reputation

230 Neutral

About onetwothreegone

  • Rank
    Member
  1. I am working on a game project that will make extensive use of scripting. I want to use Lua for the scripting language since it is lightweight enough that I can have a Lua state for every game object. I can figure this out easily, the problem is I want to be able to do something like this from code: parent.getComponent("health").damage = 10   With the health component also being written in Lua. I can't find a way to pass a reference to a table from one Lua state to another. It needs to be a reference/pointer since the code needs to have an effect on the damage variable.   Is there a way to do this? Maybe someway to have only a single Lua state with completely separate Lua files? Is there a scripting language that can do this?   EDIT: I am fine with switching to another scripting language that can do this, anyone know one?
  2. onetwothreegone

    Can Python be used for 3D programming?

    Take note that Java is faster but not all that much. It should be fine through unless you plan on making Halo or something.
  3. onetwothreegone

    Direct2D Camera no longer working.

    I'm not calling it manually, does DrawTextA call SetTransform?   EDIT: Also if I stop calling the text code the camera still won't work again.
  4. ID2D1RenderTarget* target = (ID2D1RenderTarget*)dgGetGraphics(); D2D1::Matrix3x2F m = D2D1::Matrix3x2F::Translation(g_camX, g_camY); m = m.Scale(D2D1::SizeF(g_camZoom, g_camZoom), D2D1::Point2F(g_camX, g_camY)); target->SetTransform(&m); I have written some code to control a camera in Direct2D. This code no longer works even through I did not change anything other than adding a DirectWrite factory so I can draw text. Now the camera no longer works, but just doing a normal transform still works. The strange part is that I never changed the camera code....   Philip
  5. onetwothreegone

    CoreCLR (.NET Core) in GitHub right now

    What I want to know is, will I be able to write games for Mac now with a Microsoft made .NET rather than Mono?
  6. onetwothreegone

    How do I add librarys in visual studio 10?

    Important to note when using Burnt_Fyr solution, it you probably want to go to the drop down box at the top and set the configuration to All Release, otherwise it could fail when you build the release version. You don't have to do this, but it makes it easier as you don't have to manually add the libraries to all the configurations.
  7. onetwothreegone

    DirectX 9 SetRenderTarget

    Thank you all, I got it now. One last thing, how much longer will graphics cards be able to run DirectX 9 apps?   EDIT: It appears to not be working right, looking at my code it seems I am not correctly setting the target back to the window. But it could also be that the target is not being properly set to the texture. The result is the texture is blank except for what I draw onto it. The draw area is only the size of the texture, even after I set the render target back to the window.   Code: if (t == nullptr) // Passing a nullptr means we need to render to the window. { if (renderTarget != NULL) renderTarget->Release(); renderTarget = NULL; targetId = -1; device3d->SetRenderTarget(1, windowTarget); } else { if (renderTarget != NULL) { renderTarget->Release(); renderTarget = NULL; } gameTextures[t->ID]->Texture->GetSurfaceLevel(0, &renderTarget); // Create a surface out of the texture. targetId = t->ID; device3d->SetRenderTarget(1, renderTarget); This is all wrapped up in a function.
  8. onetwothreegone

    DirectX 9 SetRenderTarget

    I got my code to be able to render to a surface with device->SetRenderTarget, but I was wondering how to set it back to rendering to a window. Also is there a better way of rendering to a texture then with SetRenderTarget?   I have been looking around the web for a while but can't find any examples on how to set the render target back to the window.   Thanks, Philip
  9. onetwothreegone

    DirectX only drawing a single primitive.

    Well thanks for you time!
  10. onetwothreegone

    DirectX only drawing a single primitive.

    Thanks, primitive drawing works now. To Juliean, how much performance does DrawPrimitiveUp save and how do I use it? I just started DirectX and have only used OpenGL in the past.   Thanks, Philip
  11. I am trying to get DirectX to draw a triangle in a single function. The function works, but I can only draw a single time, any ideas? I don't really know what other information to provide.   Code: void graphics::fillTriangle(float x, float y, float x2, float y2, float x3, float y3, int r, int g, int b, int a) { Vertex vertexs[] = { { x, y, 1.0f, 1.0f, D3DCOLOR_RGBA(r, g, b, a) }, { x2, y, 1.0f, 1.0f, D3DCOLOR_RGBA(r, g, b, a) }, { x2, y2, 1.0f, 1.0f, D3DCOLOR_RGBA(r, g, b, a) }, }; VOID* pVoid; d3dDevice->CreateVertexBuffer(3*sizeof(Vertex), 0, CUSTOMFVF, D3DPOOL_MANAGED, &vBuffer, NULL); vBuffer->Lock(0, 0, (void**)&pVoid, 0); memcpy(pVoid, vertexs, sizeof(vertexs)); vBuffer->Unlock(); d3dDevice->SetFVF(CUSTOMFVF); d3dDevice->SetStreamSource(0, vBuffer, 0, sizeof(Vertex)); d3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1); vBuffer->Release(); }
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!