About Store Forum Documentation Contact



Post Reply 
unsigned char
Author Message
Rogus Offline
Member

Post: #1
unsigned char
Hi.
I think it's noob question but... how to get const unsigned char * in EE? I'm trying to use berkelium and there is a method onPaint which has one argument like this.
10-06-2013 12:36 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #2
RE: unsigned char
I believe you could use ushort - which is unsigned short which is an unsigned 16bit integer, which is the same thing as an unsigned char essentially.
10-07-2013 01:03 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: unsigned char
Quote:I believe you could use ushort - which is unsigned short which is an unsigned 16bit integer, which is the same thing as an unsigned char essentially.
unsigned char is 8-bit in C++
but in EE Code Editor, char is wchar_t (size of 2 bytes, 16-bits)

Quote:Hi.
I think it's noob question but... how to get const unsigned char * in EE? I'm trying to use berkelium and there is a method onPaint which has one argument like this.
What are you trying to cast?

If you want to have C++ unsigned char, then use 'byte'
10-07-2013 01:33 AM
Find all posts by this user Quote this message in a reply
Scarlet Thread Offline
Member

Post: #4
RE: unsigned char
You can use all the standard C++ types if you want. The EE char which is wchar_t is Char with a capital C. So there's nothing stopping you from writing const unsigned char* or, C unsigned char*, or C unsigned Char8*.
(This post was last modified: 10-07-2013 02:07 AM by Scarlet Thread.)
10-07-2013 02:04 AM
Find all posts by this user Quote this message in a reply
Rogus Offline
Member

Post: #5
RE: unsigned char
It seems to me it doesn't work. Maybe i'm doing something wrong. I need to overload method onPaint
PHP Code:
class MyDelegate : public Berkelium::WindowDelegate {
    
virtual void onPaint(Berkelium::Windowwini,
        const 
unsigned char *bitmap_in, const Berkelium::Rect &bitmap_rect,
        
size_t num_copy_rects, const Berkelium::Rectcopy_rects,
        
int dxint dy, const Berkelium::Rectscroll_rect) {
      
// handle paint events...
    
}
  }; 

I did simple test. I've created console app with visual and I set break point inside that method. Break point was caught.
When i tried the same with EE and C byte* nothing happens (i set inside -Exit("....")).
10-08-2013 07:34 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: unsigned char
Hi,

I've checked, 'byte' is actually defined as 'unsigned __int8', so maybe it won't work

'char8' is just 'C++ char' (without unsigned) so it may not work either, and you can't do 'unsigned char8' because C++ does not allow using unsigned on custom typedefs

So perhaps the best solution would be:

Make "Unsigned Char.h":
typedef unsigned char UnsignedChar;

Then in your application properties:
Include the "Unsigned Char.h" header, and use the 'UnsignedChar' type in your codes.
10-10-2013 10:27 PM
Find all posts by this user Quote this message in a reply
Post Reply