Jump to content

  • Log In with Google      Sign In   
  • Create Account

Endurion

Member Since 21 Feb 2002
Offline Last Active Today, 12:46 AM

#5144909 Expression must have class type?

Posted by Endurion on 06 April 2014 - 11:10 PM

As BHXSpecter said, we need the exact message and the location in the code.

 

Usually this message appears if you use dot.member (something.member)  on a pointer or something that isn't either struct or class.




#5143833 SDL undeclared filename and apply_surface not working

Posted by Endurion on 01 April 2014 - 11:43 PM

To keep the window running you need to have a "main loop", a loop that keeps the program running. If you leave the main method your program ends. From the tutorial code it's this snippet:

 

bool quit = false;
//While the user hasn't quit
while( quit == false )
{
  //While there's events to handle
  while( SDL_PollEvent( &event ) )
  {
    //If the user has Xed out the window
    if( event.type == SDL_QUIT )
    {
      //Quit the program
      quit = true;
    }
  }
}



#5143621 SDL undeclared filename and apply_surface not working

Posted by Endurion on 31 March 2014 - 11:50 PM

Well, you seem to have simply copy/pasted a few lines of code out of the working tutorial code.

 

Your main issue right now seems to be to read errors properly.

 

1)

The filename. You pasted a few lines from a function, which had parameter as a function argument. Obviously that argument is not here, so you have to declare filename yourself above the location where you access it. The compiler simply doesn't know what "filename" is (Hint: In the tutorial code it's a std::string)

 

2)

apply_surface is the same. It's a function defined in the tutorial code. You only copied lines calling that function. The compiler obviously does not know the function.

Simple solution: Copy also the apply_surface function and paste it above the main function.




#5141273 Why does this work?(Class prototype?)

Posted by Endurion on 22 March 2014 - 12:52 PM

Note however forward declaration only works if the compiler doesn't need to know anything of the inner parts of that class. This means you can only forward declare pointers or references, not direct objects.




#5138903 0..99 or 0..100

Posted by Endurion on 14 March 2014 - 04:43 AM

Win32-API uses inclusive/exclusive. MSs rationale for this is mathematics.

 

If you want to double a rect you can simply multiply all four values by 2.




#5133500 deinstancing c-strings

Posted by Endurion on 22 February 2014 - 06:01 AM

Seriously, noone comes up with this?

 

enum Colors
{
  red = 0xffff0000,
  green = 0xff00ff00,
  blue = 0xff0000ff
};

 

You get the best of enums and you get rid of the if/else-code completely.




#5129910 how to create a menu like that?

Posted by Endurion on 08 February 2014 - 02:30 PM

The Tab control is available in raw win32. It provides the tabs and their looks. You do have to manage the changing of child pages yourself.

 

Simple setup here: http://winapi.freetechsecrets.com/win32/WIN32Creating_a_Tab_Control.htm

 

More complex wrapper: http://www.codeproject.com/Articles/14712/Win32-SDK-C-Tab-Control-Made-Easy




#5129240 Visual Studio Questions

Posted by Endurion on 06 February 2014 - 12:44 AM

Visual Studio can nicely be uninstalled, but you need to use the main setup for this. Do NOT try to uninstall it's dependencies on your own. It will take care to remove the installed dependencies fine.

 

I had VS 2003, VS 2008 and VS 2010 installed (in that order). Then I uninstalled VS 2003 without problems, with VS 2008 and VS 2010 still working fine.




#5126539 WIN32 how to put an image on the desktop without a window?

Posted by Endurion on 26 January 2014 - 11:49 AM

That is a window. There's nothing in Win32 without a HWND.

 

You can disable all borders and the caption via window styles.




#5115579 Win32 programming, relevant in windows 8?

Posted by Endurion on 09 December 2013 - 12:57 AM


soon .NET

You surely have a reference for that bollocks?

 

 

Win32 is going to stay for quite a long while yet, as will .NET.

 

And both work fine in Windows 8. Just way too much software is working with it so Microsoft won't throw them away any time soon.




