Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8212853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:54:39+00:00 2026-06-07T10:54:39+00:00

my code is not really working (no errors, but the rectangle is not shown).

  • 0

my code is not really working (no errors, but the rectangle is not shown).
I have 3 classes: CFramework, CRectangle, CGame.
Whats wrong/missing?

My CFramework class initiates SDL and sets the video mode etc.

CRectangle.hpp:

#ifndef  RECTANGLE_HPP
#define RECTANGLE_HPP

#include "Framework.hpp"

class CRectangle
{
    public:    
        CRectangle ();
        void createRectangle (int x, int y, int width, int height, int r, int g, int b);

    private:
        SDL_Surface *m_pScreen; // Pointer at the screen of CFramework
        SDL_Rect m_Rect;
};


#endif

CRectangle.cpp:

#include "Rectangle.hpp"


// Konstruktor
//
// Aufgabe: Zeiger auf Screen holen
//
CRectangle::CRectangle ()
{
    // Zeiger auf Screen holen
    m_pScreen = g_pFramework->GetScreen ();

} // Konstruktor

// createRectangle
//
// Aufgabe: Viereck erstellen
//
void CRectangle::createRectangle (int x, int y, int width, int height, int r, int g, int b)
{
        m_Rect.x = x;
        m_Rect.y = y;
        m_Rect.w = width;
        m_Rect.h = height;
        SDL_FillRect(m_pScreen, &m_Rect, SDL_MapRGB(m_pScreen->format, r, g, b));
} // createRectangle

CGame.cpp:

... // just the important stuff
    m_pRectangleMenu = new CRectangle;
    m_pRectangleMenu->createRectangle(100,100,400,400,233,34,34);
...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:54:40+00:00Added an answer on June 7, 2026 at 10:54 am
    // just the important stuff
    m_pRectangleMenu = new CRectangle;
    m_pRectangleMenu->createRectangle(100,100,400,400,233,34,34);
    

    Well since you didn’t include an “SDL_Flip(screen_variable)”…maybe that’s your problem. If not, you should post up unto the SDL_Flip().

    Reagan

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have no code to really display here, since I have not been able
Hy, I don't really understand why my code isn't working. Short description: I have
I'm not really getting how this code does what it does: char shellcode[] =
I really do not understand how is this error happening at this code. Please
Below code not work, but it's work fine for jsf1.2. Now the framework is
current code (not working): /^script\s*type=\text\/javascript/i.test(tagName)
my jquery code not run with IE6 but runs all others including IE7. It
Why is the following code not working? if(EventLog.Exists(Foo)) { EventLog.Delete(Foo); } if(EventLog.Exists(Foo) == false)
I've been working on code that's intended to be used with objects, without really
I really can't figure out why my code isn't working because Twilio's debugger isnt

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.