Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About CzarKirk

  • Rank
  1. Hi, I've written these code fragments in OpenGL but now need to convert them to DirectX with which I am less familiar. This is the only part I'm missing to get my game working with both ogl and dx!! The code is in BlitzMax but you can give it in C++ and I will figure out the rest. Case DIRECTBLEND glEnable GL_BLEND glBlendFunc GL_ONE,GL_ZERO glDisable GL_ALPHA_TEST Case MASKONBLEND glEnable GL_BLEND glBlendFunc GL_DST_ALPHA,GL_ONE_MINUS_DST_ALPHA glDisable GL_ALPHA_TEST Case MASKOFFBLEND glEnable GL_BLEND glBlendFunc GL_ONE_MINUS_DST_ALPHA,GL_DST_ALPHA glDisable GL_ALPHA_TEST ... I want to write only the alpha channel glColorMask GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE draw something glColorMask GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE Somebody has suggested this for part of the commands, but he's unsure for the others or if it's right. Case MASKONBLEND _d3dDev.SetRenderState D3DRS_ALPHABLENDENABLE,True _d3dDev.SetRenderState D3DRS_ALPHATESTENABLE,False _d3dDev.SetRenderState D3DRS_SRCBLEND,D3DBLEND_DESTALPHA _d3dDev.SetRenderState D3DRS_DESTBLEND,D3DBLEND_INVDESTALPHA Case MASKOFFBLEND _d3dDev.SetRenderState D3DRS_ALPHABLENDENABLE,True _d3dDev.SetRenderState D3DRS_ALPHATESTENABLE,False _d3dDev.SetRenderState D3DRS_SRCBLEND,D3DBLEND_INVDESTALPHA _d3dDev.SetRenderState D3DRS_DESTBLEND,D3DBLEND_DESTALPHA I am looking for the code to be compatable with both DirectX 7 and DirectX 9. Thank you for any help you can give.
  2. Probably your 32-bit executable will work on her computer anyway, without modification. 64-bit Windows tries to maintain compatability with old 32-bit software.
  3. CzarKirk

    Linked list questions in c++

    You should learn about templates. They allow you to make code for any type of data. You can change the data type of Item without having to alter the code, and have lists which can contain only their kind of data to prevent errors.
  4. You use dynamic_cast to convert a pointer up or down an inheritance hierarchy and nothing else. The dynamic_cast will set the pointer's result to 0/NULL if the cast did not succeed. For example, if you cast a pointer to Shape to a pointer to Circle, but the object pointed to is actually a Square, it will give 0. You can check this and change your behavior accordingly. If you use the other cast types, it can force to use the pointer for the wrong object without any checks, so learning each of the cast types and when they should be used is a good idea. However, frequent reliance upon dynamic_cast implies you have a design problem. You are meant to use virtual functions to vary behavior for OOP. Generally speaking, static_cast is for numeric conversions (int <-> float), reinterpret_cast is for possibly dodgy conversions (convert a 2d int array to an int pointer for example) and dynamic_cast to find out what's on the other side of an OOP pointer. C-style cast may compile reinterpret_cast, so it can be dangerous unless you are 100% sure of what is on the other end. I have never yet come across a situation in C++ where I could not find an alternative to the use of a void pointer (apart from using malloc of course). If you think carefully about the problem, you can usually come up with another way. Consider a base class which can do everything you may ask of what's on the other side of the void pointer using virtual functions, and then derive classes for each possibility. When in release mode, look in project properties. You may be able to turn uninitialized variable checks back on.
  5. CzarKirk

    Linked list questions in c++

    That doesn't really fit the OP's requirements (among other thing, the OP wants to use templates). [/quote] You can still have a template. When you want only int, use only int. But if you want a single list which can store both ints and strings, use a struct as the template parameter that holds both types but only use one of them. There will be a few bytes of wasted space but not the end of the world.
  6. CzarKirk

    Tile Transitions

    Cool thanks! But I don't suppose you know how to do this in BlitzMax? I will try asking on its forums.
  7. I've come up with a cool tile system where I take a large seamless texture and split it up into 64x64 chunks to make the tiles. When painting the texture, it works out which frame to use on each tile so that you can intermix tiles of different kinds and each region of the same tile will always be seamless. It's a bit difficult to explain so here are some screenshots to show what I mean. http://www.shattered-design.com/forum/viewtopic.php?f=53&t=116 The trouble I'm having, is how to make the transitions between tiles of different kinds. I undertand the standard way to do it is to make transition tiles for each direction, but as each kind of tile has several possibilities it would mean making a transition set for each unique tile and that is prohibitively excessive. If the seamless texture is 512x512, and the tile size is 64x64 that's 64 tiles per texture type. As the transition from one texture to another can occur at any point in the texture, that is 64*several extra tiles per texture and will use a lot of vram. I'm not married to this system so would consider alternatives, but I wanted the regions of the same kind of tile not to be so repetative. I'm making this in BlitzMax but general ideas would be helpful. Any suggestions welcome.
  8. CzarKirk

    Linked list questions in c++

    Why not make a structure which contains int and string and store that?
  9. Could you give a code example for that please?
  10. As far as I know, if you use a member variable without the this keyword, it is automatically "put there" by the compiler anyway.
  11. You are never going to get that deleting properly without wasting a ton of time, especially if you ever change the layout of the array of arrays. +99999 for using vectors. Make a vector<vector<float> > v.
  12. CzarKirk

    C++ Pointers and C# ref

    Quote:Original post by deepdene int* intArray = new int[20]; int value = intArray[10]; delete intArray; That should be delete[] as it is an array. To change a variable parameter, you can use references in C++. They work similar to pointers, but you don't need to use the * symbol when you read/write to them void Method(int& var) { var = 5; }
  13. CzarKirk

    Can someone help me name my API?

    Why not call it Stevie3D. Catchy.
  14. You could have a vector or list of pointers to the objects, which you create in one function, but the collection is accessable to other functions or classes to. Be careful to delete objects when you remove them from the collection and remove all pointers to them.
  15. You could put the values into an array, and iterate with a for loop. It would be easier to implement.
  • 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!