#5115051 How to detect only attached device using win32 GetRawInputDeviceList?

Posted by Endurion on 07 December 2013 - 01:01 AM

From a MVP page (don't ask me which one) I took this to weed out those "virtual" combined devices like this:

 

  UINT        numDevices = 0;
  if ( GetRawInputDeviceList( NULL, &numDevices, sizeof( RAWINPUTDEVICELIST ) ) != 0 )
  {
    // Error?
    return false;
  }
  RAWINPUTDEVICELIST*   pDeviceData = new RAWINPUTDEVICELIST[numDevices];
  if ( GetRawInputDeviceList( pDeviceData, &numDevices, sizeof( RAWINPUTDEVICELIST ) ) == -1 )
  {
    // Error
    delete[] pDeviceData;
    return false;
  }
  int numTotalControls    = 0;
  int numTotalVirtualKeys = 0;
  int currentHIDJoystickOrGamepad = 0;
  for ( UINT i = 0; i < numDevices; ++i )
  {
    wchar_t             pathBuffer[260 + 4];
    UINT                bufferSize = UINT( sizeof( pathBuffer ) / sizeof( pathBuffer[0] ) );
    std::wstring        name;
 
    bufferSize = GetRawInputDeviceInfoW( pDeviceData[i].hDevice, RIDI_DEVICENAME, pathBuffer, &bufferSize );
    if ( sizeof pathBuffer / sizeof pathBuffer[0] < bufferSize )
    {
      // Negative UINTs werden sehr groß positiv
      dh::Log( "invalid HID (%d, %x): could not retrieve its path", i, pDeviceData[i].hDevice );
      continue;
    }
    std::wstring    originalName = pathBuffer;
    pathBuffer[1] = L'\\';
    HANDLE              ntHandle = CreateFileW( pathBuffer,
                                                0u,
                                                FILE_SHARE_READ | FILE_SHARE_WRITE, // wir können anderen Prozessen nicht verbieten, das HID zu benutzen
                                                NULL,
                                                OPEN_EXISTING,
                                                0u,
                                                NULL );
    if ( INVALID_HANDLE_VALUE == ntHandle )
    {
      dh::Log( "%d: invalid HID: could not open its handle", i );
      continue;
    }
    if ( GR::Strings::ToUpper( pathBuffer ).find( L"ROOT" ) != std::string::npos )
    {
      // skip combined devices, we only want real devices
      //dh::Log( "skip combined device %d (%x)", i, pDeviceData[i].hDevice );
      continue;
    }
    // snip ... from here one gather additional data from devices



#5113812 How to read depth buffer value at a pixel to CPU and get its world coordinate

Posted by Endurion on 02 December 2013 - 12:47 PM

You're probably better off doing it some other way than reading back memory from the card. Aside from totally botching your frame rate the z buffer values are not directly usable. AFAIK the z value is not stored linearly.




#5099265 Java Image problem

Posted by Endurion on 06 October 2013 - 11:34 PM

In Java wouldn't you have to use .equals with strings? Otherwise you just compare the references (the pointers) which may differ.




#5096884 Learning Assembly on retro consoles?

Posted by Endurion on 26 September 2013 - 01:54 AM

Targetting older stuff first is seconded. The 6502 instruction set is also very similar to its successor, the 6510, which was used in the C64. There's plenty of material out there giving you a glimpse of what to expect.




#5092218 Handling Input as Generic Data (Multiple Inputs)

Posted by Endurion on 06 September 2013 - 10:40 PM

I do something similar to you. I enumerate all devices and their controls (I've got libraries for pure Win32, DirectInput and RawInput).

 

I differ between digital values (interpreted as button presses) and analog values (joystick axes for example). Analog axes are also mapped to digital (with threshold).

 

All these virtual buttons and axes can then be assigned to different actions; customizable by the player. The player can then map any buttons at will (mix joystick, keyboard, mouse).

 

Fun fact: Mapping the analog axis to digital lets me play jump ´n´ runs with the mouse, and it's actually playable :)






PARTNERS