Complete the implemention of Gears in GLRendering

* Add the gears_64.png resource to GLRendering.rdef
* Add GearsView.cpp and header
* Add to Jamfile
* Add a GearsView to the OpenGLView
* Make the default window width wider to fit the gears
This commit is contained in:
John Scipione 2012-04-11 01:57:39 -04:00
parent b5adb259c3
commit 58c352015a
8 changed files with 108 additions and 11 deletions

View File

@ -1,8 +1,10 @@
resource(1, "BEOS:APP_SIG") #'MIMS' "application/x-vnd.Haiku-3DRendering";
resource app_signature "application/x-vnd.Haiku-3DRendering";
resource app_name_catalog_entry "x-vnd.Haiku-3DRendering:System name:3D Rendering";
resource(1, "gears_64.png") #'PNG ' import "gears_64.png";
resource app_flags B_SINGLE_LAUNCH;
resource app_version {
@ -32,4 +34,3 @@ resource vector_icon {
$"02000A0001051001178422040A0203050403000A000203041810FF0215810004"
$"178222040A030103000A04010400"
};

View File

@ -0,0 +1,66 @@
/*
* Copyright 2012 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Author:
* John Scipione <jscipione@gmail.com>
*/
#include "GearsView.h"
#include <Catalog.h>
#include <Locale.h>
#include <Size.h>
#include <TranslationUtils.h>
#include <TranslatorFormats.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "GearsView"
static const float kStripeWidth = 30.0;
GearsView::GearsView()
:
BView("GearsView", B_WILL_DRAW),
fGears(NULL)
{
SetExplicitPreferredSize(BSize(64 + 5, B_SIZE_UNLIMITED));
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
_InitGearsBitmap();
}
GearsView::~GearsView()
{
delete fGears;
}
void
GearsView::_InitGearsBitmap()
{
fGears = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "gears_64.png");
}
void
GearsView::Draw(BRect updateRect)
{
SetHighColor(ViewColor());
FillRect(updateRect);
BRect stripeRect = Bounds();
stripeRect.right = kStripeWidth;
SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT));
FillRect(stripeRect);
if (fGears == NULL)
return;
SetDrawingMode(B_OP_ALPHA);
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
DrawBitmapAsync(fGears, BPoint(5, 70));
}

View File

@ -0,0 +1,30 @@
/*
* Copyright 2012 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef GEARS_VIEW_H
#define GEARS_VIEW_H
#include <View.h>
class BBitmap;
class GearsView : public BView {
public:
GearsView();
virtual ~GearsView();
virtual void Draw(BRect updateRect);
protected:
void _InitGearsBitmap();
private:
BBitmap* fGears;
};
#endif /* OPENGL_VIEW_H */

View File

@ -17,6 +17,7 @@ local sources =
ExtensionsList.cpp
ExtensionsView.cpp
InfoView.cpp
GearsView.cpp
;
Includes [ FGristFiles $(sources) ] : $(HAIKU_MESA_HEADERS_DEPENDENCY) ;
@ -28,7 +29,6 @@ Preference 3DRendering
: be GL translation libcolumnlistview.a $(HAIKU_LOCALE_LIBS)
$(TARGET_LIBSUPC++)
: 3DRendering.rdef
: Gears.rdef
;
DoCatalogs 3DRendering :
@ -38,6 +38,7 @@ DoCatalogs 3DRendering :
ExtensionsList.cpp
ExtensionsView.cpp
InfoView.cpp
GearsView.cpp
OpenGLWindow.cpp
;

View File

@ -7,6 +7,7 @@
* Artur Wyszynski <harakash@gmail.com>
*/
#include "OpenGLView.h"
#include <stdio.h>
@ -67,20 +68,17 @@ OpenGLView::OpenGLView()
GroupLayout()->SetSpacing(0);
BLayoutBuilder::Group<>(this)
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.Add(menuField)
.AddGroup(B_HORIZONTAL, 0)
.Add(new GearsView())
.AddGroup(B_HORIZONTAL)
.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
.SetInsets(0, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.Add(menuField)
.Add(tabView)
.SetInsets(0, B_USE_DEFAULT_SPACING, 0, 0)
.End()
.End();
}
OpenGLView::~OpenGLView()
{
}

View File

@ -26,4 +26,5 @@ public:
virtual ~OpenGLView();
};
#endif /* OPENGL_VIEW_H */

View File

@ -16,7 +16,7 @@
OpenGLWindow::OpenGLWindow()
:
BWindow(BRect(50, 50, 450, 400), B_TRANSLATE_SYSTEM_NAME("3D Rendering"),
BWindow(BRect(50, 50, 450 + 64, 400), B_TRANSLATE_SYSTEM_NAME("3D Rendering"),
B_TITLED_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS
| B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB