dev-cpp-users Mailing List for Dev-C++ (Page 3)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
1
(5) |
2
(4) |
3
(2) |
|
4
(4) |
5
(10) |
6
|
7
|
8
(2) |
9
(2) |
10
|
|
11
(5) |
12
(4) |
13
(14) |
14
|
15
(11) |
16
(1) |
17
|
|
18
|
19
|
20
(2) |
21
(10) |
22
(3) |
23
(5) |
24
|
|
25
(2) |
26
(3) |
27
|
28
(5) |
29
(3) |
30
|
|
|
From: Alessandro B. <ale...@is...> - 2007-11-13 16:14:07
|
Sorry,
vector <string> elenco;
Alessandro
Per Westermark ha scritto:
> Don't you think it would help if your mail also contains the
> declaration for elenco?
>
> /pwm
>
> On Mon, 12 Nov 2007, Alessandro Bugatti wrote:
>
>
>> Hello, I wrote this method and I receive an error message in compilation:
>>
>> bool Dizionario::inDictionary(const string &a) const
>> {
>> vector<string>::iterator result =
>> find( elenco.begin(), elenco.end(), a );
>> if (result == elenco.end()) return false;
>> return true;
>> }
>>
>> 598 C:\Programmi\Dev-Cpp\include\c++\3.3.1\bits\stl_iterator.h invalid
>> conversion from `const std::string* const' to `std::string*'
>>
>> I wonder the problem is in elenco.begin() and elenco.end() and the const
>> method (if I erase the keyword const the program is OK, but I don't want
>> remove const because the method is const).
>> Have I cast elenco.begin() and elenco.end()? In which mode?
>> Thanks
>> Alessandro
>>
>> --
>> ************************************************
>> Prof. Alessandro Bugatti
>> Docente di Informatica
>> Istituto Tecnico Industriale Statale B. Castelli
>> E-mail: ale...@is...
>> Sito web: www.imparando.net
>> ************************************************
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems? Stop.
>> Now Search log events and configuration files using AJAX and a browser.
>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>> _______________________________________________
>> Dev-cpp-users mailing list
>> Dev...@li...
>> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
>> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>>
>>
>
>
>
>
--
************************************************
Prof. Alessandro Bugatti
Docente di Informatica
Istituto Tecnico Industriale Statale B. Castelli
E-mail: ale...@is...
Sito web: www.imparando.net
************************************************
|
|
From: Philip B. <phi...@pb...> - 2007-11-13 10:47:48
|
Hi Per, Thanks for all the help. You gave some great information, as always. The game is realtime, meaning that more than one thread will have to modify the enemy at the same time (the data cannot be cashed). The player thread will look for the enemies when the player walks for instance which means reading, or when he fires to see if an enemy was hit which means writing if the enemy needs to be woonded. So you think it's safe to have a critical section for each enemy? That's the way I originally planned it but I thought that maybe entering and leaving all these critical sections constantly would take up too much processor power. It's a good idea having several critical sections for each character depending on the action performed, but in this case it's not really an option because all it really does is to read and modify members in a struct. Regards Philip Bennefall ----- Original Message ----- From: "Per Westermark" <pw...@ia...> To: "Philip Bennefall" <phi...@pb...> Cc: <dev...@li...> Sent: Tuesday, November 13, 2007 3:07 AM Subject: Re: [Dev-C++] Multi threading in game > My guess is that the code you perform in an enemy is very quick (probably > microseconds) so waiting for a lock shouldn't be a problem. > > Having one big critical section is more important if you have a _huge_ > amount of objects and have to think about consumed resources. If you can, > it is better to have a granular solution, where you lock small sections. > 1) It gives less chance of a collision. > 2) It will probably be locked for a shorter time - you don't get tempted > to take a lock and then iterate through all objects and perform > mass-updates. > > There might even be situations where it might be meaningful to have more > than one lock/object. Some actions may for example only affect (or be > accted by) a limited set of object properties, while other actions may > affect (or be affected by) a different set of properties. > > A separate issue: Do all objects make their decisions based on the > "current" state, or do you make a snapshot of all state and base the next > action on the snapshot state? If everything is real-time, then it is > reasonable to walk through all objects continuously in a round-robin. If > the game is turn-based (or pseudo-realtime) then all objects decides what > will happen based on a locked state and then all objects switches to the > new state before making new decisions. In this case, you need hardly any > locking at all. Only one thread is responsible for updating each object, > and the input state is fixed until all book-keeping has been done. Then > all threads can decide to lock their huge locks, switch to next state and > then release the locks and start deciding on next state. > > About total CPU load: Need all enemies be awake? Many games can sleep all > enemies more than a specific distance from a player. What you can't see, > you can't complain about, if you excuse the pun :) > > /pwm > > On Tue, 13 Nov 2007, Philip Bennefall wrote: > >> Hello everyone, >> >> This will be a rather long message. >> >> I have a question regarding multi threading and syncrhonization for a >> game that I'm working on. The game will have hundreds of objects >> (enemies, bullets and so on), and I am trying to think of an efficient >> way to implement this using multiple threads. >> >> I will have input and player actions in one thread since they are tied >> together, window message processing in the main thread which will be >> idle for the most part, and then a thread which handles the enemies. I >> will give them different priority levels so that they don't all move at >> full speed all the time. I have two ideas for how to do this: >> >> 1. Give each enemy its own critical section object so that it is free >> whenever it is not being read or written to. Then whenever the player >> thread or another enemy in the same thread wants to access it either for >> reading or writing, it'll enter the critical section. I figure that this >> could potencially cause delays, for example what if an enemy decides to >> move while the player is firing at it and thus modifying its data from a >> different thread? >> >> 2. Have a critical section for all the enemies, which I guess would >> not be very practical but it is one idea that I had. >> >> Can anyone perhaps suggest a good way of handling this? I want to be >> able to read and write the enemy information from any thread as fast as >> possible, though most of the work will occur in one and the same thread >> (the enemy thread). >> >> Thanks in advance for any help. >> >> Regards >> Philip Bennefall > > |
|
From: Jonathan W. <jon...@gm...> - 2007-11-13 08:42:20
|
Nah, it's written in lemon juice, hold a candle to your screen to reveal his message :D Disclaimer: this may or may not damage your screen, proceed at your own risk. On Nov 13, 2007 7:49 AM, Chris Miller <lor...@gm...> wrote: > Either that or it's a case of some horrific packet loss ; ) > > -- > Registered Linux Addict #431495 > http://profile.xfire.com/mrstalinman > John 3:16! > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > -- <Morpheus> linux, c'est une question de VI ou de MORE |
|
From: Chris M. <lor...@gm...> - 2007-11-13 06:49:37
|
Either that or it's a case of some horrific packet loss ; ) -- Registered Linux Addict #431495 http://profile.xfire.com/mrstalinman John 3:16! |
|
From: Per W. <pw...@ia...> - 2007-11-13 02:09:00
|
It is hard to know if you want help with something, or if you wanted to inform us about something? Please expand your comments a bit ;) /pwm On Tue, 13 Nov 2007, yun peter wrote: > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Per W. <pw...@ia...> - 2007-11-13 02:08:05
|
My guess is that the code you perform in an enemy is very quick (probably microseconds) so waiting for a lock shouldn't be a problem. Having one big critical section is more important if you have a _huge_ amount of objects and have to think about consumed resources. If you can, it is better to have a granular solution, where you lock small sections. 1) It gives less chance of a collision. 2) It will probably be locked for a shorter time - you don't get tempted to take a lock and then iterate through all objects and perform mass-updates. There might even be situations where it might be meaningful to have more than one lock/object. Some actions may for example only affect (or be accted by) a limited set of object properties, while other actions may affect (or be affected by) a different set of properties. A separate issue: Do all objects make their decisions based on the "current" state, or do you make a snapshot of all state and base the next action on the snapshot state? If everything is real-time, then it is reasonable to walk through all objects continuously in a round-robin. If the game is turn-based (or pseudo-realtime) then all objects decides what will happen based on a locked state and then all objects switches to the new state before making new decisions. In this case, you need hardly any locking at all. Only one thread is responsible for updating each object, and the input state is fixed until all book-keeping has been done. Then all threads can decide to lock their huge locks, switch to next state and then release the locks and start deciding on next state. About total CPU load: Need all enemies be awake? Many games can sleep all enemies more than a specific distance from a player. What you can't see, you can't complain about, if you excuse the pun :) /pwm On Tue, 13 Nov 2007, Philip Bennefall wrote: > Hello everyone, > > This will be a rather long message. > > I have a question regarding multi threading and syncrhonization for a > game that I'm working on. The game will have hundreds of objects > (enemies, bullets and so on), and I am trying to think of an efficient > way to implement this using multiple threads. > > I will have input and player actions in one thread since they are tied > together, window message processing in the main thread which will be > idle for the most part, and then a thread which handles the enemies. I > will give them different priority levels so that they don't all move at > full speed all the time. I have two ideas for how to do this: > > 1. Give each enemy its own critical section object so that it is free > whenever it is not being read or written to. Then whenever the player > thread or another enemy in the same thread wants to access it either for > reading or writing, it'll enter the critical section. I figure that this > could potencially cause delays, for example what if an enemy decides to > move while the player is firing at it and thus modifying its data from a > different thread? > > 2. Have a critical section for all the enemies, which I guess would > not be very practical but it is one idea that I had. > > Can anyone perhaps suggest a good way of handling this? I want to be > able to read and write the enemy information from any thread as fast as > possible, though most of the work will occur in one and the same thread > (the enemy thread). > > Thanks in advance for any help. > > Regards > Philip Bennefall |
|
From: yun p. <cer...@gm...> - 2007-11-13 02:05:58
|
|
From: Chris M. <lor...@gm...> - 2007-11-13 01:35:33
|
On Nov 12, 2007 5:15 PM, Philip Bennefall <phi...@pb...> wrote: > Hello everyone, > > This will be a rather long message. My resolution is 1680x1050 and it didn't even take up the whole screen :) > I have a question regarding multi threading and syncrhonization for a game > that I'm working on. The game will have hundreds of objects (enemies, > bullets and so on), and I am trying to think of an efficient way to > implement this using multiple threads. You're using pthreads, obviously. > I will have input and player actions in one thread since they are tied > together, window message processing in the main thread which will be idle > for the most part, and then a thread which handles the enemies. I will give > them different priority levels so that they don't all move at full speed all > the time. I have two ideas for how to do this: Wrong. You're looking at it from where the chair, which isn't how to write an application. What you want to do is consider which parts of the game will induce latencies. Primarily, the networking, caching, and graphics components. You're going to spend time waiting for network packets, time waiting for files from the hard drive, and for things to render. It's best to encapsulate these into their own threads so that they can do their thing with a certain degree of asynchronousness from the primary game loop. Enemies and allies are the same to the game engine. Whether one is controlled by AI simulations and one by the chimpanzee between the chair and keyboard makes little difference if you do it correctly and make sure they use the same input paths to the core game engine. > 1. Give each enemy its own critical section object so that it is free > whenever it is not being read or written to. Then whenever the player thread > or another enemy in the same thread wants to access it either for reading or > writing, it'll enter the critical section. I figure that this could > potencially cause delays, for example what if an enemy decides to move while > the player is firing at it and thus modifying its data from a different > thread? Read about pthred mutexes. > 2. Have a critical section for all the enemies, which I guess would not be > very practical but it is one idea that I had. You're thinking, but it won't work :( > Can anyone perhaps suggest a good way of handling this? I want to be able to > read and write the enemy information from any thread as fast as possible, > though most of the work will occur in one and the same thread (the enemy > thread). Speed is achieved when you ditch silly things like XML and strings to throw around core game data. Threading is used to make high latency components asynchronous from the rest of the game to make the framerate less laggy. -- Registered Linux Addict #431495 http://profile.xfire.com/mrstalinman John 3:16! |
|
From: Philip B. <phi...@pb...> - 2007-11-13 01:16:22
|
Hello everyone, This will be a rather long message. I have a question regarding multi threading and syncrhonization for a = game that I'm working on. The game will have hundreds of objects = (enemies, bullets and so on), and I am trying to think of an efficient = way to implement this using multiple threads. I will have input and player actions in one thread since they are tied = together, window message processing in the main thread which will be = idle for the most part, and then a thread which handles the enemies. I = will give them different priority levels so that they don't all move at = full speed all the time. I have two ideas for how to do this: 1. Give each enemy its own critical section object so that it is free = whenever it is not being read or written to. Then whenever the player = thread or another enemy in the same thread wants to access it either for = reading or writing, it'll enter the critical section. I figure that this = could potencially cause delays, for example what if an enemy decides to = move while the player is firing at it and thus modifying its data from a = different thread? 2. Have a critical section for all the enemies, which I guess would not = be very practical but it is one idea that I had. Can anyone perhaps suggest a good way of handling this? I want to be = able to read and write the enemy information from any thread as fast as = possible, though most of the work will occur in one and the same thread = (the enemy thread). Thanks in advance for any help. Regards Philip Bennefall |
|
From: Per W. <pw...@ia...> - 2007-11-12 23:43:15
|
Anyway, it is a common problem with C++ and const methods EMA System email: pw...@ia... Per Westermark web: http://iapetus.neab.net Vargvaegen 174B phone: +46 70 214 74 48 S-906 42 Umeaa Sweden On Tue, 13 Nov 2007, Per Westermark wrote: > Don't you think it would help if your mail also contains the > declaration for elenco? > > /pwm > > On Mon, 12 Nov 2007, Alessandro Bugatti wrote: > > > Hello, I wrote this method and I receive an error message in compilation: > > > > bool Dizionario::inDictionary(const string &a) const > > { > > vector<string>::iterator result = > > find( elenco.begin(), elenco.end(), a ); > > if (result == elenco.end()) return false; > > return true; > > } > > > > 598 C:\Programmi\Dev-Cpp\include\c++\3.3.1\bits\stl_iterator.h invalid > > conversion from `const std::string* const' to `std::string*' > > > > I wonder the problem is in elenco.begin() and elenco.end() and the const > > method (if I erase the keyword const the program is OK, but I don't want > > remove const because the method is const). > > Have I cast elenco.begin() and elenco.end()? In which mode? > > Thanks > > Alessandro > > > > -- > > ************************************************ > > Prof. Alessandro Bugatti > > Docente di Informatica > > Istituto Tecnico Industriale Statale B. Castelli > > E-mail: ale...@is... > > Sito web: www.imparando.net > > ************************************************ > > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Per W. <pw...@ia...> - 2007-11-12 23:30:36
|
Don't you think it would help if your mail also contains the
declaration for elenco?
/pwm
On Mon, 12 Nov 2007, Alessandro Bugatti wrote:
> Hello, I wrote this method and I receive an error message in compilation:
>
> bool Dizionario::inDictionary(const string &a) const
> {
> vector<string>::iterator result =
> find( elenco.begin(), elenco.end(), a );
> if (result == elenco.end()) return false;
> return true;
> }
>
> 598 C:\Programmi\Dev-Cpp\include\c++\3.3.1\bits\stl_iterator.h invalid
> conversion from `const std::string* const' to `std::string*'
>
> I wonder the problem is in elenco.begin() and elenco.end() and the const
> method (if I erase the keyword const the program is OK, but I don't want
> remove const because the method is const).
> Have I cast elenco.begin() and elenco.end()? In which mode?
> Thanks
> Alessandro
>
> --
> ************************************************
> Prof. Alessandro Bugatti
> Docente di Informatica
> Istituto Tecnico Industriale Statale B. Castelli
> E-mail: ale...@is...
> Sito web: www.imparando.net
> ************************************************
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Alessandro B. <ale...@is...> - 2007-11-12 22:59:09
|
Hello, I wrote this method and I receive an error message in compilation:
bool Dizionario::inDictionary(const string &a) const
{
vector<string>::iterator result =
find( elenco.begin(), elenco.end(), a );
if (result == elenco.end()) return false;
return true;
}
598 C:\Programmi\Dev-Cpp\include\c++\3.3.1\bits\stl_iterator.h invalid
conversion from `const std::string* const' to `std::string*'
I wonder the problem is in elenco.begin() and elenco.end() and the const
method (if I erase the keyword const the program is OK, but I don't want
remove const because the method is const).
Have I cast elenco.begin() and elenco.end()? In which mode?
Thanks
Alessandro
--
************************************************
Prof. Alessandro Bugatti
Docente di Informatica
Istituto Tecnico Industriale Statale B. Castelli
E-mail: ale...@is...
Sito web: www.imparando.net
************************************************
|
|
From: angel d. <sci...@ho...> - 2007-11-12 17:37:04
|
Is there a way i can change the windows UI (skin) to another one. Because i= got a little tire of using the old wxWigets. =20 I found another wxWigets online but it looks the same as the old wxWigets S= kin. And how can i create my own? _________________________________________________________________ Help yourself to FREE treats served up daily at the Messenger Caf=E9. Stop = by today. http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=3DTXT_TAGLM_Oc= tWLtagline= |
|
From: Per W. <pw...@ia...> - 2007-11-11 14:18:40
|
As you can see, the code become simler when you return the allocated array. Two things: If you fail to allocate a column, it might be a good idea to clean up any partial allocations before returning NULL. This is important if you intend to continue to run the program after a failed allocation. A 10k x 10x array of 32-bit integers would consume about 400MB, so an allocation failure could potentially leak 400MB memory. Then rename Alocate2DVect to Allocate2DVect and everything should be ok :) /pwm EMA System email: pw...@ia... Per Westermark web: http://iapetus.neab.net Vargvaegen 174B phone: +46 70 214 74 48 S-906 42 Umeaa Sweden On Sun, 11 Nov 2007, Andr=E9 Mac=E1rio Barros wrote: > My way of understand your recommendations > did result in this: > > //////code/////////// > #include <stdio.h> > #include <stdlib.h> > > int **Alocate2DVect(int lin, int col) > { > int i, **vect; > > vect =3D (int **) malloc(lin*sizeof(int)); > if(!vect) return(NULL); > for(i=3D0; i<col; i++){ > vect[i] =3D (int *) malloc(col*sizeof(int)); > if(!vect[i]) return(NULL); > } > return(vect); > } > > int main() > { > int **vector2D; > int i, j, lin=3D3, col=3D4; > > vector2D =3D Alocate2DVect(lin, col); > if(!vector2D) exit(EXIT_FAILURE); > > for(i=3D0; i<lin; i++) > for(j=3D0; j<col; j++) > vector2D[i][j] =3D i + j; > > for(i=3D0; i<lin; i++){ > for(j=3D0; j<col; j++){ > printf("%d\t", vector2D[i][j]); > } > printf("\n"); > } > > for(j=3D0; j<col; j++) > free(vector2D[col]); > free(vector2D); > > system("PAUSE"); > return 0; > } > > ///////// end of code //////// > > Is it ok? > > Thanks! > Andr=E9 > > > -----Mensagem original----- > De: Per Westermark [mailto:pw...@ia...] > Enviada em: domingo, 11 de novembro de 2007 04:27 > Para: Andr=E9 Mac=E1rio Barros > Cc: dev...@li... > Assunto: Re: [Dev-C++] function for allocate memory for 2D vectors > > > First of all - your code would be a bit simpler (you would loose one > indirection) if you modify Allocate2DVect (two l in allocate) to return > the pointer instead of taking it as a parameter. > > Second: your test if (!vect) does not check the result of the allocation, > but if you sent a pointer in to the function. > > Third: You normally don't need to release memory before ending a program, > but if you do, then your code is incorrect. You need to release all > columns before releasing the row vector. > > /pwm > > On Sun, 11 Nov 2007, Andr=E9 Mac=E1rio Barros wrote: > > > Dear Users, > > > > Could you confirm if this function is > > correct? > > The reason of my question is: inspecting > > the address of *vect in line x in the function > > is different of line y. I was expecting equal > > addresses, wasn=B4t? > > > > ////////// code ///////////////////////// > > > > int Alocate2DVect(int ***vect, int lin, int col) > > { > > int i, *pont; > > > > *vect =3D (int **) malloc(lin*sizeof(int)); // line x > > if(!vect) return(0); > > for(i=3D0; i<col; i++) *(*vect + i) =3D (int *) malloc(col*sizeof(in= t)); > > if(!vect) return(0); // line y > > return(1); > > } > > > =09> int main() > > { > > int **vector2D; > > int i, j, lin=3D3, col=3D4; > > > > if(!Alocate2DVect(&vector2D, lin, col)) exit(1); > > > > for(i=3D0; i<lin; i++) > > for(j=3D0; j<col; j++) > > vector2D[i][j] =3D i + j; > > > > for(i=3D0; i<lin; i++){ > > for(j=3D0; j<col; j++){ > > printf("%d\t", vector2D[i][j]); > > } > > printf("\n"); > > } > > > > free(vector2D); > > system("PAUSE"); > > return 0; > > } > > //////////// end of code ///////// > > > > Regards > > Andre > > > > > > No virus found in this outgoing message. > > Checked by AVG Free Edition. > > Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: > 10/11/2007 > > 15:47 > > > > > > -----------------------------------------------------------------------= -- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: 10/11/2= 007 > 15:47 > > No virus found in this outgoing message. > Checked by AVG Free Edition. > Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: 10/11/2= 007 > 15:47 > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: <and...@su...> - 2007-11-11 13:51:31
|
My way of understand your recommendations
did result in this:
//////code///////////
#include <stdio.h>
#include <stdlib.h>
int **Alocate2DVect(int lin, int col)
{
int i, **vect;
vect = (int **) malloc(lin*sizeof(int));
if(!vect) return(NULL);
for(i=0; i<col; i++){
vect[i] = (int *) malloc(col*sizeof(int));
if(!vect[i]) return(NULL);
}
return(vect);
}
int main()
{
int **vector2D;
int i, j, lin=3, col=4;
vector2D = Alocate2DVect(lin, col);
if(!vector2D) exit(EXIT_FAILURE);
for(i=0; i<lin; i++)
for(j=0; j<col; j++)
vector2D[i][j] = i + j;
for(i=0; i<lin; i++){
for(j=0; j<col; j++){
printf("%d\t", vector2D[i][j]);
}
printf("\n");
}
for(j=0; j<col; j++)
free(vector2D[col]);
free(vector2D);
system("PAUSE");
return 0;
}
///////// end of code ////////
Is it ok?
Thanks!
André
-----Mensagem original-----
De: Per Westermark [mailto:pw...@ia...]
Enviada em: domingo, 11 de novembro de 2007 04:27
Para: André Macário Barros
Cc: dev...@li...
Assunto: Re: [Dev-C++] function for allocate memory for 2D vectors
First of all - your code would be a bit simpler (you would loose one
indirection) if you modify Allocate2DVect (two l in allocate) to return
the pointer instead of taking it as a parameter.
Second: your test if (!vect) does not check the result of the allocation,
but if you sent a pointer in to the function.
Third: You normally don't need to release memory before ending a program,
but if you do, then your code is incorrect. You need to release all
columns before releasing the row vector.
/pwm
On Sun, 11 Nov 2007, André Macário Barros wrote:
> Dear Users,
>
> Could you confirm if this function is
> correct?
> The reason of my question is: inspecting
> the address of *vect in line x in the function
> is different of line y. I was expecting equal
> addresses, wasn´t?
>
> ////////// code /////////////////////////
>
> int Alocate2DVect(int ***vect, int lin, int col)
> {
> int i, *pont;
>
> *vect = (int **) malloc(lin*sizeof(int)); // line x
> if(!vect) return(0);
> for(i=0; i<col; i++) *(*vect + i) = (int *) malloc(col*sizeof(int));
> if(!vect) return(0); // line y
> return(1);
> }
>
> int main()
> {
> int **vector2D;
> int i, j, lin=3, col=4;
>
> if(!Alocate2DVect(&vector2D, lin, col)) exit(1);
>
> for(i=0; i<lin; i++)
> for(j=0; j<col; j++)
> vector2D[i][j] = i + j;
>
> for(i=0; i<lin; i++){
> for(j=0; j<col; j++){
> printf("%d\t", vector2D[i][j]);
> }
> printf("\n");
> }
>
> free(vector2D);
> system("PAUSE");
> return 0;
> }
> //////////// end of code /////////
>
> Regards
> Andre
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date:
10/11/2007
> 15:47
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: 10/11/2007
15:47
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: 10/11/2007
15:47
|
|
From: <Ulr...@ao...> - 2007-11-11 10:18:17
|
Hi to all,
I assume that the given context asks for using C and not C++.
Who has to work with 2D, 3D arrays and subarrays in C on a
regular basis may find the treatment of these topics in
Press, Teukolsky,Vetterling,Flannery: Numerical Recipes in C,
Cambridge University Press
useful.
Who is willing to switch to C++ is in paradise yet:
#include <vector>
using std::vector;
int main()
{
int i,,j,lin=3, col=4;
vector< vector<int> > vector2D(lin, vector<int>(col));
// constructor call, destruction is automatic
for(i=0; i<lin; i++)
for(j=0; j<col; j++)
vector2D[i][j] = i + j;
// what follows does not belong to the paradise I spoke about
for(i=0; i<lin; i++){
for(j=0; j<col; j++){
printf("%d\t", vector2D[i][j]);
}
printf("\n");
}
system("PAUSE");
return 0;
}
Regards,
Ulrich
|
|
From: Per W. <pw...@ia...> - 2007-11-11 07:26:50
|
First of all - your code would be a bit simpler (you would loose one
indirection) if you modify Allocate2DVect (two l in allocate) to return
the pointer instead of taking it as a parameter.
Second: your test if (!vect) does not check the result of the allocation,
but if you sent a pointer in to the function.
Third: You normally don't need to release memory before ending a program,
but if you do, then your code is incorrect. You need to release all
columns before releasing the row vector.
/pwm
On Sun, 11 Nov 2007, Andr=E9 Mac=E1rio Barros wrote:
> Dear Users,
>
> Could you confirm if this function is
> correct?
> The reason of my question is: inspecting
> the address of *vect in line x in the function
> is different of line y. I was expecting equal
> addresses, wasn=B4t?
>
> ////////// code /////////////////////////
>
> int Alocate2DVect(int ***vect, int lin, int col)
> {
> int i, *pont;
>
> *vect =3D (int **) malloc(lin*sizeof(int)); // line x
> if(!vect) return(0);
> for(i=3D0; i<col; i++) *(*vect + i) =3D (int *) malloc(col*sizeof(int)=
);
> if(!vect) return(0); // line y
> return(1);
> }
>
=09> int main()
> {
> int **vector2D;
> int i, j, lin=3D3, col=3D4;
>
> if(!Alocate2DVect(&vector2D, lin, col)) exit(1);
>
> for(i=3D0; i<lin; i++)
> for(j=3D0; j<col; j++)
> vector2D[i][j] =3D i + j;
>
> for(i=3D0; i<lin; i++){
> for(j=3D0; j<col; j++){
> printf("%d\t", vector2D[i][j]);
> }
> printf("\n");
> }
>
> free(vector2D);
> system("PAUSE");
> return 0;
> }
> //////////// end of code /////////
>
> Regards
> Andre
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: 10/11/2=
007
> 15:47
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: <and...@su...> - 2007-11-11 05:28:12
|
Dear Users,
Could you confirm if this function is
correct?
The reason of my question is: inspecting
the address of *vect in line x in the function
is different of line y. I was expecting equal
addresses, wasn´t?
////////// code /////////////////////////
int Alocate2DVect(int ***vect, int lin, int col)
{
int i, *pont;
*vect = (int **) malloc(lin*sizeof(int)); // line x
if(!vect) return(0);
for(i=0; i<col; i++) *(*vect + i) = (int *) malloc(col*sizeof(int));
if(!vect) return(0); // line y
return(1);
}
int main()
{
int **vector2D;
int i, j, lin=3, col=4;
if(!Alocate2DVect(&vector2D, lin, col)) exit(1);
for(i=0; i<lin; i++)
for(j=0; j<col; j++)
vector2D[i][j] = i + j;
for(i=0; i<lin; i++){
for(j=0; j<col; j++){
printf("%d\t", vector2D[i][j]);
}
printf("\n");
}
free(vector2D);
system("PAUSE");
return 0;
}
//////////// end of code /////////
Regards
Andre
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.28/1123 - Release Date: 10/11/2007
15:47
|
|
From: Per W. <pw...@ia...> - 2007-11-09 09:53:51
|
Take a look and decide for yourself: http://www.bloodshed.net/ Latest news (release 4.9.9.2) is from feb 21 2005. http://sourceforge.net/projects/dev-cpp/ Latest news (release 4.9.9.2) is from feb 22 2005. Last closed bug is from nov 27 2005. The biggest reason for the death is probably that the source is Delphi - not too many are interested in helping with bug fixes or new features. /pwm On Fri, 9 Nov 2007, hhh hhh wrote: > Hello Dev-cpp List : > > I've got to say... I have been a way for a while, but now that I have > again free time, i came across old threads... I started to read to keep u= p, > and read the following : > > Extract of an thread by Per Westermark : "Dev-C++ is dead and Code:Bloc= ks > is a very much better choice of IDE. " > > Per Westermark : Please, do inform me, if not us... Are you sure ?, Is = Dev > CPP Dead ? Won't the project be continued? > I must say that is so, it sadens me, because almost every project I hav= e > worked on, (Small, Large) it was always on Dev Cpp... > > > >From: Per Westermark <pw...@ia...> > >To: seb_kramm <seb...@ya...> > >CC: dev...@li... > >Subject: Re: [Dev-C++] about slider control > >Date: Fri, 26 Oct 2007 19:26:30 +0200 (CEST) > > > >There are problems trying to build MFC application susing Dev-C++, and i= t > >doesn't matter if you call Dev-C++ an IDE or not. > > > >An MFC application requires MFC header files. They are not distributed > >with Dev-C++. > > > >MFC is a c++ application framework. C++ compilers does not like to use > >other C++ compilers libraries, because the layout of C++ objects, the > >calling conventions, the name mangling etc are not the same. Recompiling > >the MFC library with a different compiler requires the MFC source - but > >that is only supplied with some Visual C++ licenses, and if you have a M= $ > >license that incorporates the MFC source, then the interest in using > >Dev-C++ for MFC work is not too big. > > > >The Dev-C++ IDE could be used with the Visual C++ Express compiler, but = I > >don't think too many people would consider that a viable option - > >especially since Visual C++ already comes with a working IDE. > > > >On the other hand: people shouldn't really start any new projects using > >Dev-C++. Dev-C++ is dead and Code:Blocks is a very much better choice of > >IDE. It does directly support a number of freely available compilers. > > > >/pwm > > > >On Fri, 26 Oct 2007, seb_kramm wrote: > > > > > Jessica Chen a =E9crit : > > > > hi, thanks for your reply. > > > > i agree that win32 api is not the best way. > > > > but it seem i cannot use MFC in Dev-C++, so i have to use win32 api= =2E > > > > > > Of course you can... I'll say it again : DevCpp IS JUST AN IDE ! > > > Then, I agree it might be harder than using MS VC...But who want's to > >use MFC, anyway? > > > > > > > i got another way to do controls in Dev-c++ -- "RAD", pls read as > >follow. > > > > but the problem is: it is not easy to invoke other functions in the > >project. > > > > WxWigets(http://www.wxwidgets.org) and RadCpp (http://www.radcpp.co= m). > >Both > > > > have slider components. > > > > > > If you're out on wxWidgets, you can check out > > > http://wxdsgn.sourceforge.net/ > > > > > > > > > > > > > > > > >------------------------------------------------------------------------= - > > > This SF.net email is sponsored by: Splunk Inc. > > > Still grepping through log files to find problems? Stop. > > > Now Search log events and configuration files using AJAX and a browse= r. > > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > > _______________________________________________ > > > Dev-cpp-users mailing list > > > Dev...@li... > > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > > > >------------------------------------------------------------------------= - > >This SF.net email is sponsored by: Splunk Inc. > >Still grepping through log files to find problems? Stop. > >Now Search log events and configuration files using AJAX and a browser. > >Download your FREE copy of Splunk now >> http://get.splunk.com/ > >_______________________________________________ > >Dev-cpp-users mailing list > >Dev...@li... > >TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > _________________________________________________________________ > Transfira J=C1 a =FAltima vers=E3o do Windows Live Messenger! > http://get.live.com/pt-pt/messenger/overview > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: hhh h. <the...@ho...> - 2007-11-09 06:57:48
|
Hello Dev-cpp List : I've got to say... I have been a way for a while, but now that I have again free time, i came across old threads... I started to read to keep up, and read the following : Extract of an thread by Per Westermark : "Dev-C++ is dead and Code:Blocks is a very much better choice of IDE. " Per Westermark : Please, do inform me, if not us... Are you sure ?, Is Dev CPP Dead ? Won't the project be continued? I must say that is so, it sadens me, because almost every project I have worked on, (Small, Large) it was always on Dev Cpp... >From: Per Westermark <pw...@ia...> >To: seb_kramm <seb...@ya...> >CC: dev...@li... >Subject: Re: [Dev-C++] about slider control >Date: Fri, 26 Oct 2007 19:26:30 +0200 (CEST) > >There are problems trying to build MFC application susing Dev-C++, and it >doesn't matter if you call Dev-C++ an IDE or not. > >An MFC application requires MFC header files. They are not distributed >with Dev-C++. > >MFC is a c++ application framework. C++ compilers does not like to use >other C++ compilers libraries, because the layout of C++ objects, the >calling conventions, the name mangling etc are not the same. Recompiling >the MFC library with a different compiler requires the MFC source - but >that is only supplied with some Visual C++ licenses, and if you have a M$ >license that incorporates the MFC source, then the interest in using >Dev-C++ for MFC work is not too big. > >The Dev-C++ IDE could be used with the Visual C++ Express compiler, but I >don't think too many people would consider that a viable option - >especially since Visual C++ already comes with a working IDE. > >On the other hand: people shouldn't really start any new projects using >Dev-C++. Dev-C++ is dead and Code:Blocks is a very much better choice of >IDE. It does directly support a number of freely available compilers. > >/pwm > >On Fri, 26 Oct 2007, seb_kramm wrote: > > > Jessica Chen a écrit : > > > hi, thanks for your reply. > > > i agree that win32 api is not the best way. > > > but it seem i cannot use MFC in Dev-C++, so i have to use win32 api. > > > > Of course you can... I'll say it again : DevCpp IS JUST AN IDE ! > > Then, I agree it might be harder than using MS VC...But who want's to >use MFC, anyway? > > > > > i got another way to do controls in Dev-c++ -- "RAD", pls read as >follow. > > > but the problem is: it is not easy to invoke other functions in the >project. > > > WxWigets(http://www.wxwidgets.org) and RadCpp (http://www.radcpp.com). >Both > > > have slider components. > > > > If you're out on wxWidgets, you can check out > > http://wxdsgn.sourceforge.net/ > > > > > > > > > > >------------------------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > >------------------------------------------------------------------------- >This SF.net email is sponsored by: Splunk Inc. >Still grepping through log files to find problems? Stop. >Now Search log events and configuration files using AJAX and a browser. >Download your FREE copy of Splunk now >> http://get.splunk.com/ >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Transfira JÁ a última versão do Windows Live Messenger! http://get.live.com/pt-pt/messenger/overview |
|
From: Per W. <pw...@ia...> - 2007-11-08 15:44:27
|
Your program has a busy loop that tries to repaint the screen as often as it can. It will consume all processor capacity it can. If it "only" consumes 50%, that is because you have two processors, or a dual-core or a processor with hyper-threading. To reduce the processor load, you should only repaint the display after the scene has changed or after you get a WM_PAINT message. /pwm On Thu, 8 Nov 2007, Jessica Chen wrote: > When I run the .exe file whose function is to display OpenGL in win32 > api controls, I found the CPU resource is used by 50% (showed in > Windows Task Manager). My computer is Pentium CPU 3.40GHz. > > I attached a sample code here to see if anyone can help me to solve > the "performance" problem. I would like to say thanks in advance. > :-) > |
|
From: Jessica C. <jes...@gm...> - 2007-11-08 15:01:16
|
When I run the .exe file whose function is to display OpenGL in win32 api controls, I found the CPU resource is used by 50% (showed in Windows Task Manager). My computer is Pentium CPU 3.40GHz. I attached a sample code here to see if anyone can help me to solve the "performance" problem. I would like to say thanks in advance. :-) |
|
From: Wobien <roo...@pl...> - 2007-11-05 17:08:35
|
Hello Per, Great! I have the example from MSDN working now, so I can try changing it to my needs. Thanks a lot for your prompt reply! Wobien ----- Original Message ----- From: "Per Westermark" <pw...@ia...> To: "Wobien" <roo...@pl...> Cc: "dev-cpp-users-list" <dev...@li...> Sent: Monday, November 05, 2007 2:29 PM Subject: Re: [Dev-C++] trying to use AlphaBlend > MDSN? > > Do you mean Micro-Developers Soft Network? :) > > I think you mean MSDN. > > Yes, you have to define the WINVER define, to set the minimum version of > Windows that your application requires. > > Microsoft has specifically added the WINVER define to "protect" a > developer from by mistake using a Windows API that blocks the application > from working on older OS. > > You define WINVER in the same way that you devine any other preprocesor > data - for example by opening the project settings and add a WINVER=xx. > > /pwm > > On Mon, 5 Nov 2007, Wobien wrote: > >> Hi, >> >> I want to display bitmaps that have transparent and semi-transparent >> pixels >> in a windows program. >> >> Searching the mdsn information on the web I found the AlphaBlend >> function, >> that promises exactly what I wanted, so I gave it a try. >> >> >> >From MSDN topic AlphaBlend: >> " >> Requirements >> Windows NT/2000/XP/Vista: Included in Windows 2000 and later. >> Windows 95/98/Me: Included in Windows 98 and later. >> Header: Declared in Wingdi.h; include Windows.h. >> Library: Included as a resource in Msimg32.dll. >> " >> >> To start with, I copied an example from the mdsn site into a cpp file in >> my >> project. >> I am using windows XP, I included Windows.h, and I added libmsimg32.a to >> the >> command line options for the linker in the project options and I tried to >> compile.(I copied part of my cpp-file below) >> The result was an AlphaBlend not declared errror. >> >> I checked the Windows.h and Wingdi.h files: >> >> >From windows.h: >> " >> #if !(defined NOGDI || defined _WINGDI_H) >> #include <wingdi.h> >> #endif >> " >> >> >From Wingni.h: >> " >> #if (WINVER >= 0x0500) >> WINGDIAPI BOOL WINAPI >> AlphaBlend(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION); >> WINGDIAPI BOOL WINAPI >> GradientFill(HDC,PTRIVERTEX,ULONG,PVOID,ULONG,ULONG); >> WINGDIAPI BOOL WINAPI >> TransparentBlt(HDC,int,int,int,int,HDC,int,int,int,int,UINT); >> #endif >> " >> >> It looks as if the preprocessor skips the declaration of AlphaBlend >> because >> WINVER<0x500. >> Do I have to inform the preprocessor about the windows version I am >> using? >> And if so, how do I do that (I tried to find the answer in the on-line >> manual on the gcc site, but didn't find anything usefull)? >> >> from my cpp-file: >> >> #include <windows.h> >> . >> . >> . >> if (!AlphaBlend(hdcwnd, ulWindowWidth/5, ulWindowHeight/5, >> ulBitmapWidth, ulBitmapHeight, >> hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf)) >> return; // alpha blend failed >> . >> . >> >> Thanks for your attention, >> >> Wobien >> >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> _______________________________________________ >> Dev-cpp-users mailing list >> Dev...@li... >> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> > |
|
From: Per W. <pw...@ia...> - 2007-11-05 13:30:07
|
MDSN? Do you mean Micro-Developers Soft Network? :) I think you mean MSDN. Yes, you have to define the WINVER define, to set the minimum version of Windows that your application requires. Microsoft has specifically added the WINVER define to "protect" a developer from by mistake using a Windows API that blocks the application from working on older OS. You define WINVER in the same way that you devine any other preprocesor data - for example by opening the project settings and add a WINVER=xx. /pwm On Mon, 5 Nov 2007, Wobien wrote: > Hi, > > I want to display bitmaps that have transparent and semi-transparent pixels > in a windows program. > > Searching the mdsn information on the web I found the AlphaBlend function, > that promises exactly what I wanted, so I gave it a try. > > > >From MSDN topic AlphaBlend: > " > Requirements > Windows NT/2000/XP/Vista: Included in Windows 2000 and later. > Windows 95/98/Me: Included in Windows 98 and later. > Header: Declared in Wingdi.h; include Windows.h. > Library: Included as a resource in Msimg32.dll. > " > > To start with, I copied an example from the mdsn site into a cpp file in my > project. > I am using windows XP, I included Windows.h, and I added libmsimg32.a to the > command line options for the linker in the project options and I tried to > compile.(I copied part of my cpp-file below) > The result was an AlphaBlend not declared errror. > > I checked the Windows.h and Wingdi.h files: > > >From windows.h: > " > #if !(defined NOGDI || defined _WINGDI_H) > #include <wingdi.h> > #endif > " > > >From Wingni.h: > " > #if (WINVER >= 0x0500) > WINGDIAPI BOOL WINAPI > AlphaBlend(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION); > WINGDIAPI BOOL WINAPI GradientFill(HDC,PTRIVERTEX,ULONG,PVOID,ULONG,ULONG); > WINGDIAPI BOOL WINAPI > TransparentBlt(HDC,int,int,int,int,HDC,int,int,int,int,UINT); > #endif > " > > It looks as if the preprocessor skips the declaration of AlphaBlend because > WINVER<0x500. > Do I have to inform the preprocessor about the windows version I am using? > And if so, how do I do that (I tried to find the answer in the on-line > manual on the gcc site, but didn't find anything usefull)? > > from my cpp-file: > > #include <windows.h> > . > . > . > if (!AlphaBlend(hdcwnd, ulWindowWidth/5, ulWindowHeight/5, > ulBitmapWidth, ulBitmapHeight, > hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf)) > return; // alpha blend failed > . > . > > Thanks for your attention, > > Wobien > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Wobien <roo...@pl...> - 2007-11-05 13:16:10
|
Hi,
I want to display bitmaps that have transparent and semi-transparent pixels
in a windows program.
Searching the mdsn information on the web I found the AlphaBlend function,
that promises exactly what I wanted, so I gave it a try.
>From MSDN topic AlphaBlend:
"
Requirements
Windows NT/2000/XP/Vista: Included in Windows 2000 and later.
Windows 95/98/Me: Included in Windows 98 and later.
Header: Declared in Wingdi.h; include Windows.h.
Library: Included as a resource in Msimg32.dll.
"
To start with, I copied an example from the mdsn site into a cpp file in my
project.
I am using windows XP, I included Windows.h, and I added libmsimg32.a to the
command line options for the linker in the project options and I tried to
compile.(I copied part of my cpp-file below)
The result was an AlphaBlend not declared errror.
I checked the Windows.h and Wingdi.h files:
>From windows.h:
"
#if !(defined NOGDI || defined _WINGDI_H)
#include <wingdi.h>
#endif
"
>From Wingni.h:
"
#if (WINVER >= 0x0500)
WINGDIAPI BOOL WINAPI
AlphaBlend(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
WINGDIAPI BOOL WINAPI GradientFill(HDC,PTRIVERTEX,ULONG,PVOID,ULONG,ULONG);
WINGDIAPI BOOL WINAPI
TransparentBlt(HDC,int,int,int,int,HDC,int,int,int,int,UINT);
#endif
"
It looks as if the preprocessor skips the declaration of AlphaBlend because
WINVER<0x500.
Do I have to inform the preprocessor about the windows version I am using?
And if so, how do I do that (I tried to find the answer in the on-line
manual on the gcc site, but didn't find anything usefull)?
from my cpp-file:
#include <windows.h>
.
.
.
if (!AlphaBlend(hdcwnd, ulWindowWidth/5, ulWindowHeight/5,
ulBitmapWidth, ulBitmapHeight,
hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf))
return; // alpha blend failed
.
.
Thanks for your attention,
Wobien
|