Code Fusion

Members
  • Content count

    135
  • Joined

  • Last visited

Community Reputation

139 Neutral

About Code Fusion

  • Rank
    Member
  1. PHP Help

    when a form submits it's fields into another page , only those fields will be present in the destination page . form fields are not accessed like other vars declared within the page(at least not by default) , they can be accessed by $HTTP_GET_VARS['varname']. if your planning to make a login system , you should loop through all the array items , and test if the username corresponds to a password in the array.
  2. How to check if a number satisfies ((n^2) + 1) ...

    Quote:Original post by Kambiz *** Source Snippet Removed *** if ceil doesn't change it's value , floor isn't going to either.
  3. How to check if a number satisfies ((n^2) + 1) ...

    n^2 + 1 = x x = x - 1 ( x = n^2) x = sqrt(x) (x = n) if (floor(x) < x) { // TODO if input is wrong } there is an easier way if you know how your type is encoded in memory .
  4. Timer display

    The timeGetTime function retrieves the system time, in milliseconds. The system time is the time elapsed since Windows was started. example //in the start of the code DWORD StartTime = timegettime(); //somewhere else in the code DWORD TimeElapsed = StartTime - timegettime(); of course this is in c++ (me no java) , but it is enough to present the logic of the process.
  5. Blitz Basic

    1. regarding your leveltest function. your using way too much ifs , use something within these lines. score = score/1000 score = floor(score) level = score + 1 astv = level*0.25 + 0.25 2. why exactly are you using delay every frame , i think that's what's causing the slow responses.
  6. How to set the parameter of the function GetBackBuffer?

    when you encounter a new functionality in directx , look it up in the DX documentation (i assume you have it) , this makes life a lot easier. regarding swap chains: swap chains is the process of swapping the pointers of the back and front buffers , so the contents that was just drawn are introduced to the screen , and the old surface (the front buffer) is used to draw the new frame , hence becoming the back buffer. this technique is basicly used to prevent tearing , and provide a smooth transaction between frames. multiple view ports demand a seperate swap chain for each one. so more swap chains per device obligates you to specify which swap chain to get the backbuffer of. the iSwapChain(order value) starts at 0 ( as EasilyConfused sugsested ) , and is incremented with each new swap chain created . in some cases you would want to create more than one backbuffer (as this can pump the speed up a little) , so you have to specify which backbuffer to retrive , and for you it would 0. the Type param is to specify mono/stereo view, and the latter is not supported in directx 9.0 , so use D3DBACKBUFFER_TYPE_MONO.
  7. CPU usage

    well following the same logic: having too many programms open would effect the time slice each thread gets to execute , so giving the music less time to play resulting in gaps in the sound.i would sugsest using a sleep(1); happening as long as the game is windowed. that would result in a slower fps for your game , but insure smoothnes of execution for other apps.
  8. why torment your self with MFC , when vb is just sitting by.
  9. Functions..."Under The Hood"?

    at runtime the arguments are replaced with thier actual values , so they don't get the address unless you pass it , which requires making the argument a pointer. The stack is a special area of memory allocated for your program to hold the data required by each of the functions in your program. It is called a stack because it is a last-in first-out queue,much like a stack of dishes.when data is pushed on the stack it grows , when it's popped off , it shrinks.so that implies that you can't pop a dish at the bottom without popping every dish above it. Code Space is a part of memory reserved to hold the binary form of your code , each instruction in thier simplest form are placed at an address in memory , and the instruction pointer has the address of the next command to execute. the insturction pointer is in a special area of memory called the registers , and is used to organize the execution of your program. when you call a function: 1.The address in the instruction pointer is incremented to the next instruction past the function call. That address is then placed on the stack, and it will be the return address when the function returns. 2.Room is made on the stack for the return type you’ve declared. On a system with two-byte integers, if the return type is declared to be int, another two bytes are added to the stack, but no value is placed in these bytes. 3.The address of the called function, which is kept in a special area of memory set aside for that purpose, is loaded into the instruction pointer, so the next instruction executed will be in the called function. 4.All the arguments to the function are placed on the stack. 5.The current top of the stack is now noted and is held in a special pointer called the Stack Frame. Everything added to the stack from now until the function returns will be considered “local” to the function. 6.The instruction now in the instruction pointer is executed, thus executing the first instruction in the function. 7.Local variables are pushed onto the stack as they are defined. When the function is ready to return, the return value is placed in the area of the stack reserved at Step 2. The stack is then popped all the way up to the Stack Frame pointer, which effectively throws away all the local variables and the arguments to the function. The return value is popped off the stack and assigned as the value of the function call itself,and the address stashed away in Step 1 is retrieved and put into the instruction pointer. The program thus resumes immediately after the function call, with the value of the function retrieved. Some of the details of this process change from compiler to compiler, or between computers, but the essential ideas are consistent across environments. In general, when you call a function, the return address and the parameters are put on the stack. During the life of the function, local variables are added to the stack. When the function returns, these are all removed by popping the stack.
  10. Code Review Group

    to OP what you are saying is the normal procedure , you start learning (newbie) , you make a simple game , you show it to other people , and they give thier opinion.if you want sugsestions for simple game ideas (tetris , break out etc..) just ask.there is already a C++ workshop going on here , so check it out.
  11. C++ and Windows

    you seem to be confused about the basics , try a book about c++ programming or/and win32 programming. if you want some sugsestions just ask.
  12. Code Review Group

    yes , and it shall be called LIFE.
  13. signs

    k , i went for if ( x < 0) return -1;return 1;. one more query: is replacing one cross product , with like 10 if statments to get the sign of the answer , a bad strategy.keep in mind they are 10 if's , and they are full of value comparison. iam using this for my ray intersection , so i want max performance.
  14. signs

    it's a float , so iam a little lost in terms of how they are encoded in memory. is dividing a number by it self , or negative self ,a pricy process?. where do you get info about data encoding in memory , like knowing which bit is for the sign etc.. thnx
  15. signs

    is x/abs(x) a cheap process , or is it treated like normal division. is there is a method to get the sign of a number.